import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FlfAuditVO, FlfAuditQuery } from './types';

/**
 * 查询审核记录列表
 */
export const listAudit = (query?: FlfAuditQuery): AxiosPromise<FlfAuditVO[]> => {
  return request({
    url: '/fulfiller/audit/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询审核记录详细
 */
export const getAudit = (id: string | number): AxiosPromise<FlfAuditVO> => {
  return request({
    url: '/fulfiller/audit/' + id,
    method: 'get'
  });
};

/**
 * 查询待审核数量
 */
export const getPendingCount = (): AxiosPromise<number> => {
  return request({
    url: '/fulfiller/audit/pendingCount',
    method: 'get'
  });
};

/**
 * 审核通过
 */
export const passAudit = (id: string | number) => {
  return request({
    url: '/fulfiller/audit/pass/' + id,
    method: 'put'
  });
};

/**
 * 审核驳回
 */
export const rejectAudit = (id: string | number, rejectReason: string) => {
  return request({
    url: '/fulfiller/audit/reject/' + id,
    method: 'put',
    params: { rejectReason }
  });
};
