import request from '@/config/axios'
import type { TableData } from './types'

/** 获取列表数据 */
export const getTableListApi = (params: any) => {
  // return request.get({ url: '/datadetail/list', params })
  const data = [
    {
      modelId: 'IN_JS101_JRJGFZ',
      reportCode: 'IN_JS101_JRJGFZ',
      reportName: '金融机构(分支机构)基础信息(补录)',
      typeName: '机构信息(补录)'
    },
    {
      modelId: 'IN_JS102_FTTYCKK',
      reportCode: 'IN_JS102_FTTYCKK',
      reportName: '非同业单位存款客户基础信息(补录)',
      typeName: '单位存款(补录)'
    },
    {
      modelId: 'IN_JS102_FTYKHX',
      reportCode: 'IN_JS102_FTYKHX',
      reportName: '非同业单位客户基础信息(补录)',
      typeName: '同业业务(补录)'
    },
    {
      modelId: 'IN_JS102_XDQYXX',
      reportCode: 'IN_JS102_XDQYXX',
      reportName: '信贷企业基础信息(补录)',
      typeName: '单位贷款(补录)'
    },
    {
      modelId: 'IN_JS102_TYKHXX',
      reportCode: 'IN_JS102_TYKHXX',
      reportName: '同业客户基础信息(补录)',
      typeName: '同业业务(补录)'
    },
    {
      modelId: 'IN_JS102_CLDWDK',
      reportCode: 'IN_JS102_CLDWDK',
      reportName: '存量单位贷款信息(补录)',
      typeName: '单位贷款(补录)'
    },
    {
      modelId: 'IN_JS101_CLGRDK',
      reportCode: 'IN_JS101_CLGRDK',
      reportName: '存量个人贷款信息(补录)',
      typeName: '个人贷款(补录)'
    },
    {
      modelId: 'IN_JS201_CLPJRZ',
      reportCode: 'IN_JS201_CLPJRZ',
      reportName: '存量票据融资信息(补录)',
      typeName: '票据数据(补录)'
    },
    {
      modelId: 'IN_JS201_CLTYJD',
      reportCode: 'IN_JS201_CLTYJD',
      reportName: '存量同业借款信息(补录)',
      typeName: '同业业务(补录)'
    }
  ]
  // list: [
  //   {
  //     modelId: 'IN_EAST_1',
  //     reportName: '表内外业务担保合同表',
  //     typeName: '表内外担类',
  //     reportType: '006',
  //     rtypesText: 'EAST补录',
  //     rtypes: '006'
  //   }
  // ],
  return {
    data: {
      list: data,
      total: data.length
    }
  }
}

export const getTreeTableListApi = (params: any) => {
  return request.get({ url: '/example/treeList', params })
}

export const saveTableApi = (data: Partial<TableData>): Promise<IResponse> => {
  return request.post({ url: '/example/save', data })
}

export const getTableDetApi = (id: string): Promise<IResponse<TableData>> => {
  return request.get({ url: '/example/detail', params: { id } })
}

export const delTableListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.post({ url: '/example/delete', data: { ids } })
}
