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

function getOceanusTreeApi(data) {
    return getReq('/oceanus/api/v1/categories', data);
}
function addOceanusTreeApi(data) {
    return postReq('/oceanus/api/v1/categories', data);
}
function updateOceanusTreeApi(data) {
    return putReq('/oceanus/api/v1/categories', data);
}
function delOceanusTreeApi(data) {
    return putReq(`/oceanus/api/v1/categories/${data.categoryId}`, data);
}
function addAttributesApi(data) {
    return postReq('/oceanus/api/v1/categories/attributes', data);
}
function updateAttributesApi(data) {
    return putReq('/oceanus/api/v1/categories/attributes', data);
}
function movementAttributesApi(data) {
    return putReq('/oceanus/api/v1/categories/attributes/movement', data);
}

function getEquipmentsTreeApi(data) {
    return getReq(`/oceanus/api/v1/equipments/catalogs/${data.catalogId}`);
}
function addEquipmentsTreeApi(data) {
    return postReq(`/oceanus/api/v1/equipments/catalogs`, data);
}

function updateEquipmentsTreeApi(data) {
    return putReq(`/oceanus/api/v1/equipments/catalogs`, data);
}
function delEquipmentsTreeApi(data) {
    return delReq(`/oceanus/api/v1/equipments/catalogs`, {}, { data });
}

function getEquipmentsInfoApi(data) {
    return getReq(`/oceanus/api/v1/equipments/${data.catalogValue}`);
}

export default {
    getOceanusTree: getOceanusTreeApi,
    addOceanusTree: addOceanusTreeApi,
    updateOceanusTree: updateOceanusTreeApi,
    delOceanusTree: delOceanusTreeApi,
    addAttributes: addAttributesApi,
    updateAttributes: updateAttributesApi,
    movementAttributes: movementAttributesApi,
    getEquipmentsTree: getEquipmentsTreeApi,
    addEquipmentsTree: addEquipmentsTreeApi,
    updateEquipmentsTree: updateEquipmentsTreeApi,
    delEquipmentsTree: delEquipmentsTreeApi,
    getEquipmentsInfo: getEquipmentsInfoApi,
};
