// groupRepository.ts

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

const recorderResource = '/recorder';
const recorderModelResource = '/recorder/model';
const recorderCommandResource = '/recorder/command';

import {dictEmptyValToNull} from '@/utils';

export default {
    getRecorders() {
        return Repository.get(`${recorderResource}`);
    },

    getRecorder(recorderId: number) {
        return Repository.get(`${recorderResource}/${recorderId}`);
    },

    deleteRecorder(recorderId: number) {
        return Repository.delete(`${recorderResource}/${recorderId}`);
    },

    createRecorder(recorderData: any) {
        return Repository.post(`${recorderResource}`, dictEmptyValToNull(recorderData));
    },

    updateRecorder(recorderId: number, recorderData: any) {
        return Repository.put(`${recorderResource}/${recorderId}`, dictEmptyValToNull(recorderData));
    },


    getRecorderModels() {
        return Repository.get(`${recorderModelResource}`);
    },

    getRecorderModel(recorderModelId: number) {
        return Repository.get(`${recorderModelResource}/${recorderModelId}`);
    },

    deleteRecorderModel(recorderModelId: number) {
        return Repository.delete(`${recorderModelResource}/${recorderModelId}`);
    },

    createRecorderModel(recorderModelData: any) {
        return Repository.post(`${recorderModelResource}`, dictEmptyValToNull(recorderModelData));
    },

    updateRecorderModel(recorderModelId: number, recorderModelData: any) {
        return Repository.put(`${recorderModelResource}/${recorderModelId}`, dictEmptyValToNull(recorderModelData));
    },


    getRecorderCommands() {
        return Repository.get(`${recorderCommandResource}`);
    },

    getRecorderCommand(recorderCommandId: number) {
        return Repository.get(`${recorderCommandResource}/${recorderCommandId}`);
    },

    deleteRecorderCommand(recorderCommandId: number) {
        return Repository.delete(`${recorderCommandResource}/${recorderCommandId}`);
    },

    createRecorderCommand(recorderCommandData: any) {
        return Repository.post(`${recorderCommandResource}`, dictEmptyValToNull(recorderCommandData));
    },

    updateRecorderCommand(recorderCommandId: number, recorderCommandData: any) {
        return Repository.put(`${recorderCommandResource}/${recorderCommandId}`,
            dictEmptyValToNull(recorderCommandData));
    },
};
