import { PageInputPumpGetPageInput, PumpGetPageOutput, PumpAddInput, PumpUpdateInput } from './data-contracts'
import { RequestParams } from './http-client'
import { ContentType, HttpClient } from './http-client'

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

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

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

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

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