/*
 * @Author: zhoux zhouxia@supervision.ltd
 * @Date: 2023-11-09 14:29:49
 * @LastEditors: zhoux zhouxia@supervision.ltd
 * @LastEditTime: 2023-11-09 15:34:50
 * @FilePath: \general-ai-platform-web\mock\modelDetail.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Request, Response } from 'express';
import { parse } from 'url';

// mock tableListDataSource
const genData = (params: Record<string, any>): Record<string, any> => {
  const data: Record<string, any> = {
    categoryFkId: 2,
    createTime: '2023-10-20T06:23:56.158622Z',
    defaultVersionFkId: null,
    id: params.id,
    name: '离岗',
    remark: '',
    updateTime: '2023-10-20T06:23:56.158622Z',
  };

  //   key: index,
  //   disabled: i % 6 === 0,
  //   href: 'https://ant.design',
  //   avatar: [
  //     'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
  //     'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
  //   ][i % 2],
  //   name: `TradeCode ${index}`,
  //   owner: '曲丽丽',
  //   desc: '这是一段描述',
  //   callNo: Math.floor(Math.random() * 1000),
  //   status: Math.floor(Math.random() * 10) % 4,
  //   updatedAt: moment().format('YYYY-MM-DD'),
  //   createdAt: moment().format('YYYY-MM-DD'),
  //   progress: Math.ceil(Math.random() * 100),

  return data;
};

function getModelDetail(req: Request, res: Response, u: string, b: Request) {
//   let realUrl = u;
//   if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
//     realUrl = req.url;
//   }

//   const body = (b && b.body) || req.body;
//   const { method, name, desc, key } = body;
//   const params = parse(realUrl, true).query as unknown as API.PageParams &
//     API.RuleListItem & {
//       sorter: any;
//       filter: any;
//     };
//   console.log(req, 'getModelDetailApi');
  const result = {
    data: genData({id: 2}),
    success: true,
    msg: '获取成功',
  };

  return res.json(result);
}

export default {
  'GET /api/v1/mock/model/detail': getModelDetail,
};