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

export interface TypeQuery {
  pageNo?: number;
  pageSize?: number;
  current?: number;
  size?: number;
  materialsTypeName?: string;
  typeName?: string;
  typeCode?: string;
  status?: number;
  [key: string]: any;
}

export interface TypeVO {
  materialsTypeId?: number;
  id?: number;
  typeName?: string;
  typeCode?: string;
  typeIcon?: string;
  typePicture?: string;
  materialsTypeName?: string;
  materialsTypeIcon?: string;
  materialsTypePicture?: string;
  parentId?: number;
  propertyIds?: string;
  checkStandard?: string;
  remark?: string;
  status?: number | string;
  [key: string]: any;
}

export const materialTypeApi = {
  listType: (params: TypeQuery) =>
    axiosInstance.get('/iscs/materials-type/getMaterialsTypePage', { params }),
  getTypeInfo: (id: number) =>
    axiosInstance.get('/iscs/materials-type/selectMaterialsTypeById', { params: { id } }),
  addType: (data: TypeVO) => axiosInstance.post('/iscs/materials-type/insertMaterialsType', data),
  updateType: (data: TypeVO) => axiosInstance.put('/iscs/materials-type/updateMaterialsType', data),
  deleteType: (ids: number) =>
    axiosInstance.delete('/iscs/materials-type/deleteMaterialsTypeList', { params: { ids } }),
};
