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

export interface PropertyValueQuery {
  pageNo?: number;
  pageSize?: number;
  current?: number;
  size?: number;
  propertyId?: number;
  /** 物资规格种类名称（与老系统查询条件一致） */
  propertyName?: string;
  propertyValue?: string;
  /** 物资规格筛选；可与 propertyName 同时传，空字符串表示不按规格值过滤 */
  valueName?: string;
  status?: number;
  [key: string]: any;
}

export interface PropertyValueVO {
  recordId?: number;
  propertyId: number;
  propertyName?: string;
  propertyValue: string;
  valueName?: string;
  propertyUnit?: string;
  status?: number;
  remark?: string;
  [key: string]: any;
}

export const materialPropertyValueApi = {
  PropertyValuePage: (params: PropertyValueQuery) =>
    axiosInstance.get('/iscs/materials-property-value/getMaterialsPropertyValuePage', { params }),
  selectPropertyValueById: (id: number) =>
    axiosInstance.get('/iscs/materials-property-value/selectMaterialsPropertyValueById', {
      params: { id },
    }),
  addPropertyValue: (data: PropertyValueVO) =>
    axiosInstance.post('/iscs/materials-property-value/insertMaterialsPropertyValue', data),
  updatePropertyValue: (data: PropertyValueVO) =>
    axiosInstance.put('/iscs/materials-property-value/updateMaterialsPropertyValue', data),
  deletePropertyValue: (ids: number) =>
    axiosInstance.delete('/iscs/materials-property-value/deleteMaterialsPropertyValueList', {
      params: { ids },
    }),
};
