import type { MockMethod } from './types'

const cardConfigs = [
  { id: 1, cardKey: 'total_online', cardType: 'stat_number', title: '在线机床数', metric: 'online_count', dimension: null, sortOrder: 1, isEnabled: 1, chartConfig: null },
  { id: 2, cardKey: 'total_production_today', cardType: 'stat_number', title: '今日总产量', metric: 'part_count', dimension: null, sortOrder: 2, isEnabled: 1, chartConfig: null },
  { id: 3, cardKey: 'workshop_production', cardType: 'bar_chart', title: '各车间产量', metric: 'part_count', dimension: 'workshop', sortOrder: 3, isEnabled: 1, chartConfig: null },
  { id: 4, cardKey: 'worker_rank', cardType: 'rank_list', title: '工人产量排行', metric: 'part_count', dimension: 'worker', sortOrder: 4, isEnabled: 0, chartConfig: null },
  { id: 5, cardKey: 'machine_status', cardType: 'status_grid', title: '机床状态总览', metric: null, dimension: null, sortOrder: 5, isEnabled: 1, chartConfig: null },
  { id: 6, cardKey: 'collector_status', cardType: 'stat_number', title: '采集服务状态', metric: null, dimension: null, sortOrder: 6, isEnabled: 1, chartConfig: null },
  { id: 7, cardKey: 'production_trend', cardType: 'line_chart', title: '产量趋势(7天)', metric: 'part_count', dimension: null, sortOrder: 7, isEnabled: 1, chartConfig: null },
  { id: 8, cardKey: 'machine_rank', cardType: 'rank_list', title: '机床产量排行', metric: 'part_count', dimension: 'machine', sortOrder: 8, isEnabled: 1, chartConfig: null },
]

const filterConfigs = [
  { id: 1, screenKey: 'screen_main', filterType: 'workshop', filterValue: 'A栋', isDefault: 1, sortOrder: 1 },
  { id: 2, screenKey: 'screen_main', filterType: 'workshop', filterValue: 'B栋', isDefault: 0, sortOrder: 2 },
  { id: 3, screenKey: 'screen_main', filterType: 'brand', filterValue: 'FANUC', isDefault: 0, sortOrder: 3 },
]

const mock: MockMethod[] = [
  { url: '/mock-api/admin/screen-config', method: 'get', response: () => ({ code: 0, data: { items: cardConfigs } }) },
  { url: '/mock-api/admin/screen-config', method: 'post', response: () => ({ code: 0, message: 'success', data: { id: 9 } }) },
  { url: '/mock-api/admin/screen-config/update', method: 'post', response: () => ({ code: 0, message: 'success', data: null }) },
  { url: '/mock-api/admin/screen-config/delete', method: 'post', response: () => ({ code: 0, message: 'success', data: null }) },
  { url: '/mock-api/admin/screen-config/toggle', method: 'post', response: () => ({ code: 0, message: 'success', data: null }) },
  { url: '/mock-api/admin/screen-filter', method: 'get', response: () => ({ code: 0, data: { items: filterConfigs } }) },
  { url: '/mock-api/admin/screen-filter', method: 'post', response: () => ({ code: 0, message: 'success', data: { id: 4 } }) },
  { url: '/mock-api/admin/screen-filter/update', method: 'post', response: () => ({ code: 0, message: 'success', data: null }) },
  { url: '/mock-api/admin/screen-filter/delete', method: 'post', response: () => ({ code: 0, message: 'success', data: null }) },
]

export default mock
