import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StatusHistoryVO, StatusHistoryForm, StatusHistoryQuery } from '@/api/amz/statusHistory/types';

/**
 * 查询状态历史列表
 * @param query
 * @returns {*}
 */

export const listStatusHistory = (query?: StatusHistoryQuery): AxiosPromise<StatusHistoryVO[]> => {
  return request({
    url: '/amz/statusHistory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询状态历史详细
 * @param historyId
 */
export const getStatusHistory = (historyId: string | number): AxiosPromise<StatusHistoryVO> => {
  return request({
    url: '/amz/statusHistory/' + historyId,
    method: 'get'
  });
};

/**
 * 新增状态历史
 * @param data
 */
export const addStatusHistory = (data: StatusHistoryForm) => {
  return request({
    url: '/amz/statusHistory',
    method: 'post',
    data: data
  });
};

/**
 * 修改状态历史
 * @param data
 */
export const updateStatusHistory = (data: StatusHistoryForm) => {
  return request({
    url: '/amz/statusHistory',
    method: 'put',
    data: data
  });
};

/**
 * 删除状态历史
 * @param historyId
 */
export const delStatusHistory = (historyId: string | number | Array<string | number>) => {
  return request({
    url: '/amz/statusHistory/' + historyId,
    method: 'delete'
  });
};
