import { AbstractService, extendServiceContainer } from '@iotize/tap';
import { TapRequestFrame } from '@iotize/tap/client/api';
import { createEnumConverter, createEnumArrayConverter, converters } from '@iotize/tap/service/core';

/* tslint:disable */
/**
 * This file was automatically generated by json-schema-to-typescript.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and run json-schema-to-typescript to regenerate this file.
 */
var AvailablePowerSource;
(function (AvailablePowerSource) {
    AvailablePowerSource[AvailablePowerSource["DC_POWER"] = 1] = "DC_POWER";
    AvailablePowerSource[AvailablePowerSource["S3P"] = 16] = "S3P";
    AvailablePowerSource[AvailablePowerSource["AC_EXTERNAL_POWER"] = 32] = "AC_EXTERNAL_POWER";
})(AvailablePowerSource || (AvailablePowerSource = {}));

/**
 *   Generated file. Do not edit
 */
const availablePowerSource = createEnumConverter(AvailablePowerSource, 1);
const availablePowerSourceArray = createEnumArrayConverter(AvailablePowerSource, 1);

var serviceConverters = /*#__PURE__*/Object.freeze({
    __proto__: null,
    availablePowerSource: availablePowerSource,
    availablePowerSourceArray: availablePowerSourceArray
});

/**
 *   Generated file. Do not edit
 */
const allConverters = Object.assign(Object.assign({}, converters), serviceConverters);
const SERVICE_CALLS = {
    getManufacturer: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/device/manufacturer',
        path: '/3//0',
        responseBodyDecoder: allConverters.ascii,
    },
    getFirmwareFlavor: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/device/firmware-flavor',
        path: '/3//1',
        responseBodyDecoder: allConverters.ascii,
    },
    getSerialNumber: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/device/serial-number',
        path: '/3//2',
        responseBodyDecoder: allConverters.ascii,
    },
    getFirmwareVersion: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/device/firmware-version',
        path: '/3//3',
        responseBodyDecoder: allConverters.ascii,
    },
    reboot: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/device/reboot',
        path: '/3//4',
    },
    factoryReset: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/device/factory-reset',
        path: '/3//5',
    },
    getAvailablePowerSource: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/device/available-power-source',
        path: '/3//6',
        responseBodyDecoder: allConverters.availablePowerSource,
    },
    getPowerSourceVoltage: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/device/power-source-voltage',
        path: '/3//7',
        responseBodyDecoder: allConverters.uint32,
    },
    getMemoryFree: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/device/memory-free',
        path: '/3//10',
        responseBodyDecoder: allConverters.uint32,
    },
    getLastErrorCode: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/device/last-error-code',
        path: '/3//11',
        responseBodyDecoder: allConverters.uint32,
    },
    postLastErrorCode: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/device/last-error-code',
        path: '/3//11',
    },
    resetLastErrorCode: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/device/reset-last-error-code',
        path: '/3//12',
    },
    getCurrentTime: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/device/current-time',
        path: '/3//13',
        responseBodyDecoder: allConverters.ascii,
    },
    putCurrentTime: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/device/current-time',
        path: '/3//13',
        bodyEncoder: allConverters.uint32,
    },
};

class DeviceService extends AbstractService {
    constructor() {
        super(...arguments);
        this.resources = SERVICE_CALLS;
    }
    /**
     * Get manufacturer name
     *
     * LWM2M path: /3//0
     *
     * @tapVersion(">=")
     * @return
     */
    getManufacturer() {
        return this.serviceCallRunner.execute(this.getManufacturerCall());
    }
    /**
     *
     *
     * LWM2M path: /3//0
     *
     * @tapVersion(">=")
     * @return call options
     */
    getManufacturerCall() {
        const callOptions = Object.assign({}, this.resources.getManufacturer);
        return callOptions;
    }
    /**
     * Get device firmware flavor name
     *
     * LWM2M path: /3//1
     *
     * @tapVersion(">=")
     * @return
     */
    getFirmwareFlavor() {
        return this.serviceCallRunner.execute(this.getFirmwareFlavorCall());
    }
    /**
     *
     *
     * LWM2M path: /3//1
     *
     * @tapVersion(">=")
     * @return call options
     */
    getFirmwareFlavorCall() {
        const callOptions = Object.assign({}, this.resources.getFirmwareFlavor);
        return callOptions;
    }
    /**
     * Get device serial number
     *
     * LWM2M path: /3//2
     *
     * @tapVersion(">=")
     * @return
     */
    getSerialNumber() {
        return this.serviceCallRunner.execute(this.getSerialNumberCall());
    }
    /**
     *
     *
     * LWM2M path: /3//2
     *
     * @tapVersion(">=")
     * @return call options
     */
    getSerialNumberCall() {
        const callOptions = Object.assign({}, this.resources.getSerialNumber);
        return callOptions;
    }
    /**
     * Get device firmware version
     *
     * LWM2M path: /3//3
     *
     * @tapVersion(">=")
     * @return
     */
    getFirmwareVersion() {
        return this.serviceCallRunner.execute(this.getFirmwareVersionCall());
    }
    /**
     *
     *
     * LWM2M path: /3//3
     *
     * @tapVersion(">=")
     * @return call options
     */
    getFirmwareVersionCall() {
        const callOptions = Object.assign({}, this.resources.getFirmwareVersion);
        return callOptions;
    }
    /**
     * Reboot device
     *
     * LWM2M path: /3//4
     *
     * @tapVersion(">=")
     * @return
     */
    reboot() {
        return this.serviceCallRunner.execute(this.rebootCall());
    }
    /**
     *
     *
     * LWM2M path: /3//4
     *
     * @tapVersion(">=")
     * @return call options
     */
    rebootCall() {
        const callOptions = Object.assign({}, this.resources.reboot);
        return callOptions;
    }
    /**
     * Factory reset
     *
     * LWM2M path: /3//5
     *
     * @tapVersion(">=")
     * @return
     */
    factoryReset() {
        return this.serviceCallRunner.execute(this.factoryResetCall());
    }
    /**
     *
     *
     * LWM2M path: /3//5
     *
     * @tapVersion(">=")
     * @return call options
     */
    factoryResetCall() {
        const callOptions = Object.assign({}, this.resources.factoryReset);
        return callOptions;
    }
    /**
     * Get available power sources
     *
     * LWM2M path: /3//6
     *
     * @tapVersion(">=")
     * @return
     */
    getAvailablePowerSource() {
        return this.serviceCallRunner.execute(this.getAvailablePowerSourceCall());
    }
    /**
     *
     *
     * LWM2M path: /3//6
     *
     * @tapVersion(">=")
     * @return call options
     */
    getAvailablePowerSourceCall() {
        const callOptions = Object.assign({}, this.resources.getAvailablePowerSource);
        return callOptions;
    }
    /**
     * Get power source voltage
     *
     * LWM2M path: /3//7
     *
     * @tapVersion(">=")
     * @return
     */
    getPowerSourceVoltage() {
        return this.serviceCallRunner.execute(this.getPowerSourceVoltageCall());
    }
    /**
     *
     *
     * LWM2M path: /3//7
     *
     * @tapVersion(">=")
     * @return call options
     */
    getPowerSourceVoltageCall() {
        const callOptions = Object.assign({}, this.resources.getPowerSourceVoltage);
        return callOptions;
    }
    /**
     * Get device memory free
     *
     * LWM2M path: /3//10
     *
     * @tapVersion(">=")
     * @return
     */
    getMemoryFree() {
        return this.serviceCallRunner.execute(this.getMemoryFreeCall());
    }
    /**
     *
     *
     * LWM2M path: /3//10
     *
     * @tapVersion(">=")
     * @return call options
     */
    getMemoryFreeCall() {
        const callOptions = Object.assign({}, this.resources.getMemoryFree);
        return callOptions;
    }
    /**
     * Get device last error code
     *
     * LWM2M path: /3//11
     *
     * @tapVersion(">=")
     * @return
     */
    getLastErrorCode() {
        return this.serviceCallRunner.execute(this.getLastErrorCodeCall());
    }
    /**
     *
     *
     * LWM2M path: /3//11
     *
     * @tapVersion(">=")
     * @return call options
     */
    getLastErrorCodeCall() {
        const callOptions = Object.assign({}, this.resources.getLastErrorCode);
        return callOptions;
    }
    /**
     * ???
     *
     * LWM2M path: /3//11
     *
     * @tapVersion(">=")
     * @return
     */
    postLastErrorCode() {
        return this.serviceCallRunner.execute(this.postLastErrorCodeCall());
    }
    /**
     *
     *
     * LWM2M path: /3//11
     *
     * @tapVersion(">=")
     * @return call options
     */
    postLastErrorCodeCall() {
        const callOptions = Object.assign({}, this.resources.postLastErrorCode);
        return callOptions;
    }
    /**
     * Reset device last error code
     *
     * LWM2M path: /3//12
     *
     * @tapVersion(">=")
     * @return
     */
    resetLastErrorCode() {
        return this.serviceCallRunner.execute(this.resetLastErrorCodeCall());
    }
    /**
     *
     *
     * LWM2M path: /3//12
     *
     * @tapVersion(">=")
     * @return call options
     */
    resetLastErrorCodeCall() {
        const callOptions = Object.assign({}, this.resources.resetLastErrorCode);
        return callOptions;
    }
    /**
     * Get device current time
     *
     * LWM2M path: /3//13
     *
     * @tapVersion(">=")
     * @return
     */
    getCurrentTime() {
        return this.serviceCallRunner.execute(this.getCurrentTimeCall());
    }
    /**
     *
     *
     * LWM2M path: /3//13
     *
     * @tapVersion(">=")
     * @return call options
     */
    getCurrentTimeCall() {
        const callOptions = Object.assign({}, this.resources.getCurrentTime);
        return callOptions;
    }
    /**
     * Set device current time
     *
     * LWM2M path: /3//13
     *
     * @tapVersion(">=")
     * @param time input
     * @return
     */
    putCurrentTime(
    /*
     *
     */
    time) {
        return this.serviceCallRunner.execute(this.putCurrentTimeCall(time));
    }
    /**
     *
     *
     * LWM2M path: /3//13
     *
     * @tapVersion(">=")
     * @param time input
     * @return call options
     */
    putCurrentTimeCall(
    /*
     *
     */
    time) {
        const callOptions = Object.assign({}, this.resources.putCurrentTime);
        callOptions.body = time;
        return callOptions;
    }
}

const _TAP_SERVICE_EXTENSION_DEVICE_ = extendServiceContainer('device', DeviceService);

/**
 *   Generated file. Do not edit
 */

/**
 *   Generated file. Do not edit
 */

// import './lib/custom/extension';

/**
 * Generated bundle index. Do not edit.
 */

export { AvailablePowerSource, SERVICE_CALLS as DEVICE_SERVICE_CALLS, DeviceService, _TAP_SERVICE_EXTENSION_DEVICE_, serviceConverters as deviceConverters };
//# sourceMappingURL=iotize-tap-service-impl-device.js.map
