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

// JvmService.prototype.clearCode = function (
//     this: JvmService
// ): Promise<TapResponse<void>> {
//     return this.serviceCallRunner.execute(this.clearCodeCall());
// };
// JvmService.prototype.clearCodeCall = function (
//     this: JvmService
// ) {
//     return {
//         path: '/1024//74',
//         pathAlias: '/jvm/code',
//         method: TapRequestFrame.MethodType.PUT,
//         body: Uint8Array.from([0])
//     } as ServiceCallType<Uint8Array, void>;
// };

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

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

/**
 *   Generated file. Do not edit
 */
const allConverters = Object.assign(Object.assign({}, converters), serviceConverters);
const SERVICE_CALLS = {
    clearCode: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: "/jvm/code",
        path: "/1024//74"
    },
    appendCode: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: "/jvm/code",
        append: true,
        path: "/1024//74"
    },
    getProfileId: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: "/jvm/profile-id",
        path: "/1024//66",
        responseBodyDecoder: allConverters.uint16
    },
    putProfileId: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: "/jvm/profile-id",
        path: "/1024//66",
        bodyEncoder: allConverters.uint16
    }
};

class JvmService extends AbstractService {
    constructor() {
        super(...arguments);
        this.resources = SERVICE_CALLS;
    }
    /**
     * Clear code stored in Tap.
     *
     * LWM2M path: /1024//74
     *
     * @tapVersion(">=1.90")
     * @return
     */
    clearCode() {
        return this.serviceCallRunner.execute(this.clearCodeCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//74
     *
     * @tapVersion(">=1.90")
     * @return call options
     */
    clearCodeCall() {
        const callOptions = Object.assign({}, this.resources.clearCode);
        return callOptions;
    }
    /**
     * Append JVM code. If body length is 0, it will clear code stored in Tap.
     *
     * LWM2M path: /1024//74
     *
     * @tapVersion(">=1.90")
     * @param value input
     * @return
     */
    appendCode(
    /*
     *
     */
    value) {
        return this.serviceCallRunner.execute(this.appendCodeCall(value));
    }
    appendCodeAppendCalls(
    /*
     *
     */
    value, chunkSize) {
        return this.serviceCallRunner.createAppendCalls(this.appendCodeCall(value), chunkSize);
    }
    /**
     *
     *
     * LWM2M path: /1024//74
     *
     * @tapVersion(">=1.90")
     * @param value input
     * @return call options
     */
    appendCodeCall(
    /*
     *
     */
    value) {
        const callOptions = Object.assign({}, this.resources.appendCode);
        callOptions.body = value;
        return callOptions;
    }
    /**
     * Get user id that gives rights to the JVM code
     *
     * LWM2M path: /1024//66
     *
     * @tapVersion(">=")
     * @return
     */
    getProfileId() {
        return this.serviceCallRunner.execute(this.getProfileIdCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//66
     *
     * @tapVersion(">=")
     * @return call options
     */
    getProfileIdCall() {
        const callOptions = Object.assign({}, this.resources.getProfileId);
        return callOptions;
    }
    /**
     * Write user id that gives right to the JVM code
     *
     * LWM2M path: /1024//66
     *
     * @tapVersion(">=")
     * @param key input
     * @return
     */
    putProfileId(
    /*
     *
     */
    key) {
        return this.serviceCallRunner.execute(this.putProfileIdCall(key));
    }
    /**
     *
     *
     * LWM2M path: /1024//66
     *
     * @tapVersion(">=")
     * @param key input
     * @return call options
     */
    putProfileIdCall(
    /*
     *
     */
    key) {
        const callOptions = Object.assign({}, this.resources.putProfileId);
        callOptions.body = key;
        return callOptions;
    }
}

const _TAP_SERVICE_EXTENSION_JVM_ = extendServiceContainer("jvm", JvmService);

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

export { SERVICE_CALLS as JVM_SERVICE_CALLS, JvmService, _TAP_SERVICE_EXTENSION_JVM_, serviceConverters as jvmConverters };
//# sourceMappingURL=iotize-tap-service-impl-jvm.js.map
