import axiosInstance from '../../utils/axios';

export interface LoanQuery {
  pageNo?: number;
  pageSize?: number;
  current?: number;
  size?: number;
  /** 物资柜（与旧版 coll 一致：loanFromId；部分环境亦认 cabinetId） */
  loanFromId?: number;
  cabinetId?: number;
  materialsName?: string;
  materialsTypeId?: number;
  loanUserName?: string;
  loanUserId?: string;
  loanTimeStart?: string;
  loanTimeEnd?: string;
  restitutionUserName?: string;
  restitutionTimeStart?: string;
  restitutionTimeEnd?: string;
  /** 领取记录状态（旧版字典字符串，如「超时未还」传 '2'） */
  status?: string;
  loanState?: number;
  startTime?: Date | string;
  endTime?: Date | string;
  [key: string]: any;
}

export interface LoanVO {
  materialsLoanId?: number;
  materialsId: number;
  materialsName?: string;
  loanUserId?: string;
  loanUserName?: string;
  loanState?: number;
  loanTime?: Date | string;
  expectedReturnTime?: Date | string;
  actualReturnTime?: Date | string;
  remark?: string;
  [key: string]: any;
}

export const materialLoanApi = {
  listLoan: (params: LoanQuery) =>
    axiosInstance.get('/iscs/materials-loan/getMaterialsLoanPage', { params }),
};
