const URL = "/one-api/mockup/masterdata/accounting/Ruangan";

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

export async function searchRuangan(param) {
    return request("/lookupRuangan", param);
}

export async function insertRuangan(param) {
    return request("/insertRuangan", param);
}

export async function updateRuangan(param) {
    return request("/updateRuangan", param);
}

export async function deleteRuangan(param) {
    return request("/deleteRuangan", param);
}

export async function listingCabang(param) {
    return request("/listingCabang", param);
}

export async function listingRegional(param) {
    return request("/listingRegional", param);
}
