import { RequestParams } from './http-client'
import { ContentType, HttpClient } from './http-client'
import type {
  PreBatchDto,
  PreBatchPageInput,
  PreBatchPageResponse,
  PreBatchOutput,
  PreBatchAddInput,
  PreBatchUpdateInput
} from '/@/api/types/preBatchType'

export class PreBatchApi extends HttpClient {
  /**
   * 获取分页列表
   */
  getPage = (data: PreBatchPageInput, params: RequestParams = {}) =>
    this.request<PreBatchPageResponse>({
      path: `/api/admin/pre-batch/get-page`,
      method: 'POST',
      body: data,
      type: ContentType.Json,
      ...params,
    })

  /**
   * 获取单条数据
   */
  get = (params: { id: number }, requestParams: RequestParams = {}) =>
    this.request<PreBatchOutput>({
      path: `/api/admin/pre-batch/get`,
      method: 'GET',
      query: { id: params.id },
      ...requestParams,
    })

  /**
   * 新增
   */
  add = (data: PreBatchAddInput, params: RequestParams = {}) =>
    this.request<any>({
      path: `/api/admin/pre-batch/add`,
      method: 'POST',
      body: data,
      type: ContentType.Json,
      ...params,
    })

  /**
   * 更新
   */
  update = (data: PreBatchUpdateInput, params: RequestParams = {}) =>
    this.request<any>({
      path: `/api/admin/pre-batch/update`,
      method: 'PUT',
      body: data,
      type: ContentType.Json,
      ...params,
    })

  /**
   * 软删除
   */
  softDelete = (params: { id: number }, requestParams: RequestParams = {}) =>
    this.request<any>({
      path: `/api/admin/pre-batch/soft-delete`,
      method: 'DELETE',
      query: params,
      ...requestParams,
    })
} 