import Mock from 'mockjs';
import setupMock, {
  pageListResponseWrap,
  successResponseWrap,
} from '@/utils/setup-mock';

setupMock({
  setup() {
    // Mock.XHR.prototype.withCredentials = true;

    // 教学点列表
    Mock.mock(new RegExp('/api/apply/teaching/list'), () => {
      return successResponseWrap([
        {
          id: '111',
          name: '教学点11',
        },
        {
          id: '222',
          name: '教学点12',
        },
      ]);
    });
    // 考点列表
    Mock.mock(new RegExp('/api/apply/agent/list'), () => {
      return successResponseWrap([
        {
          id: '111',
          name: '考点11',
        },
        {
          id: '222',
          name: '考点12',
        },
      ]);
    });

    // 预约任务查询
    Mock.mock(new RegExp('/api/admin/apply/task/page'), () => {
      return pageListResponseWrap([
        {
          id: '111',
          name: '任务名称',
          selfApplyStartTime: Date.now(),
          selfApplyEndTime: Date.now(),
          openApplyStartTime: Date.now(),
          openApplyEndTime: Date.now(),
          enable: true,
          updateTime: Date.now(),
        },
      ]);
    });

    // 预约名单
    // 预约名单详情分页
    Mock.mock(new RegExp('/api/apply/std/page'), () => {
      return pageListResponseWrap([
        {
          id: 1,
          stdName: '张三',
          identityNumber: '0120553551541',
          studentCode: '123456789',
          teachingName: '东莞学习中心',
          agentName: 'A考点', // 未预约的时候为空
          applyTimePeriod: '2024-03-01 08:00-12:00', // 未预约的时候为空
          roomName: '考场', // 未排考为空
          seatNumber: '1-1', // 未排考为空
          operationTime: Date.now(), // 未预约的时候为空
        },
      ]);
    });

    // 教学点管理
    // 教学点管理-查询
    Mock.mock(new RegExp('/api/admin/teaching/query'), () => {
      return pageListResponseWrap([
        {
          id: 1,
          name: '教学点01',
          code: 'jxd01',
          cityId: 1,
          cityName: '武汉',
          capacity: 100,
          enable: true,
        },
        {
          id: 2,
          name: '教学点02',
          code: 'jxd02',
          cityId: 2,
          cityName: '长沙',
          capacity: 100,
          enable: true,
        },
      ]);
    });
    // 考点管理
    // 考点管理-查询
    Mock.mock(new RegExp('/api/admin/agent/query'), () => {
      return pageListResponseWrap([
        {
          id: 1,
          name: '考点点01',
          code: 'kd01',
          teachingId: 1,
          teachingName: '教学点01',
          address: '武汉市洪山区关山大道',
          capacity: 150,
          enable: true,
          guide: '使用带斑马纹的表格，可以更容易区分出不同行的数据。',
        },
        {
          id: 2,
          name: '考点点02',
          code: 'kd02',
          teachingId: 2,
          teachingName: '教学点02',
          address: '武汉市洪山区光谷大道',
          capacity: 100,
          enable: true,
          guide:
            '用于展示多条结构类似的数据，可对数据进行排序、筛选、对比或其他自定义操作。',
        },
      ]);
    });
    // 考场管理
    // 考场管理-查询
    Mock.mock(new RegExp('/api/admin/room/query'), () => {
      return pageListResponseWrap([
        {
          id: 1,
          name: '考场01',
          code: 'kc01',
          teachingId: 1,
          teachingName: '教学点01',
          agentId: 1,
          agentName: '考点01',
          address: '武汉市洪山区关山大道',
          capacity: 150,
          enable: true,
        },
        {
          id: 2,
          name: '考场02',
          code: 'kc02',
          teachingId: 2,
          teachingName: '教学点02',
          agentId: 2,
          agentName: '考点02',
          address: '武汉市洪山区关山大道',
          capacity: 200,
          enable: true,
        },
      ]);
    });
  },
});
