import { createCrudApi } from './common';
import request from '@/axios';

const baseUrl = '/blade-transport/temporary-credit-limit';
const api = createCrudApi(baseUrl);

export const getList = api.getList;
export const getDetail = api.getDetail;
export const submit = api.submit;
export const remove = api.remove;

export const saveDraft = row =>
  request({
    url: `${baseUrl}/save-draft`,
    method: 'post',
    data: row,
  });

export const submitApproval = id =>
  request({
    url: `${baseUrl}/submit-approval`,
    method: 'post',
    params: { id },
  });

export const approve = id =>
  request({
    url: `${baseUrl}/approve`,
    method: 'post',
    params: { id },
  });

export const reject = id =>
  request({
    url: `${baseUrl}/reject`,
    method: 'post',
    params: { id },
  });

export const withdraw = id =>
  request({
    url: `${baseUrl}/withdraw`,
    method: 'post',
    params: { id },
  });
