import request from "@/utils/request";

class BatteryAPI {
  static queryPage(data: PageParams) {
    return request<any, PageResult<BatteryDTO[]>>({
      url: `/api/v1/batteryInquiry/findPage`,
      method: "get",
      params: data,
    });
  }

  static updateById(data: BatteryDTO) {
    return request({
      url: `/api/v1/batteryInquiry/updateById`,
      method: "post",
      data: data,
    });
  }

  static queryRegis(data: PageParams) {
    return request<any, PageResult<BatteryDTO[]>>({
      url: `/api/v1/batteryRegistration/findPage`,
      method: "get",
      params: data,
    });
  }

  static updateRegisById(data: BatteryDTO) {
    return request({
      url: `/api/v1/batteryRegistration/updateById`,
      method: "post",
      data: data,
    });
  }
}

export default BatteryAPI;

export interface PageParams {
  inquiryNo?: string;
  contactInfo?: string;
  status?: number; // 1=已联系 0=待联系
  startTime?: string | null;
  endTime?: string | null;
  pageSize?: number;
  pageNum?: number;
  range?: string[];
  name?: string;
}

export interface BatteryDTO {
  id?: number;
  status?: number; // 1=已联系 0=待联系
  remarks?: string;
}
