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 delReq(`/oceanus/api/v1/categories/${data.categoryId}`, data);
}

function getAttributesApi(data) {
    return getReq('/oceanus/api/v1/categories/attributes', 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}`);
}
function getEquipmentsAttributesApi(data) {
    return getReq('/oceanus/api/v1/equipments/attributes', data);
}

function addEquipmentsAttributesApi(data) {
    return postReq('/oceanus/api/v1/equipments/attributes', data);
}

function updateEquipmentsAttributesApi(data) {
    return putReq('/oceanus/api/v1/equipments/attributes', data);
}
function topEquipmentsAttributesApi(data) {
    return putReq(`/oceanus/api/v1/equipments/attributes/top/${data.instanceId}`, {});
}
function bottomEquipmentsAttributesApi(data) {
    return putReq(`/oceanus/api/v1/equipments/attributes/bottom/${data.instanceId}`, {});
}
function getEquipmentsEventsApi(data) {
    return getReq('/oceanus/api/v1/equipments/events', data);
}
function addEquipmentsEventsApi(data) {
    return postReq('/oceanus/api/v1/equipments/events', data);
}
function updateEquipmentsEventsApi(data) {
    return putReq('/oceanus/api/v1/equipments/events', data);
}

export default {
    getOceanusTree: getOceanusTreeApi,
    addOceanusTree: addOceanusTreeApi,
    updateOceanusTree: updateOceanusTreeApi,
    delOceanusTree: delOceanusTreeApi,
    getAttributes: getAttributesApi,
    addAttributes: addAttributesApi,
    updateAttributes: updateAttributesApi,
    movementAttributes: movementAttributesApi,
    getEquipmentsTree: getEquipmentsTreeApi,
    addEquipmentsTree: addEquipmentsTreeApi,
    updateEquipmentsTree: updateEquipmentsTreeApi,
    delEquipmentsTree: delEquipmentsTreeApi,
    getEquipmentsInfo: getEquipmentsInfoApi,
    getEquipmentsAttributes: getEquipmentsAttributesApi,
    addEquipmentsAttributes: addEquipmentsAttributesApi,
    updateEquipmentsAttributes: updateEquipmentsAttributesApi,
    topEquipmentsAttributes: topEquipmentsAttributesApi,
    bottomEquipmentsAttributes: bottomEquipmentsAttributesApi,
    getEquipmentsEvents: getEquipmentsEventsApi,
    addEquipmentsEvents: addEquipmentsEventsApi,
    updateEquipmentsEvents: updateEquipmentsEventsApi,
};
