// groupRepository.ts

// @ts-ignore
import Repository from './Repository';

const virtualCommandResource = '/virtual_command';

import {dictEmptyValToNull} from '@/utils';

export default {

    getVirtualCommands() {
        return Repository.get(`${virtualCommandResource}`);
    },

    getVirtualCommand(virtualCommandId: number) {
        return Repository.get(`${virtualCommandResource}/${virtualCommandId}`);
    },

    deleteVirtualCommand(virtualCommandId: number) {
        return Repository.delete(`${virtualCommandResource}/${virtualCommandId}`);
    },

    createVirtualCommand(virtualCommandData: any) {
        return Repository.post(`${virtualCommandResource}`, dictEmptyValToNull(virtualCommandData));
    },

    updateVirtualCommand(virtualCommandId: number, virtualCommandData: any) {
        return Repository.put(`${virtualCommandResource}/${virtualCommandId}`,
            dictEmptyValToNull(virtualCommandData));
    },
};
