import request from '@/config/axios'

// 倍数相关类型定义
export interface MultipleSettingVO {
  id?: number // 主键ID
  customerGroup: string // 客户组
  orderType: string // 订单类型
  createUser?: string // 创建人
  createTime?: string // 创建时间
  updateUser?: string // 修改人
  updateTime?: string // 修改时间
}

// 分页查询参数
export interface MultipleSettingPageParam {
  pageNo?: number
  pageSize?: number
  customerGroup?: string // 客户组
  orderType?: string // 订单类型
}

// 倍数分页查询
export const multipleSettingPage = (data: MultipleSettingPageParam) => {
  return request.post({ url: '/print/quantity-header/page', data })
}

// 创建倍数
export const createMultipleSetting = (data: MultipleSettingVO) => {
  return request.post({ url: '/print/quantity-header/create', data })
}

// 修改倍数
export const updateMultipleSetting = (data: MultipleSettingVO) => {
  return request.put({ url: '/print/quantity-header/update', data })
}
// 获取倍数详情
export const getMultipleSettingDetail = (id: number) => {
  return request.get({ url: '/print/quantity-header/get?id=' + id })
}
// 获取倍数详情列表
export const getMultipleSettingDetailList = (headerId: number) => {
  return request.get({ url: '/print/quantity-header/quantity-details/list-by-header-id?headerId=' + headerId })
}
// 删除倍数
export const deleteMultipleSetting = (id: number) => {
  return request.delete({ url: '/print/quantity-header/delete?id=' + id })
}

// 批量删除倍数
export const deleteMultipleSettingList = (ids: number[]) => {
  return request.delete({
    url: '/print/quantity-header/delete-list',
    params: { ids: ids.join(',') }
  })
}

// 导出倍数
export const exportMultipleSetting = (data: any) => {
  return request.downloadPost({ url: '/print/quantity-header/export-excel', data })
}

// 下载倍数导入模板
export const importMultipleSettingTemplate = () => {
  return request.download({ url: '/print/quantity-header/get-import-template' })
}

// 导入倍数
export const importMultipleSetting = (data: FormData) => {
  return request.post({
    url: '/print/quantity-header/import',
    data,
    headers: { 'Content-Type': 'multipart/form-data' }
  })
}

// 倍数操作日志分页查询
export const multipleSettingOperationLogPage = (data: any) => {
  return request.post({ url: '/print/quantity-operation-log/page', data })
}
