import { ReactorPageInput, ReactorPageResponse, ReactorOutput, ReactorAddInput, ReactorUpdateInput, ReactorTypeEnumListOutput, ReactorListResponse } from '/@/api/types/reactorType'
import { RequestParams } from './http-client'
import { ContentType, HttpClient } from './http-client'

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

  getList = (params: RequestParams = {}) =>
    this.request<ReactorListResponse>({
      path: `/api/admin/equ-reactor/get-list`,
      method: 'GET',
      ...params,
    })

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

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

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

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

  /**
   * 获取反应器类型枚举列表
   */
  getReactorTypeEnumList = (params: RequestParams = {}) =>
    this.request<ReactorTypeEnumListOutput>({
      path: `/api/admin/equ-reactor/get-reactor-type-enum-list`,
      method: 'GET',
      ...params,
    })

  /**
   * 获取设备状态枚举列表
   */
  getDeviceStatusEnumList = (params: RequestParams = {}) =>
    this.request<ReactorTypeEnumListOutput>({
      path: `/api/admin/equ-reactor/get-device-status-enum-list`,
      method: 'GET',
      ...params,
    })

}
