import { selectObj } from '@/utils/select'
import { A3flowSearchType, IA3flowListParams } from './types'
import { businessTypeObj, statusObj } from '@/utils/tableData'
import { D4_APIdel } from '@/store/action/D4impStor'
import { B1_APIdel } from '@/store/action/B1collect'
import { B2_APIdel } from '@/store/action/B2identify'
import { FourAPI_del } from '@/store/action/FourAll'
import { C6_APIdel } from '@/store/action/C6edit'
import { D2_APIdel } from '@/store/action/D2storSet'
import { D8_APIdel } from '@/store/action/D8cancel'
import { E1_APIdel } from '@/store/action/E1accident'
import { E2_APIdel } from '@/store/action/E2damaged'
import { E3_APIdel } from '@/store/action/E3actuality'
import { E4_APIdel } from '@/store/action/E4repair'

export const DEFAULT_A3FLOW_PARAMS: IA3flowListParams = {
  pageNum: 1,
  pageSize: 10,
  num: '',
  type: '',
  name: '',
  deptName: '',
  userName: '',
  date: '',
  status: '',
  userType: ''
}

export const A3FLOW_PARAM_ROWS: A3flowSearchType[] = [
  { name: '业务类型', key: 'type', type: '下拉框', data: selectObj['业务类型'] },
  { name: '业务编号', key: 'num', type: '输入框' },
  { name: '申请名称', key: 'name', type: '输入框' },
  { name: '发起部门', key: 'deptName', type: '输入框' },
  { name: '发起人', key: 'userName', type: '输入框' },
  { name: '发起日期范围', key: 'date', type: '日期选择' },
  { name: '申请状态', key: 'status', type: '下拉框', data: selectObj['流程申请状态'] },
  { name: '选择角色', key: 'userType', type: '下拉框', data: selectObj['角色'] }
]

export const A3FLOW_TABLE_COLUMNS = [
  ['txtChange', '业务类型', 'type', businessTypeObj],
  ['txt', '业务编号', 'num'],
  ['txt', '申请名称', 'name'],
  ['txt', '发起部门', 'deptName'],
  ['txt', '发起人', 'creatorName'],
  ['txt', '发起日期', 'createTime'],
  ['txtChange', '申请状态', 'status', statusObj]
]

// TOFIX: 待完善
// 业务类型详情映射
export const BUSINESS_DETAIL_PATH_MAP: Record<string, string> = {
  // 藏品征集
  ZJ: 'collect_edit',
  // 藏品鉴定
  JD: 'identify_edit',
  // 藏品入馆
  RG: 'entering_edit',
  // 藏品入藏
  RC: 'enterTibet_edit',
  // 藏品登记
  DJ: 'register_edit',
  // 藏品编辑
  BJ: 'goodEdit_edit',
  // 藏品删除
  SC: '',
  // 藏品入库
  RK: 'impStor_edit',
  // 藏品移库
  YK: 'moveStor_edit',
  // 藏品出库
  CK: 'putsStor_edit',
  // 藏品注销
  ZX: 'cancel_edit',
  // 藏品盘点
  PD: 'check_edit',
  // 人员出入库
  CR: 'staff_edit',
  // 事故登记
  SG: 'accident_edit',
  // 残损登记
  CS: 'damaged_edit',
  // 现状登记
  XZ: 'actuality_edit',
  // 文物修复
  XF: 'repair_edit',
  // 借展管理
  ZL: 'exhibition_edit',
  // 藏品总登记号
  ZDJ: ''
}

// TOFIX: 待完善
// 业务类型删除接口映射
export const BUSINESS_DELETE_API_MAP: Record<string, Function> = {
  // 藏品征集
  ZJ: B1_APIdel,
  // 藏品鉴定
  JD: B2_APIdel,
  // 藏品入馆
  RG: (id: number) => FourAPI_del('1', id),
  // 藏品入藏
  RC: (id: number) => FourAPI_del('2', id),
  // 藏品登记
  DJ: (id: number) => FourAPI_del('3', id),
  // 藏品编辑
  BJ: C6_APIdel,
  // 藏品删除
  SC: (id: number) => FourAPI_del('4', id),
  // 藏品入库
  RK: D4_APIdel,
  // 藏品移库
  // YK: ,
  // 藏品出库
  CK: D2_APIdel,
  // 藏品注销
  ZX: D8_APIdel,
  // 藏品盘点
  // PD: ,
  // 人员出入库
  // CR: ,
  // 事故登记
  SG: E1_APIdel,
  // 残损登记
  CS: E2_APIdel,
  // 现状登记
  XZ: E3_APIdel,
  // 文物修复
  XF: E4_APIdel
  // 展览申请
  // ZL: ,
  // 藏品总登记号
  // ZDJ:
}
