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

export interface ManualExceptionQuery {
  pageNo?: number;
  pageSize?: number;
  current?: number;
  size?: number;
  exceptionCategory?: string;
  exceptionDescription?: string;
  exceptionLevel?: string;
  exceptionType?: string;
  status?: string;
  [key: string]: any;
}

export interface ManualExceptionVO {
  exceptionId?: number;
  exceptionCategory: string;
  exceptionDescription?: string;
  exceptionLevel: string;
  exceptionLevelName?: string;
  exceptionType: string;
  exceptionTypeName?: string;
  raiseTime?: string;
  raiser?: string;
  raiserName?: string;
  sourceId?: string;
  sourceName?: string;
  handleTime?: string;
  status: string;
  [key: string]: any;
}

export const materialManualExceptionApi = {
  listManualException: (params: ManualExceptionQuery) =>
    axiosInstance.get('/iscs/exception/getExceptionPage', { params }),
  getExceptionInfo: (id: number) =>
    axiosInstance.get('/iscs/exception/selectExceptionById', { params: { id } }),
  addException: (data: ManualExceptionVO) =>
    axiosInstance.post('/iscs/exception/insertIsException', data),
  updateException: (data: ManualExceptionVO) =>
    axiosInstance.post('/iscs/exception/updateIsException', data),
  deleteException: (id: number) =>
    axiosInstance.post('/iscs/exception/deleteIsExceptionByExceptionIds', null, {
      params: { exceptionIds: id },
    }),
};
