import request from '@/config/axios'

// 每月社保记录 VO
export interface InsuranceMonthRecordVO {
  iRecordId: number // 主键
  title: string // 报表名称
  year: number // 年份
  month: number // 月份
  num: number // 参保人数
  status: number // 每月社保状态 0 未归档 1 已归档
}

// 每月社保记录 API
export const InsuranceMonthRecordApi = {
  // 查询每月社保记录分页
  queryInsuranceRecordList: async (params: any) => {
    return await request.get({ url: `/hr/insurance-month-record/queryInsuranceRecordList`, params })
  },

  // 核算社保数据
  computeInsuranceData: async (date: string,companyId: number) => {
    return await request.post({ url: `/hr/insurance-month-record/computeInsuranceData?date=` + date + '&companyId=' + companyId})
  },
  // 查询每月社保记录分页
  getInsuranceMonthRecordPage: async (params: any) => {
    return await request.get({ url: `/hr/insurance-month-record/page`, params })
  },

  // 查询每月社保记录详情
  getInsuranceMonthRecord: async (id: number) => {
    return await request.get({ url: `/hr/insurance-month-record/get?id=` + id })
  },

  // 新增每月社保记录
  createInsuranceMonthRecord: async (data: InsuranceMonthRecordVO) => {
    return await request.post({ url: `/hr/insurance-month-record/create`, data })
  },

  // 修改每月社保记录
  updateInsuranceMonthRecord: async (data: InsuranceMonthRecordVO) => {
    return await request.put({ url: `/hr/insurance-month-record/update`, data })
  },

  // 删除每月社保记录
  deleteInsuranceMonthRecord: async (id: number) => {
    return await request.delete({ url: `/hr/insurance-month-record/delete?id=` + id })
  },

  stop: async (ids: String) => {
    return await request.post({ url: `/hr/insurance-month-emp-record/stop?ids=` + ids })
  },

  // 导出每月社保记录 Excel
  exportInsuranceMonthRecord: async (params) => {
    return await request.download({ url: `/hr/insurance-month-record/export-excel`, params })
  },
}
