const URL = "/one-api/map/InventarisCoaMapping";

async function request(endpoint, params) {
    try {
        const resp = await axios.post(URL + endpoint, params)
        if (resp.status !== 200) {
            throw new Error(resp.statusText);
        }
        return resp.data;
    } catch (error) {
        return {
            status: "ERR",
            message: error.message
        }
    }
}

export async function getListCoa(params) {
    return request("/getListCoa", params);
}

export async function getListingInventarisGol(params) {
    return request("/getListInventarisGol", params);
}

export async function getListItemInventaris(params) {
    return request("/getListItemInventaris", params);
}

export async function getListInventorygolMapping(params) {
    return request("/getListInventorygolMapping", params);
}

export async function getInvCoaMappingDetail(params) {
    return request("/getInvCoaMappingDetail", params);
}

export async function createInvCoaMapping(params) {
    return request("/createInvCoaMapping", params);
}

export async function editInvCoaMapping(params) {
    return request("/editInvCoaMapping", params);
}

export async function deleteInvCoaMapping(params) {
    return request("/deleteInvCoaMapping", params);
}


/* item inventory */ 
export async function createInvItemCoaMapping(params) {
    return request("/createInvItemCoaMapping", params);
}

export async function editInvItemCoaMapping(params) {
    return request("/editInvItemCoaMapping", params);
}

export async function deleteInvItemCoaMapping(params) {
    return request("/deleteInvItemCoaMapping", params);
}