import { SendRequest } from '../components/Global/ApiRequest';

const getAllApd = async (queryParams) => {
    const response = await SendRequest({
        method: 'get',
        prefix: `apd?${queryParams.toString()}`,
    });
    return response;
};

const createApd = async (queryParams) => {
    const response = await SendRequest({
        method: 'post',
        prefix: `apd`,
        params: queryParams,
    });
    return response.data;
};

const updateApd = async (vendor_id, queryParams) => {
    const response = await SendRequest({
        method: 'put',
        prefix: `apd/${vendor_id}`,
        params: queryParams,
    });
    return response.data;
};

const deleteApd = async (queryParams) => {
    const response = await SendRequest({
        method: 'delete',
        prefix: `apd/${queryParams}`,
    });
    return response.data;
};

const getJenisPermit = async () => {
    const response = await SendRequest({
        method: 'get',
        prefix: `apd/jenis-permit`,
    });
    return response.data;
};

export { getAllApd, createApd, updateApd, deleteApd, getJenisPermit };
