import { delReq, getReq, postReq, putReq } from '@/utils';

function getJobsApi(data) {
    return getReq('/api/v1/jobs', data);
}

function addJobsApi(data) {
    return postReq('/api/v1/jobs', data);
}

function updateJobsApi(data) {
    return putReq('/api/v1/jobs', data);
}

function getOrganizationListApi(data) {
    return getReq('/api/v1/organizations', data);
}

function getOrganizationDetailsApi(id) {
    return getReq(`/api/v1/organizations/${id}`);
}

function addOrgApi(data) {
    return postReq('/api/v1/organizations', data);
}

function updateOrgApi(data) {
    return putReq('/api/v1/organizations', data);
}

function addBusinessApi(data) {
    return postReq('/api/v1/parameters/business', data);
}

function updateBusinessApi(data) {
    return putReq('/api/v1/parameters/business', data);
}

function addOperationApi(data) {
    return postReq('/api/v1/parameters/operation', data);
}

function updateOperationApi(data) {
    return putReq('/api/v1/parameters/operation', data);
}

function getRolesApi(data) {
    return getReq('/api/v1/roles', data);
}
function getUsersInfoApi({ userId }) {
    return getReq(`/api/v1/users/${userId}`);
}

export const addUserApi = data => postReq('/api/v1/users', data);

export const updateUserApi = data => putReq('/api/v1/users', data);

export default {
    addJobs: addJobsApi,
    updateJobs: updateJobsApi,
    getOrganizationList: getOrganizationListApi,
    getJobs: getJobsApi,
    getOrganizationDetails: getOrganizationDetailsApi,
    addOrg: addOrgApi,
    updateOrg: updateOrgApi,
    addBusiness: addBusinessApi,
    updateBusiness: updateBusinessApi,
    addOperation: addOperationApi,
    updateOperation: updateOperationApi,
    getRoles: getRolesApi,
    getUsersInfo: getUsersInfoApi,
    addUser: addUserApi,
    updateUser: updateUserApi,
};
