interface BasicListQuery {
  emergencyType?: string | null;
  supplyType?: string | null;
  supplyName?: string | null;
  keeperName?: string | null;
}

interface BasicResponse {
  id: number;
  emergencyType: string;
  supplyType: string;
  supplyName: string;
  remark: string;
  supplementQuantity: number;
  park: string;
}

export interface EmergencySupplyListQuery extends BasicListQuery {
  park?: string | null;
  location?: string | null;
  status?: number | null;
}

export interface InventoryCheckListQuery extends BasicListQuery {
  taskId?: number | null;
  inventoryResult?: number | null;
}

export interface EmergencySupplyListResponse extends BasicResponse {
  requiredQuantity: number;
  currentQuantity: number;
  unit: string;
  location: string;
  keeperName: string;
  expirationDate: string;
  status: number;
}

export interface InventoryCheckListResponse extends BasicResponse {
  beforeKeeperName: string;
  afterKeeperName: string;
  beforeQuantity: number;
  afterQuantity: number;
  beforeLocation: string;
  afterLocation: string;
  inventoryResult: number;
  imageList: string;
}

export interface InventoryTaskForm {
  taskName: string;
  endTime: string;
}

export interface ExportDiscardForm {
  discardTime: Date[];
}
export interface DiscardSuppliesForm {
  quantity: number | null;
}

export interface AddEmergencyItemForm
  extends Omit<
    EmergencySupplyListResponse,
    'id' | 'status' | 'supplementQuantity' | 'requiredQuantity' | 'currentQuantity'
  > {
  requiredQuantity: number | null;
  currentQuantity: number | null;
  keeperId: number | null;
}

export interface EmergencySupplyDetailResponse extends AddEmergencyItemForm {
  id: number | null;
  keeperName: string;
}

export interface EditEmergencyItemForm extends EmergencySupplyDetailResponse {
  emergencyTypeName: string;
  supplyTypeName: string;
}

export interface ViewEmergencyItemForm extends EditEmergencyItemForm {
  parkName: string;
  locationName: string;
}

export interface ChangeRecordListRes {
  id: number;
  changeType: number;
  detail: string;
  beforeQuantity: number;
  changeQuantity: number;
  afterQuantity: number;
  operatorName: string;
  updatedAt: string;
}

export interface InventoryTaskListRes {
  id: number;
  taskName: string;
  endTime: string; //任务截止时间
}

/**
 * 物资申领
 */
export interface SupplyRequestListQuery {
  planName?: string;
  status?: number;
}

export interface SupplyRequestListItem {
  /*自增主键 */
  id?: number;
  /*申领计划名称 */
  planName?: string;
  /*采购日期 */
  purchaseDate?: string;
  /*总价（元） */
  totalPrice?: number;
  /*状态：1-申请中 2-采购中 3-领用中 4-已领用 */
  status?: number;
  /*创建时间 */
  createdAt?: string;
  /*更新时间 */
  updatedAt?: string;
  /*0-未删除，大于0(时间戳)-已删除 */
  isDeleted?: number;
}

export interface SupplyRequestDetailInfo {
  /*自增主键 */
  id: number;
  /*申领计划id */
  planId: number;
  /*物资名称 */
  supplyName: string;
  /*规格 */
  specs: string;
  /*单价（元） */
  unitPrice: number;
  /*小计 */
  subtotal: string;
  /*创建时间 */
  createdAt: string;
  /*更新时间 */
  updatedAt: string;
  /*0-未删除，大于0(时间戳)-已删除 */
  isDeleted: number;
}

export interface SupplyRequestDetailList {
  /*自增主键 */
  id: number;
  /*申领信息ID */
  requestId: number;
  /*需求部门ID */
  deptId: number;
  /*需求部门名称 */
  deptName: string;
  /*数量 */
  quantity: number;
  /*尺寸明细 */
  sizeDetail: string;
  /*状态：1-申请中 2-采购中 3-领用中 4-已领用 */
  status: number;
  /*创建时间 */
  createdAt: string;
  /*更新时间 */
  updatedAt: string;
  /*0-未删除，大于0(时间戳)-已删除 */
  isDeleted: number;
}

export interface SupplyRequestDetailItem {
  info: SupplyRequestDetailInfo;
  detailList: SupplyRequestDetailList[];
}

export interface ReceiveSupplyRequestDetailForm {
  supplyId: number; // 应急物资ID
  quantity: number; // 领用数量
  detailId: number; // 需求物资ID
  planId: number; // 申领计划ID
}

// 添加需求物资单个部门表单
export type AddSupplyRequestSubForm = Pick<SupplyRequestDetailList, 'id'> &
  Partial<Omit<SupplyRequestDetailList, 'id'>>;
// 添加需求物资表单
export interface AddSupplyRequestForm {
  info: Partial<SupplyRequestDetailInfo>;
  detailList: AddSupplyRequestSubForm[];
}
// 添加需求物资接口查询参数
export interface AddSupplyQuery {
  info: Partial<SupplyRequestDetailInfo>;
  detailList: Partial<AddSupplyRequestSubForm>[];
}
