import { TapRequestFrame } from '@iotize/tap/client/api';
import { createEnumConverter, createEnumArrayConverter, converters } from '@iotize/tap/service/core';
import { TapStreamReader, TapStreamWriter, enumKeyOrValueToNumber } from '@iotize/tap/client/impl';
import { AbstractService, ServiceCallRunner, TapResponse, TapError, extendServiceContainer } from '@iotize/tap';

/* 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 NfcPairingMode;
(function (NfcPairingMode) {
    NfcPairingMode[NfcPairingMode["NO"] = 0] = "NO";
    NfcPairingMode[NfcPairingMode["MANDATORY"] = 1] = "MANDATORY";
    NfcPairingMode[NfcPairingMode["MANDATORY_FOR_LOGIN"] = 2] = "MANDATORY_FOR_LOGIN";
})(NfcPairingMode || (NfcPairingMode = {}));
var WirelessPairingOptions;
(function (WirelessPairingOptions) {
    /* 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.
     */
    let NfcPairingMode;
    (function (NfcPairingMode) {
        NfcPairingMode[NfcPairingMode["NO"] = 0] = "NO";
        NfcPairingMode[NfcPairingMode["MANDATORY"] = 1] = "MANDATORY";
        NfcPairingMode[NfcPairingMode["MANDATORY_FOR_LOGIN"] = 2] = "MANDATORY_FOR_LOGIN";
    })(NfcPairingMode = WirelessPairingOptions.NfcPairingMode || (WirelessPairingOptions.NfcPairingMode = {}));
})(WirelessPairingOptions || (WirelessPairingOptions = {}));
/* 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 LowPowerOptimizationLevel;
(function (LowPowerOptimizationLevel) {
    LowPowerOptimizationLevel[LowPowerOptimizationLevel["NO"] = 0] = "NO";
    LowPowerOptimizationLevel[LowPowerOptimizationLevel["STANDBY"] = 2] = "STANDBY";
    LowPowerOptimizationLevel[LowPowerOptimizationLevel["SHUTDOWN"] = 3] = "SHUTDOWN";
})(LowPowerOptimizationLevel || (LowPowerOptimizationLevel = {}));
/* 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 ServiceCode;
(function (ServiceCode) {
    ServiceCode[ServiceCode["DATALOG"] = 1] = "DATALOG";
    ServiceCode[ServiceCode["JVM"] = 2] = "JVM";
})(ServiceCode || (ServiceCode = {}));
/* 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 NfcConnectionPriority;
(function (NfcConnectionPriority) {
    NfcConnectionPriority[NfcConnectionPriority["NFC_PRIORITY"] = 0] = "NFC_PRIORITY";
    NfcConnectionPriority[NfcConnectionPriority["NFC_NON_PRIORITY"] = 1] = "NFC_NON_PRIORITY";
})(NfcConnectionPriority || (NfcConnectionPriority = {}));
var MultiRequestFrame;
(function (MultiRequestFrame) {
    /* 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.
     */
    /* 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.
     */
    let ExpectedResponseStatus;
    (function (ExpectedResponseStatus) {
        ExpectedResponseStatus[ExpectedResponseStatus["SUCCESS"] = 127] = "SUCCESS";
        ExpectedResponseStatus[ExpectedResponseStatus["ANYTHING"] = 255] = "ANYTHING";
    })(ExpectedResponseStatus = MultiRequestFrame.ExpectedResponseStatus || (MultiRequestFrame.ExpectedResponseStatus = {}));
})(MultiRequestFrame || (MultiRequestFrame = {}));

/**
 *   Generated file. Do not edit
 */
TapStreamReader.prototype.readLoginCredential = function () {
    const model = {};
    model.username = this.readString(16);
    model.password = this.readString(16);
    return model;
};
TapStreamReader.prototype.readLoginCredentialHashed =
    function () {
        const model = {};
        model.username = this.readString(16);
        model.password = this.readBytes(16);
        return model;
    };
TapStreamReader.prototype.readSecurityOptions = function () {
    const model = {};
    this.forwardBits(8);
    this.forwardBits(3);
    model.scramActivated = this.readBoolean(1);
    model.hashPassword = this.readBoolean(1);
    model.disableHardwareFactoryReset = this.readBoolean(1);
    model.disableLoginWithUID = this.readBoolean(1);
    model.disableResourceFactoryReset = this.readBoolean(1);
    return model;
};
TapStreamReader.prototype.readWirelessPairingOptions =
    function () {
        const model = {};
        this.forwardBits(5);
        model.blePairing = this.readBoolean(1);
        model.nfcPairingMode = this.readBits(2);
        return model;
    };
TapStreamReader.prototype.readProtocolMaxFrameSize =
    function () {
        const model = {};
        model.request = this.readUnsigned(2);
        model.response = this.readUnsigned(2);
        return model;
    };
TapStreamReader.prototype.readMultiRequestFrame =
    function () {
        const model = {};
        model.requests = [];
        while (!this.isEof()) {
            model.requests.push(this.readMultiRequestFrameRequestItem());
        }
        return model;
    };
TapStreamReader.prototype.readMultiRequestFrameRequestItem =
    function () {
        const model = {};
        model.requestLen = this.readUnsigned(2);
        model.request = this.subStream(model.requestLen).readTapRequestFrame();
        model.expectedResponseStatus = this.readUnsigned(1);
        return model;
    };
TapStreamReader.prototype.readMultiResponseFrame =
    function () {
        const model = {};
        model.responses = [];
        while (!this.isEof()) {
            model.responses.push(this.readMultiResponseFrameResponseItem());
        }
        return model;
    };
TapStreamReader.prototype.readMultiResponseFrameResponseItem =
    function () {
        const model = {};
        model.responseLen = this.readUnsigned(2);
        model.response = this.subStream(model.responseLen).readTapResponseFrame();
        return model;
    };
// TapStreamWriter.prototype.write(model: LoginCredential) : TapStreamWriter{
//     return this.writeLoginCredential(model)
// }
TapStreamWriter.prototype.writeLoginCredential = function (model) {
    this.writeString(model.username, 16);
    this.writeString(model.password, 16);
    return this;
};
// TapStreamWriter.prototype.write(model: LoginCredentialHashed) : TapStreamWriter{
//     return this.writeLoginCredentialHashed(model)
// }
TapStreamWriter.prototype.writeLoginCredentialHashed = function (model) {
    this.writeString(model.username, 16);
    this.writeBytes(model.password, 16);
    return this;
};
// TapStreamWriter.prototype.write(model: SecurityOptions) : TapStreamWriter{
//     return this.writeSecurityOptions(model)
// }
TapStreamWriter.prototype.writeSecurityOptions = function (model) {
    this.forwardBits(8);
    this.forwardBits(3);
    this.writeBoolean(model.scramActivated, 1);
    this.writeBoolean(model.hashPassword, 1);
    this.writeBoolean(model.disableHardwareFactoryReset, 1);
    this.writeBoolean(model.disableLoginWithUID, 1);
    this.writeBoolean(model.disableResourceFactoryReset, 1);
    return this;
};
// TapStreamWriter.prototype.write(model: WirelessPairingOptions) : TapStreamWriter{
//     return this.writeWirelessPairingOptions(model)
// }
TapStreamWriter.prototype.writeWirelessPairingOptions = function (model) {
    this.forwardBits(5);
    this.writeBoolean(model.blePairing, 1);
    this.writeBitsInt(enumKeyOrValueToNumber(model.nfcPairingMode, WirelessPairingOptions.NfcPairingMode), 2);
    return this;
};
// TapStreamWriter.prototype.write(model: ProtocolMaxFrameSize) : TapStreamWriter{
//     return this.writeProtocolMaxFrameSize(model)
// }
TapStreamWriter.prototype.writeProtocolMaxFrameSize = function (model) {
    this.writeUnsigned(model.request, 2);
    this.writeUnsigned(model.response, 2);
    return this;
};
// TapStreamWriter.prototype.write(model: MultiRequestFrame) : TapStreamWriter{
//     return this.writeMultiRequestFrame(model)
// }
TapStreamWriter.prototype.writeMultiRequestFrame = function (model) {
    for (let item of model.requests) {
        this.writeMultiRequestFrameRequestItem(item);
    }
    return this;
};
TapStreamWriter.prototype.writeMultiRequestFrameRequestItem = function (model) {
    this.writeUnsigned(model.requestLen, 2);
    this.writeTapRequestFrame(model.request);
    this.writeUnsigned(model.expectedResponseStatus, 1);
    return this;
};
// TapStreamWriter.prototype.write(model: MultiResponseFrame) : TapStreamWriter{
//     return this.writeMultiResponseFrame(model)
// }
TapStreamWriter.prototype.writeMultiResponseFrame = function (model) {
    for (let item of model.responses) {
        this.writeMultiResponseFrameResponseItem(item);
    }
    return this;
};
TapStreamWriter.prototype.writeMultiResponseFrameResponseItem = function (model) {
    this.writeUnsigned(model.responseLen, 2);
    this.writeTapResponseFrame(model.response);
    return this;
};

/**
 *   Generated file. Do not edit
 */
class LoginCredentialConverter {
    encode(model, stream = new TapStreamWriter()) {
        stream.writeLoginCredential(model);
        return stream.toBytes;
    }
    decode(data) {
        const stream = data instanceof TapStreamReader ? data : TapStreamReader.create(data);
        return stream.readLoginCredential();
    }
}
class LoginCredentialHashedConverter {
    encode(model, stream = new TapStreamWriter()) {
        stream.writeLoginCredentialHashed(model);
        return stream.toBytes;
    }
    decode(data) {
        const stream = data instanceof TapStreamReader ? data : TapStreamReader.create(data);
        return stream.readLoginCredentialHashed();
    }
}
class SecurityOptionsConverter {
    encode(model, stream = new TapStreamWriter()) {
        stream.writeSecurityOptions(model);
        return stream.toBytes;
    }
    decode(data) {
        const stream = data instanceof TapStreamReader ? data : TapStreamReader.create(data);
        return stream.readSecurityOptions();
    }
}
class WirelessPairingOptionsConverter {
    encode(model, stream = new TapStreamWriter()) {
        stream.writeWirelessPairingOptions(model);
        return stream.toBytes;
    }
    decode(data) {
        const stream = data instanceof TapStreamReader ? data : TapStreamReader.create(data);
        return stream.readWirelessPairingOptions();
    }
}
class ProtocolMaxFrameSizeConverter {
    encode(model, stream = new TapStreamWriter()) {
        stream.writeProtocolMaxFrameSize(model);
        return stream.toBytes;
    }
    decode(data) {
        const stream = data instanceof TapStreamReader ? data : TapStreamReader.create(data);
        return stream.readProtocolMaxFrameSize();
    }
}
class MultiRequestFrameConverter {
    encode(model, stream = new TapStreamWriter()) {
        stream.writeMultiRequestFrame(model);
        return stream.toBytes;
    }
    decode(data) {
        const stream = data instanceof TapStreamReader ? data : TapStreamReader.create(data);
        return stream.readMultiRequestFrame();
    }
}
class MultiResponseFrameConverter {
    encode(model, stream = new TapStreamWriter()) {
        stream.writeMultiResponseFrame(model);
        return stream.toBytes;
    }
    decode(data) {
        const stream = data instanceof TapStreamReader ? data : TapStreamReader.create(data);
        return stream.readMultiResponseFrame();
    }
}

/**
 *   Generated file. Do not edit
 */
const loginCredential = new LoginCredentialConverter();
const loginCredentialHashed = new LoginCredentialHashedConverter();
const securityOptions = new SecurityOptionsConverter();
const nfcPairingMode = createEnumConverter(NfcPairingMode, 1);
const nfcPairingModeArray = createEnumArrayConverter(NfcPairingMode, 1);
const wirelessPairingOptions = new WirelessPairingOptionsConverter();
const lowPowerOptimizationLevel = createEnumConverter(LowPowerOptimizationLevel, 1);
const lowPowerOptimizationLevelArray = createEnumArrayConverter(LowPowerOptimizationLevel, 1);
const serviceCode = createEnumConverter(ServiceCode, 1);
const serviceCodeArray = createEnumArrayConverter(ServiceCode, 1);
const nfcConnectionPriority = createEnumConverter(NfcConnectionPriority, 1);
const nfcConnectionPriorityArray = createEnumArrayConverter(NfcConnectionPriority, 1);
const protocolMaxFrameSize = new ProtocolMaxFrameSizeConverter();
const multiRequestFrame = new MultiRequestFrameConverter();
const multiResponseFrame = new MultiResponseFrameConverter();

var serviceConverters = /*#__PURE__*/Object.freeze({
    __proto__: null,
    loginCredential: loginCredential,
    loginCredentialHashed: loginCredentialHashed,
    securityOptions: securityOptions,
    nfcPairingMode: nfcPairingMode,
    nfcPairingModeArray: nfcPairingModeArray,
    wirelessPairingOptions: wirelessPairingOptions,
    lowPowerOptimizationLevel: lowPowerOptimizationLevel,
    lowPowerOptimizationLevelArray: lowPowerOptimizationLevelArray,
    serviceCode: serviceCode,
    serviceCodeArray: serviceCodeArray,
    nfcConnectionPriority: nfcConnectionPriority,
    nfcConnectionPriorityArray: nfcConnectionPriorityArray,
    protocolMaxFrameSize: protocolMaxFrameSize,
    multiRequestFrame: multiRequestFrame,
    multiResponseFrame: multiResponseFrame
});

/**
 *   Generated file. Do not edit
 */
const allConverters = Object.assign(Object.assign({}, converters), serviceConverters);
const SERVICE_CALLS = {
    login: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/interface/login',
        path: '/1024//0',
        bodyEncoder: allConverters.loginCredential,
    },
    loginWithHash: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/interface/login-with-hash',
        path: '/1024//0',
        bodyEncoder: allConverters.loginCredentialHashed,
    },
    logout: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/interface/logout',
        path: '/1024//1',
    },
    getCurrentProfileId: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/current-profile/id',
        path: '/1024//2',
        responseBodyDecoder: allConverters.uint16,
    },
    getCurrentHostProtocol: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/current-host-protocol',
        path: '/1024//3',
        responseBodyDecoder: allConverters.hostProtocol,
    },
    putCurrentHostProtocol: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/current-host-protocol',
        path: '/1024//3',
        bodyEncoder: allConverters.hostProtocol,
    },
    getUID: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/uid',
        path: '/1024//5',
    },
    loginWithUID: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/interface/uid',
        path: '/1024//5',
    },
    keepAlive: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/keep-alive',
        path: '/1024//4',
        responseBodyDecoder: allConverters.uint32,
    },
    getSecurityOptions: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/security-options',
        path: '/1024//6',
        responseBodyDecoder: allConverters.securityOptions,
    },
    putSecurityOptions: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/security-options',
        path: '/1024//6',
        bodyEncoder: allConverters.securityOptions,
    },
    getCurrentGroupId: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/current-group-id',
        path: '/1024//7',
        responseBodyDecoder: allConverters.uint16,
    },
    getConfigFormatVersion: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/config-format-version',
        path: '/1024//8',
        responseBodyDecoder: allConverters.uint16,
    },
    putConfigFormatVersion: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/config-format-version',
        path: '/1024//8',
        bodyEncoder: allConverters.uint16,
    },
    getAppName: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/app-name',
        path: '/1024//9',
        responseBodyDecoder: allConverters.ascii,
    },
    putAppName: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/app-name',
        path: '/1024//9',
        bodyEncoder: allConverters.ascii,
    },
    getConfigVersion: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/config-version',
        path: '/1024//10',
        responseBodyDecoder: allConverters.stringVersion,
    },
    putConfigVersion: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/config-version',
        path: '/1024//10',
        bodyEncoder: allConverters.stringVersion,
    },
    reloadConfig: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/interface/config-version',
        path: '/1024//10',
    },
    getAppPath: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/app-path',
        path: '/1024//11',
        responseBodyDecoder: allConverters.ascii,
    },
    putAppPath: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/app-path',
        path: '/1024//11',
        bodyEncoder: allConverters.ascii,
    },
    getNfcPairingMode: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/nfc/pairing-mode',
        path: '/1024//13',
        responseBodyDecoder: allConverters.nfcPairingMode,
    },
    putNfcPairingMode: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/nfc/pairing-mode',
        path: '/1024//13',
        bodyEncoder: allConverters.nfcPairingMode,
    },
    getPairingOptions: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/pairing-options',
        path: '/1024//13',
        responseBodyDecoder: allConverters.wirelessPairingOptions,
    },
    postPairingOptions: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/interface/pairing-options',
        path: '/1024//13',
        bodyEncoder: allConverters.wirelessPairingOptions,
    },
    putPairingOptions: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/pairing-options',
        path: '/1024//13',
        bodyEncoder: allConverters.wirelessPairingOptions,
    },
    getPowerOptimisationLevel: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/power-optimisation-level',
        path: '/1024//14',
        responseBodyDecoder: allConverters.lowPowerOptimizationLevel,
    },
    putPowerOptimisationLevel: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/power-optimisation-level',
        path: '/1024//14',
        bodyEncoder: allConverters.lowPowerOptimizationLevel,
    },
    getAuthorizedHostProtocol: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/authorized-host-protocol',
        path: '/1024//17',
        responseBodyDecoder: allConverters.hostProtocolArray,
    },
    putAuthorizedHostProtocol: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/authorized-host-protocol',
        path: '/1024//17',
        bodyEncoder: allConverters.hostProtocolArray,
    },
    getConfigFormatFirmwareVersion: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/config-format-firmware-version',
        path: '/1024//18',
        responseBodyDecoder: allConverters.uint16,
    },
    getUniversalLink: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/universal-link',
        path: '/1024//19',
        responseBodyDecoder: allConverters.ascii,
    },
    putUniversalLink: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/universal-link',
        path: '/1024//19',
        bodyEncoder: allConverters.ascii,
    },
    getAvailableHostProtocols: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/available-host-protocols',
        path: '/1024//21',
        responseBodyDecoder: allConverters.hostProtocolArray,
    },
    getDisabledServices: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/disabled-services',
        path: '/1024//75',
        responseBodyDecoder: allConverters.serviceCodeArray,
    },
    postDisabledServices: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/interface/disabled-services',
        path: '/1024//75',
        bodyEncoder: allConverters.serviceCodeArray,
    },
    getNfcConnectionPriority: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/nfc_connection_priority',
        path: '/1024//24',
        responseBodyDecoder: allConverters.nfcConnectionPriority,
    },
    postNfcConnectionPriority: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/interface/nfc_connection_priority',
        path: '/1024//24',
        bodyEncoder: allConverters.nfcConnectionPriority,
    },
    putNfcConnectionPriority: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/nfc_connection_priority',
        path: '/1024//24',
        bodyEncoder: allConverters.nfcConnectionPriority,
    },
    getNfcAutologProfileId: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/nfc-autolog-profile-id',
        path: '/1024//43',
        responseBodyDecoder: allConverters.uint16,
    },
    putNfcAutologProfileId: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/nfc-autolog-profile-id',
        path: '/1024//43',
        bodyEncoder: allConverters.uint16,
    },
    getHostInactivityPeriod: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/host-inactivity-period',
        path: '/1024//34',
        responseBodyDecoder: allConverters.uint16,
    },
    putHostInactivityPeriod: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/host-inactivity-period',
        path: '/1024//34',
        bodyEncoder: allConverters.uint8,
    },
    getApplicationData: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/application-data',
        path: '/1024//36',
    },
    putApplicationData: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/application-data',
        path: '/1024//36',
    },
    getProductKey: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/product-key',
        path: '/1024//60',
        responseBodyDecoder: allConverters.ascii,
    },
    getCurrentHostProtocolMaxFrameSize: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/current-host-protocol-max-frame-size',
        path: '/1024//88',
        responseBodyDecoder: allConverters.protocolMaxFrameSize,
    },
    executeMultiRequestFrame: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/multi-request-frame',
        path: '/1024//89',
        responseBodyDecoder: allConverters.multiResponseFrame,
        bodyEncoder: allConverters.multiRequestFrame,
    },
    putCertificatePublicKey: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/certificate/public-key',
        append: true,
        path: '/1024//37',
    },
    putCertificatePrivateKey: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/certificate/private-key',
        append: true,
        path: '/1024//38',
    },
    putCertificateRootKey: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/certificate/root-key',
        append: true,
        path: '/1024//39',
    },
    getProductCode: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/product-code',
        path: '/1024//84',
        responseBodyDecoder: allConverters.ascii,
    },
    putProductCode: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/product-code',
        path: '/1024//84',
        bodyEncoder: allConverters.ascii,
    },
    getSpecialFeatureProfile: {
        method: TapRequestFrame.MethodType.GET,
        pathAlias: '/interface/special-feature/{featureId}',
        path: '/1024//{featureId}',
        responseBodyDecoder: allConverters.uint16,
    },
    setSpecialFeatureProfile: {
        method: TapRequestFrame.MethodType.POST,
        pathAlias: '/interface/special-feature/{featureId}',
        path: '/1024//{featureId}',
        bodyEncoder: allConverters.uint16,
    },
    putSpecialFeatureProfile: {
        method: TapRequestFrame.MethodType.PUT,
        pathAlias: '/interface/special-feature/{featureId}',
        path: '/1024//{featureId}',
        bodyEncoder: allConverters.uint16,
    },
};

class InterfaceService extends AbstractService {
    constructor() {
        super(...arguments);
        this.resources = SERVICE_CALLS;
    }
    /**
     * Login
     *
     * LWM2M path: /1024//0
     *
     * @tapVersion(">=")
     * @param credential input
     * @return
     */
    login(
    /*
     * Username/password credentials
     */
    credential) {
        return this.serviceCallRunner.execute(this.loginCall(credential));
    }
    /**
     *
     *
     * LWM2M path: /1024//0
     *
     * @tapVersion(">=")
     * @param credential input
     * @return call options
     */
    loginCall(
    /*
     * Username/password credentials
     */
    credential) {
        const callOptions = Object.assign({}, this.resources.login);
        callOptions.body = credential;
        return callOptions;
    }
    /**
     * Login
     *
     * LWM2M path: /1024//0
     *
     * @tapVersion(">=")
     * @param credential input
     * @return
     */
    loginWithHash(
    /*
     *
     */
    credential) {
        return this.serviceCallRunner.execute(this.loginWithHashCall(credential));
    }
    /**
     *
     *
     * LWM2M path: /1024//0
     *
     * @tapVersion(">=")
     * @param credential input
     * @return call options
     */
    loginWithHashCall(
    /*
     *
     */
    credential) {
        const callOptions = Object.assign({}, this.resources.loginWithHash);
        callOptions.body = credential;
        return callOptions;
    }
    /**
     * Logout
     *
     * LWM2M path: /1024//1
     *
     * @tapVersion(">=")
     * @return
     */
    logout() {
        return this.serviceCallRunner.execute(this.logoutCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//1
     *
     * @tapVersion(">=")
     * @return call options
     */
    logoutCall() {
        const callOptions = Object.assign({}, this.resources.logout);
        return callOptions;
    }
    /**
     * Get current profile id
     *
     * LWM2M path: /1024//2
     *
     * @tapVersion(">=")
     * @return
     */
    getCurrentProfileId() {
        return this.serviceCallRunner.execute(this.getCurrentProfileIdCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//2
     *
     * @tapVersion(">=")
     * @return call options
     */
    getCurrentProfileIdCall() {
        const callOptions = Object.assign({}, this.resources.getCurrentProfileId);
        return callOptions;
    }
    /**
     * Get current host protocol
     *
     * LWM2M path: /1024//3
     *
     * @tapVersion(">=")
     * @return
     */
    getCurrentHostProtocol() {
        return this.serviceCallRunner.execute(this.getCurrentHostProtocolCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//3
     *
     * @tapVersion(">=")
     * @return call options
     */
    getCurrentHostProtocolCall() {
        const callOptions = Object.assign({}, this.resources.getCurrentHostProtocol);
        return callOptions;
    }
    /**
     * Write current host protocol
     *
     * LWM2M path: /1024//3
     *
     * @tapVersion(">=")
     * @param hostProtocol input
     * @return
     */
    putCurrentHostProtocol(
    /*
     *
     */
    hostProtocol) {
        return this.serviceCallRunner.execute(this.putCurrentHostProtocolCall(hostProtocol));
    }
    /**
     *
     *
     * LWM2M path: /1024//3
     *
     * @tapVersion(">=")
     * @param hostProtocol input
     * @return call options
     */
    putCurrentHostProtocolCall(
    /*
     *
     */
    hostProtocol) {
        const callOptions = Object.assign({}, this.resources.putCurrentHostProtocol);
        callOptions.body = hostProtocol;
        return callOptions;
    }
    /**
     * Get UID value
     *
     * LWM2M path: /1024//5
     *
     * @tapVersion(">=")
     * @return
     */
    getUID() {
        return this.serviceCallRunner.execute(this.getUIDCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//5
     *
     * @tapVersion(">=")
     * @return call options
     */
    getUIDCall() {
        const callOptions = Object.assign({}, this.resources.getUID);
        return callOptions;
    }
    /**
     * Administrator login with UID.
     *
     * LWM2M path: /1024//5
     *
     * @tapVersion(">=")
     * @param uid input
     * @return
     */
    loginWithUID(
    /*
     *
     */
    uid) {
        return this.serviceCallRunner.execute(this.loginWithUIDCall(uid));
    }
    /**
     *
     *
     * LWM2M path: /1024//5
     *
     * @tapVersion(">=")
     * @param uid input
     * @return call options
     */
    loginWithUIDCall(
    /*
     *
     */
    uid) {
        const callOptions = Object.assign({}, this.resources.loginWithUID);
        callOptions.body = uid;
        return callOptions;
    }
    /**
     * Keep alive.
     *
     * LWM2M path: /1024//4
     *
     * @tapVersion(">=")
     * @return
     */
    keepAlive() {
        return this.serviceCallRunner.execute(this.keepAliveCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//4
     *
     * @tapVersion(">=")
     * @return call options
     */
    keepAliveCall() {
        const callOptions = Object.assign({}, this.resources.keepAlive);
        return callOptions;
    }
    /**
     * Get lock infos
     *
     * LWM2M path: /1024//6
     *
     * @tapVersion(">=")
     * @return
     */
    getSecurityOptions() {
        return this.serviceCallRunner.execute(this.getSecurityOptionsCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//6
     *
     * @tapVersion(">=")
     * @return call options
     */
    getSecurityOptionsCall() {
        const callOptions = Object.assign({}, this.resources.getSecurityOptions);
        return callOptions;
    }
    /**
     * Set lock infos
     *
     * LWM2M path: /1024//6
     *
     * @tapVersion(">=")
     * @param infos input
     * @return
     */
    putSecurityOptions(
    /*
     * lock informations
     */
    infos) {
        return this.serviceCallRunner.execute(this.putSecurityOptionsCall(infos));
    }
    /**
     *
     *
     * LWM2M path: /1024//6
     *
     * @tapVersion(">=")
     * @param infos input
     * @return call options
     */
    putSecurityOptionsCall(
    /*
     * lock informations
     */
    infos) {
        const callOptions = Object.assign({}, this.resources.putSecurityOptions);
        callOptions.body = infos;
        return callOptions;
    }
    /**
     * Get current group id
     *
     * LWM2M path: /1024//7
     *
     * @tapVersion(">=")
     * @return
     */
    getCurrentGroupId() {
        return this.serviceCallRunner.execute(this.getCurrentGroupIdCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//7
     *
     * @tapVersion(">=")
     * @return call options
     */
    getCurrentGroupIdCall() {
        const callOptions = Object.assign({}, this.resources.getCurrentGroupId);
        return callOptions;
    }
    /**
     * Get config format version
     *
     * LWM2M path: /1024//8
     *
     * @tapVersion(">=")
     * @return
     */
    getConfigFormatVersion() {
        return this.serviceCallRunner.execute(this.getConfigFormatVersionCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//8
     *
     * @tapVersion(">=")
     * @return call options
     */
    getConfigFormatVersionCall() {
        const callOptions = Object.assign({}, this.resources.getConfigFormatVersion);
        return callOptions;
    }
    /**
     * Set config format version
     *
     * LWM2M path: /1024//8
     *
     * @tapVersion(">=")
     * @param configFormat input
     * @return
     */
    putConfigFormatVersion(
    /*
     *
     */
    configFormat) {
        return this.serviceCallRunner.execute(this.putConfigFormatVersionCall(configFormat));
    }
    /**
     *
     *
     * LWM2M path: /1024//8
     *
     * @tapVersion(">=")
     * @param configFormat input
     * @return call options
     */
    putConfigFormatVersionCall(
    /*
     *
     */
    configFormat) {
        const callOptions = Object.assign({}, this.resources.putConfigFormatVersion);
        callOptions.body = configFormat;
        return callOptions;
    }
    /**
     * Get application name
     *
     * LWM2M path: /1024//9
     *
     * @tapVersion(">=")
     * @return
     */
    getAppName() {
        return this.serviceCallRunner.execute(this.getAppNameCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//9
     *
     * @tapVersion(">=")
     * @return call options
     */
    getAppNameCall() {
        const callOptions = Object.assign({}, this.resources.getAppName);
        return callOptions;
    }
    /**
     * Set application name
     *
     * LWM2M path: /1024//9
     *
     * @tapVersion(">=")
     * @param appName input
     * @return
     */
    putAppName(
    /*
     *
     */
    appName) {
        return this.serviceCallRunner.execute(this.putAppNameCall(appName));
    }
    /**
     *
     *
     * LWM2M path: /1024//9
     *
     * @tapVersion(">=")
     * @param appName input
     * @return call options
     */
    putAppNameCall(
    /*
     *
     */
    appName) {
        const callOptions = Object.assign({}, this.resources.putAppName);
        callOptions.body = appName;
        return callOptions;
    }
    /**
     * Get config version
     *
     * LWM2M path: /1024//10
     *
     * @tapVersion(">=")
     * @return
     */
    getConfigVersion() {
        return this.serviceCallRunner.execute(this.getConfigVersionCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//10
     *
     * @tapVersion(">=")
     * @return call options
     */
    getConfigVersionCall() {
        const callOptions = Object.assign({}, this.resources.getConfigVersion);
        return callOptions;
    }
    /**
     * Set config version
     *
     * LWM2M path: /1024//10
     *
     * @tapVersion(">=")
     * @param version input
     * @return
     */
    putConfigVersion(
    /*
     *
     */
    version) {
        return this.serviceCallRunner.execute(this.putConfigVersionCall(version));
    }
    /**
     *
     *
     * LWM2M path: /1024//10
     *
     * @tapVersion(">=")
     * @param version input
     * @return call options
     */
    putConfigVersionCall(
    /*
     *
     */
    version) {
        const callOptions = Object.assign({}, this.resources.putConfigVersion);
        callOptions.body = version;
        return callOptions;
    }
    /**
     * Apply the new configuration on the Tap
     *
     * LWM2M path: /1024//10
     *
     * @tapVersion(">=")
     * @return
     */
    reloadConfig() {
        return this.serviceCallRunner.execute(this.reloadConfigCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//10
     *
     * @tapVersion(">=")
     * @return call options
     */
    reloadConfigCall() {
        const callOptions = Object.assign({}, this.resources.reloadConfig);
        return callOptions;
    }
    /**
     * Get app path
     *
     * LWM2M path: /1024//11
     *
     * @tapVersion(">=")
     * @return
     */
    getAppPath() {
        return this.serviceCallRunner.execute(this.getAppPathCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//11
     *
     * @tapVersion(">=")
     * @return call options
     */
    getAppPathCall() {
        const callOptions = Object.assign({}, this.resources.getAppPath);
        return callOptions;
    }
    /**
     * Set app path
     *
     * LWM2M path: /1024//11
     *
     * @tapVersion(">=")
     * @param value input
     * @return
     */
    putAppPath(
    /*
     *
     */
    value) {
        return this.serviceCallRunner.execute(this.putAppPathCall(value));
    }
    /**
     *
     *
     * LWM2M path: /1024//11
     *
     * @tapVersion(">=")
     * @param value input
     * @return call options
     */
    putAppPathCall(
    /*
     *
     */
    value) {
        const callOptions = Object.assign({}, this.resources.putAppPath);
        callOptions.body = value;
        return callOptions;
    }
    /**
     * Check if nfc paring is mandatory
     *
     * LWM2M path: /1024//13
     *
     * @tapVersion(">=")
     * @return
     */
    getNfcPairingMode() {
        return this.serviceCallRunner.execute(this.getNfcPairingModeCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//13
     *
     * @tapVersion(">=")
     * @return call options
     */
    getNfcPairingModeCall() {
        const callOptions = Object.assign({}, this.resources.getNfcPairingMode);
        return callOptions;
    }
    /**
     * Change wether if nfc pairing is mandatory
     *
     * LWM2M path: /1024//13
     *
     * @tapVersion(">=")
     * @param mode input
     * @return
     */
    putNfcPairingMode(
    /*
     *
     */
    mode) {
        return this.serviceCallRunner.execute(this.putNfcPairingModeCall(mode));
    }
    /**
     *
     *
     * LWM2M path: /1024//13
     *
     * @tapVersion(">=")
     * @param mode input
     * @return call options
     */
    putNfcPairingModeCall(
    /*
     *
     */
    mode) {
        const callOptions = Object.assign({}, this.resources.putNfcPairingMode);
        callOptions.body = mode;
        return callOptions;
    }
    /**
     * Get pairing options
     *
     * LWM2M path: /1024//13
     *
     * @tapVersion(">=")
     * @return
     */
    getPairingOptions() {
        return this.serviceCallRunner.execute(this.getPairingOptionsCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//13
     *
     * @tapVersion(">=")
     * @return call options
     */
    getPairingOptionsCall() {
        const callOptions = Object.assign({}, this.resources.getPairingOptions);
        return callOptions;
    }
    /**
     * Set pairing options (temporary)
     *
     * LWM2M path: /1024//13
     *
     * @tapVersion(">=")
     * @param options input
     * @return
     */
    postPairingOptions(
    /*
     *
     */
    options) {
        return this.serviceCallRunner.execute(this.postPairingOptionsCall(options));
    }
    /**
     *
     *
     * LWM2M path: /1024//13
     *
     * @tapVersion(">=")
     * @param options input
     * @return call options
     */
    postPairingOptionsCall(
    /*
     *
     */
    options) {
        const callOptions = Object.assign({}, this.resources.postPairingOptions);
        callOptions.body = options;
        return callOptions;
    }
    /**
     * Write pairing options
     *
     * LWM2M path: /1024//13
     *
     * @tapVersion(">=")
     * @param options input
     * @return
     */
    putPairingOptions(
    /*
     *
     */
    options) {
        return this.serviceCallRunner.execute(this.putPairingOptionsCall(options));
    }
    /**
     *
     *
     * LWM2M path: /1024//13
     *
     * @tapVersion(">=")
     * @param options input
     * @return call options
     */
    putPairingOptionsCall(
    /*
     *
     */
    options) {
        const callOptions = Object.assign({}, this.resources.putPairingOptions);
        callOptions.body = options;
        return callOptions;
    }
    /**
     * Get power optimization level
     *
     * LWM2M path: /1024//14
     *
     * @tapVersion(">=")
     * @return
     */
    getPowerOptimisationLevel() {
        return this.serviceCallRunner.execute(this.getPowerOptimisationLevelCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//14
     *
     * @tapVersion(">=")
     * @return call options
     */
    getPowerOptimisationLevelCall() {
        const callOptions = Object.assign({}, this.resources.getPowerOptimisationLevel);
        return callOptions;
    }
    /**
     * Write power optimization level
     *
     * LWM2M path: /1024//14
     *
     * @tapVersion(">=")
     * @param mode input
     * @return
     */
    putPowerOptimisationLevel(
    /*
     *
     */
    mode) {
        return this.serviceCallRunner.execute(this.putPowerOptimisationLevelCall(mode));
    }
    /**
     *
     *
     * LWM2M path: /1024//14
     *
     * @tapVersion(">=")
     * @param mode input
     * @return call options
     */
    putPowerOptimisationLevelCall(
    /*
     *
     */
    mode) {
        const callOptions = Object.assign({}, this.resources.putPowerOptimisationLevel);
        callOptions.body = mode;
        return callOptions;
    }
    /**
     * Get authorized host protocols
     *
     * LWM2M path: /1024//17
     *
     * @tapVersion(">=")
     * @return
     */
    getAuthorizedHostProtocol() {
        return this.serviceCallRunner.execute(this.getAuthorizedHostProtocolCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//17
     *
     * @tapVersion(">=")
     * @return call options
     */
    getAuthorizedHostProtocolCall() {
        const callOptions = Object.assign({}, this.resources.getAuthorizedHostProtocol);
        return callOptions;
    }
    /**
     * Write authorized host protocols
     *
     * LWM2M path: /1024//17
     *
     * @tapVersion(">=")
     * @param mode input
     * @return
     */
    putAuthorizedHostProtocol(
    /*
     *
     */
    mode) {
        return this.serviceCallRunner.execute(this.putAuthorizedHostProtocolCall(mode));
    }
    /**
     *
     *
     * LWM2M path: /1024//17
     *
     * @tapVersion(">=")
     * @param mode input
     * @return call options
     */
    putAuthorizedHostProtocolCall(
    /*
     *
     */
    mode) {
        const callOptions = Object.assign({}, this.resources.putAuthorizedHostProtocol);
        callOptions.body = mode;
        return callOptions;
    }
    /**
     * Get config format firmware version
     *
     * LWM2M path: /1024//18
     *
     * @tapVersion(">=")
     * @return
     */
    getConfigFormatFirmwareVersion() {
        return this.serviceCallRunner.execute(this.getConfigFormatFirmwareVersionCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//18
     *
     * @tapVersion(">=")
     * @return call options
     */
    getConfigFormatFirmwareVersionCall() {
        const callOptions = Object.assign({}, this.resources.getConfigFormatFirmwareVersion);
        return callOptions;
    }
    /**
     * Get configured universal link value
     *
     * LWM2M path: /1024//19
     *
     * @tapVersion(">=")
     * @return
     */
    getUniversalLink() {
        return this.serviceCallRunner.execute(this.getUniversalLinkCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//19
     *
     * @tapVersion(">=")
     * @return call options
     */
    getUniversalLinkCall() {
        const callOptions = Object.assign({}, this.resources.getUniversalLink);
        return callOptions;
    }
    /**
     * Write universal link value
     *
     * LWM2M path: /1024//19
     *
     * @tapVersion(">=")
     * @param url input
     * @return
     */
    putUniversalLink(
    /*
     *
     */
    url) {
        return this.serviceCallRunner.execute(this.putUniversalLinkCall(url));
    }
    /**
     *
     *
     * LWM2M path: /1024//19
     *
     * @tapVersion(">=")
     * @param url input
     * @return call options
     */
    putUniversalLinkCall(
    /*
     *
     */
    url) {
        const callOptions = Object.assign({}, this.resources.putUniversalLink);
        callOptions.body = url;
        return callOptions;
    }
    /**
     * Get available host protocols
     *
     * LWM2M path: /1024//21
     *
     * @tapVersion(">=")
     * @return
     */
    getAvailableHostProtocols() {
        return this.serviceCallRunner.execute(this.getAvailableHostProtocolsCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//21
     *
     * @tapVersion(">=")
     * @return call options
     */
    getAvailableHostProtocolsCall() {
        const callOptions = Object.assign({}, this.resources.getAvailableHostProtocols);
        return callOptions;
    }
    /**
     * Get currently disabled service list
     *
     * LWM2M path: /1024//75
     *
     * @tapVersion(">=1.107")
     * @return
     */
    getDisabledServices() {
        return this.serviceCallRunner.execute(this.getDisabledServicesCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//75
     *
     * @tapVersion(">=1.107")
     * @return call options
     */
    getDisabledServicesCall() {
        const callOptions = Object.assign({}, this.resources.getDisabledServices);
        return callOptions;
    }
    /**
     * Enable/disable execution of services
     *
     * LWM2M path: /1024//75
     *
     * @tapVersion(">=1.107")
     * @param serviceCodes input
     * @return
     */
    postDisabledServices(
    /*
     *
     */
    serviceCodes) {
        return this.serviceCallRunner.execute(this.postDisabledServicesCall(serviceCodes));
    }
    /**
     *
     *
     * LWM2M path: /1024//75
     *
     * @tapVersion(">=1.107")
     * @param serviceCodes input
     * @return call options
     */
    postDisabledServicesCall(
    /*
     *
     */
    serviceCodes) {
        const callOptions = Object.assign({}, this.resources.postDisabledServices);
        callOptions.body = serviceCodes;
        return callOptions;
    }
    /**
     * Get NFC connection priority over other protocols
     *
     * LWM2M path: /1024//24
     *
     * @tapVersion(">=1.85")
     * @return
     */
    getNfcConnectionPriority() {
        return this.serviceCallRunner.execute(this.getNfcConnectionPriorityCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//24
     *
     * @tapVersion(">=1.85")
     * @return call options
     */
    getNfcConnectionPriorityCall() {
        const callOptions = Object.assign({}, this.resources.getNfcConnectionPriority);
        return callOptions;
    }
    /**
     * Set NFC connection priority over other protocols (until reboot)
     *
     * LWM2M path: /1024//24
     *
     * @tapVersion(">=1.85")
     * @param key input
     * @return
     */
    postNfcConnectionPriority(
    /*
     *
     */
    key) {
        return this.serviceCallRunner.execute(this.postNfcConnectionPriorityCall(key));
    }
    /**
     *
     *
     * LWM2M path: /1024//24
     *
     * @tapVersion(">=1.85")
     * @param key input
     * @return call options
     */
    postNfcConnectionPriorityCall(
    /*
     *
     */
    key) {
        const callOptions = Object.assign({}, this.resources.postNfcConnectionPriority);
        callOptions.body = key;
        return callOptions;
    }
    /**
     * Write in configuration NFC connection priority over other protocols
     *
     * LWM2M path: /1024//24
     *
     * @tapVersion(">=1.85")
     * @param key input
     * @return
     */
    putNfcConnectionPriority(
    /*
     *
     */
    key) {
        return this.serviceCallRunner.execute(this.putNfcConnectionPriorityCall(key));
    }
    /**
     *
     *
     * LWM2M path: /1024//24
     *
     * @tapVersion(">=1.85")
     * @param key input
     * @return call options
     */
    putNfcConnectionPriorityCall(
    /*
     *
     */
    key) {
        const callOptions = Object.assign({}, this.resources.putNfcConnectionPriority);
        callOptions.body = key;
        return callOptions;
    }
    /**
     * Get profile id that will be logged in when starting an encrypted session with NFC
     *
     * LWM2M path: /1024//43
     *
     * @tapVersion(">=1.55")
     * @return
     */
    getNfcAutologProfileId() {
        return this.serviceCallRunner.execute(this.getNfcAutologProfileIdCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//43
     *
     * @tapVersion(">=1.55")
     * @return call options
     */
    getNfcAutologProfileIdCall() {
        const callOptions = Object.assign({}, this.resources.getNfcAutologProfileId);
        return callOptions;
    }
    /**
     * Write profile id
     *
     * LWM2M path: /1024//43
     *
     * @tapVersion(">=1.55")
     * @param value input
     * @return
     */
    putNfcAutologProfileId(
    /*
     *
     */
    value) {
        return this.serviceCallRunner.execute(this.putNfcAutologProfileIdCall(value));
    }
    /**
     *
     *
     * LWM2M path: /1024//43
     *
     * @tapVersion(">=1.55")
     * @param value input
     * @return call options
     */
    putNfcAutologProfileIdCall(
    /*
     *
     */
    value) {
        const callOptions = Object.assign({}, this.resources.putNfcAutologProfileId);
        callOptions.body = value;
        return callOptions;
    }
    /**
     * Get host inactivity period
     *
     * LWM2M path: /1024//34
     *
     * @tapVersion(">=")
     * @return
     */
    getHostInactivityPeriod() {
        return this.serviceCallRunner.execute(this.getHostInactivityPeriodCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//34
     *
     * @tapVersion(">=")
     * @return call options
     */
    getHostInactivityPeriodCall() {
        const callOptions = Object.assign({}, this.resources.getHostInactivityPeriod);
        return callOptions;
    }
    /**
     * Write host inactivity timeout
     *
     * LWM2M path: /1024//34
     *
     * @tapVersion(">=")
     * @param key input
     * @return
     */
    putHostInactivityPeriod(
    /*
     *
     */
    key) {
        return this.serviceCallRunner.execute(this.putHostInactivityPeriodCall(key));
    }
    /**
     *
     *
     * LWM2M path: /1024//34
     *
     * @tapVersion(">=")
     * @param key input
     * @return call options
     */
    putHostInactivityPeriodCall(
    /*
     *
     */
    key) {
        const callOptions = Object.assign({}, this.resources.putHostInactivityPeriod);
        callOptions.body = key;
        return callOptions;
    }
    /**
     * Get application data
     *
     * LWM2M path: /1024//36
     *
     * @tapVersion(">=")
     * @return
     */
    getApplicationData() {
        return this.serviceCallRunner.execute(this.getApplicationDataCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//36
     *
     * @tapVersion(">=")
     * @return call options
     */
    getApplicationDataCall() {
        const callOptions = Object.assign({}, this.resources.getApplicationData);
        return callOptions;
    }
    /**
     * Write custom application data
     *
     * LWM2M path: /1024//36
     *
     * @tapVersion(">=")
     * @param value input
     * @return
     */
    putApplicationData(
    /*
     *
     */
    value) {
        return this.serviceCallRunner.execute(this.putApplicationDataCall(value));
    }
    /**
     *
     *
     * LWM2M path: /1024//36
     *
     * @tapVersion(">=")
     * @param value input
     * @return call options
     */
    putApplicationDataCall(
    /*
     *
     */
    value) {
        const callOptions = Object.assign({}, this.resources.putApplicationData);
        callOptions.body = value;
        return callOptions;
    }
    /**
     * Get the Tap product key
     *
     * LWM2M path: /1024//60
     *
     * @tapVersion(">=")
     * @return
     */
    getProductKey() {
        return this.serviceCallRunner.execute(this.getProductKeyCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//60
     *
     * @tapVersion(">=")
     * @return call options
     */
    getProductKeyCall() {
        const callOptions = Object.assign({}, this.resources.getProductKey);
        return callOptions;
    }
    /**
     * Get max frame sizes for current host protocol
     *
     * LWM2M path: /1024//88
     *
     * @tapVersion(">=1.88")
     * @return
     */
    getCurrentHostProtocolMaxFrameSize() {
        return this.serviceCallRunner.execute(this.getCurrentHostProtocolMaxFrameSizeCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//88
     *
     * @tapVersion(">=1.88")
     * @return call options
     */
    getCurrentHostProtocolMaxFrameSizeCall() {
        const callOptions = Object.assign({}, this.resources.getCurrentHostProtocolMaxFrameSize);
        return callOptions;
    }
    /**
     * Execute multiple commands sent in one frame, and return all answers in one
     *
     * LWM2M path: /1024//89
     *
     * @tapVersion(">=1.13")
     * @param data input
     * @return
     */
    executeMultiRequestFrame(
    /*
     *
     */
    data) {
        return this.serviceCallRunner.execute(this.executeMultiRequestFrameCall(data));
    }
    /**
     *
     *
     * LWM2M path: /1024//89
     *
     * @tapVersion(">=1.13")
     * @param data input
     * @return call options
     */
    executeMultiRequestFrameCall(
    /*
     *
     */
    data) {
        const callOptions = Object.assign({}, this.resources.executeMultiRequestFrame);
        callOptions.body = data;
        return callOptions;
    }
    /**
     * Certificate data in PEM format for SSL mutual authentication, default is NULL
     *
     * LWM2M path: /1024//37
     *
     * @tapVersion(">=1.86")
     * @param value input
     * @return
     */
    putCertificatePublicKey(
    /*
     * Up to 16kB
     */
    value) {
        return this.serviceCallRunner.execute(this.putCertificatePublicKeyCall(value));
    }
    putCertificatePublicKeyAppendCalls(
    /*
     * Up to 16kB
     */
    value, chunkSize) {
        return this.serviceCallRunner.createAppendCalls(this.putCertificatePublicKeyCall(value), chunkSize);
    }
    /**
     *
     *
     * LWM2M path: /1024//37
     *
     * @tapVersion(">=1.86")
     * @param value input
     * @return call options
     */
    putCertificatePublicKeyCall(
    /*
     * Up to 16kB
     */
    value) {
        const callOptions = Object.assign({}, this.resources.putCertificatePublicKey);
        callOptions.body = value;
        return callOptions;
    }
    /**
     * private key data in PEM format for SSL mutual authentication, default is NULL
     *
     * LWM2M path: /1024//38
     *
     * @tapVersion(">=1.86")
     * @param value input
     * @return
     */
    putCertificatePrivateKey(
    /*
     * Up to 16kB
     */
    value) {
        return this.serviceCallRunner.execute(this.putCertificatePrivateKeyCall(value));
    }
    putCertificatePrivateKeyAppendCalls(
    /*
     * Up to 16kB
     */
    value, chunkSize) {
        return this.serviceCallRunner.createAppendCalls(this.putCertificatePrivateKeyCall(value), chunkSize);
    }
    /**
     *
     *
     * LWM2M path: /1024//38
     *
     * @tapVersion(">=1.86")
     * @param value input
     * @return call options
     */
    putCertificatePrivateKeyCall(
    /*
     * Up to 16kB
     */
    value) {
        const callOptions = Object.assign({}, this.resources.putCertificatePrivateKey);
        callOptions.body = value;
        return callOptions;
    }
    /**
     * Public key certificate that identifies a root certificate authority (CA), default is NULL
     *
     * LWM2M path: /1024//39
     *
     * @tapVersion(">=1.86")
     * @param value input
     * @return
     */
    putCertificateRootKey(
    /*
     * Up to 16kB
     */
    value) {
        return this.serviceCallRunner.execute(this.putCertificateRootKeyCall(value));
    }
    putCertificateRootKeyAppendCalls(
    /*
     * Up to 16kB
     */
    value, chunkSize) {
        return this.serviceCallRunner.createAppendCalls(this.putCertificateRootKeyCall(value), chunkSize);
    }
    /**
     *
     *
     * LWM2M path: /1024//39
     *
     * @tapVersion(">=1.86")
     * @param value input
     * @return call options
     */
    putCertificateRootKeyCall(
    /*
     * Up to 16kB
     */
    value) {
        const callOptions = Object.assign({}, this.resources.putCertificateRootKey);
        callOptions.body = value;
        return callOptions;
    }
    /**
     * Get product code
     *
     * LWM2M path: /1024//84
     *
     * @tapVersion(">=1.113")
     * @return
     */
    getProductCode() {
        return this.serviceCallRunner.execute(this.getProductCodeCall());
    }
    /**
     *
     *
     * LWM2M path: /1024//84
     *
     * @tapVersion(">=1.113")
     * @return call options
     */
    getProductCodeCall() {
        const callOptions = Object.assign({}, this.resources.getProductCode);
        return callOptions;
    }
    /**
     * Put product code
     *
     * LWM2M path: /1024//84
     *
     * @tapVersion(">=1.113")
     * @param topic input
     * @return
     */
    putProductCode(
    /*
     *
     */
    topic) {
        return this.serviceCallRunner.execute(this.putProductCodeCall(topic));
    }
    /**
     *
     *
     * LWM2M path: /1024//84
     *
     * @tapVersion(">=1.113")
     * @param topic input
     * @return call options
     */
    putProductCodeCall(
    /*
     *
     */
    topic) {
        const callOptions = Object.assign({}, this.resources.putProductCode);
        callOptions.body = topic;
        return callOptions;
    }
    /**
     * Get bundle id that have the special feature. Si non définit, retourne 0x0
     *
     * LWM2M path: /1024//{featureId}
     *
     * @tapVersion(">=1.23")
     * @param featureId input
     * @return
     */
    getSpecialFeatureProfile(
    /*
     *
     */
    featureId) {
        return this.serviceCallRunner.execute(this.getSpecialFeatureProfileCall(featureId));
    }
    /**
     *
     *
     * LWM2M path: /1024//{featureId}
     *
     * @tapVersion(">=1.23")
     * @param featureId input
     * @return call options
     */
    getSpecialFeatureProfileCall(
    /*
     *
     */
    featureId) {
        const callOptions = Object.assign({}, this.resources.getSpecialFeatureProfile);
        callOptions.pathParameters = {
            featureId: featureId,
        };
        return callOptions;
    }
    /**
     * Set bundle id that own the special feature
     *
     * LWM2M path: /1024//{featureId}
     *
     * @tapVersion(">=1.23")
     * @param featureId input
     * @param value input
     * @return
     */
    setSpecialFeatureProfile(
    /*
     *
     */
    featureId, 
    /*
     * Profile id
     */
    value) {
        return this.serviceCallRunner.execute(this.setSpecialFeatureProfileCall(featureId, value));
    }
    /**
     *
     *
     * LWM2M path: /1024//{featureId}
     *
     * @tapVersion(">=1.23")
     * @param featureId input
     * @param value input
     * @return call options
     */
    setSpecialFeatureProfileCall(
    /*
     *
     */
    featureId, 
    /*
     * Profile id
     */
    value) {
        const callOptions = Object.assign({}, this.resources.setSpecialFeatureProfile);
        callOptions.body = value;
        callOptions.pathParameters = {
            featureId: featureId,
        };
        return callOptions;
    }
    /**
     * Write bundle id that own the special feature
     *
     * LWM2M path: /1024//{featureId}
     *
     * @tapVersion(">=1.23")
     * @param featureId input
     * @param value input
     * @return
     */
    putSpecialFeatureProfile(
    /*
     *
     */
    featureId, 
    /*
     * Profile id
     */
    value) {
        return this.serviceCallRunner.execute(this.putSpecialFeatureProfileCall(featureId, value));
    }
    /**
     *
     *
     * LWM2M path: /1024//{featureId}
     *
     * @tapVersion(">=1.23")
     * @param featureId input
     * @param value input
     * @return call options
     */
    putSpecialFeatureProfileCall(
    /*
     *
     */
    featureId, 
    /*
     * Profile id
     */
    value) {
        const callOptions = Object.assign({}, this.resources.putSpecialFeatureProfile);
        callOptions.body = value;
        callOptions.pathParameters = {
            featureId: featureId,
        };
        return callOptions;
    }
}

var __awaiter$1 = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
InterfaceService.prototype.getAppUrl = function () {
    return __awaiter$1(this, void 0, void 0, function* () {
        const appPath = yield this.getAppPath();
        if (appPath.isSuccessful()) {
            let body = appPath.body();
            if (body.match(/^\$[1-6]\//)) {
                const code = body.substring(0, 3);
                const content = body.substring(3);
                switch (code) {
                    case '$1/':
                        body = `https://user.cloud.iotize.com/users/${content}`;
                        break;
                    case '$2/':
                        body = `http://${content}`;
                        break;
                    case '$5/':
                        body = `https://user.cloud.iotize.com/users/${content}`;
                        break;
                    default:
                        body = '';
                }
                appPath.setBody(body);
            }
        }
        return appPath;
    });
};
InterfaceService.prototype.getAndroidApplicationId = function () {
    return __awaiter$1(this, void 0, void 0, function* () {
        const appPath = yield this.getAppPath();
        if (appPath.isSuccessful()) {
            const body = appPath.body();
            if (body.startsWith('$4/')) {
                // TODO replace with constant
                appPath.setBody(body.substring(3));
            }
            else {
                appPath.setBody('');
            }
        }
        return appPath;
    });
};
InterfaceService.prototype.putAndroidApplicationId = function (value) {
    return __awaiter$1(this, void 0, void 0, function* () {
        return this.putAppPath(`$4/${value}`);
    });
};

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
// type ExecuteMultipleCallsParameterType<BodyType, ReturnType> = ExecuteMutlipleCallItem<>[];
const TAP_REQUEST_FRAME_HEADER_LENGTH = 7; // TODO generated instead
function toBodyDecoder(input) {
    if (typeof input === 'function') {
        return {
            decode: input,
        };
    }
    else {
        return input;
    }
}
function toCall(serviceCall) {
    if ('expectedResponseStatus' in serviceCall) {
        return serviceCall.call;
    }
    else {
        return serviceCall;
    }
}
InterfaceService.prototype.executeMultipleCalls = function (calls, defaultExpectedResponseStatus = MultiRequestFrame
    .ExpectedResponseStatus.ANYTHING) {
    return __awaiter(this, void 0, void 0, function* () {
        const decoders = calls.map((serviceCall) => toBodyDecoder(toCall(serviceCall).responseBodyDecoder));
        const multiRequestRequests = createMultiRequestItems(calls, defaultExpectedResponseStatus);
        const multiRequestFrame = {
            requests: multiRequestRequests.map((item) => item.requestItem),
        };
        const response = yield this.executeMultiRequestFrame(multiRequestFrame);
        const body = response.body();
        if (body.responses.length !== calls.length) {
            throw new Error(`API sent ${calls.length} request(s) but tap responded with ${body.responses.length} response(s).`);
        }
        const responses = body.responses.map((tapResponseItem, index) => {
            const response = new TapResponse(tapResponseItem.response);
            const decoder = decoders[index];
            if (decoder) {
                response.setBodyDecoder(decoder);
            }
            response.setRequest(multiRequestRequests[index].requestItem.request);
            if (!response.isSuccessful()) {
                response.setError(TapError.reponseStatusError(response, toCall(calls[index])));
            }
            return response;
        });
        return responses;
    });
};
function createMultiRequestItems(calls, defaultExpectedResponseStatus = MultiRequestFrame
    .ExpectedResponseStatus.ANYTHING) {
    return calls.map((serviceCall) => {
        let call;
        let expectedResponseStatus;
        if ('expectedResponseStatus' in serviceCall) {
            call = serviceCall.call;
            expectedResponseStatus = serviceCall.expectedResponseStatus;
        }
        else {
            call = serviceCall;
            expectedResponseStatus = defaultExpectedResponseStatus;
        }
        const request = ServiceCallRunner.toTapRequest(call);
        const responseBodyDecoder = ServiceCallRunner.resolveResponseBodyDecoder(call);
        return {
            requestItem: {
                expectedResponseStatus,
                request,
                requestLen: request.payload.length + TAP_REQUEST_FRAME_HEADER_LENGTH,
            },
            responseBodyDecoder,
        };
    });
}

const _TAP_SERVICE_EXTENSION_INTERFACE_ = extendServiceContainer('interface', InterfaceService);

// export {
//     createMultiRequestItems
// } from './lib/custom/multi-request-interface-service-extension';

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

export { SERVICE_CALLS as INTERFACE_SERVICE_CALLS, InterfaceService, LoginCredentialConverter, LoginCredentialHashedConverter, LowPowerOptimizationLevel, MultiRequestFrame, MultiRequestFrameConverter, MultiResponseFrameConverter, NfcConnectionPriority, NfcPairingMode, ProtocolMaxFrameSizeConverter, SecurityOptionsConverter, ServiceCode, WirelessPairingOptions, WirelessPairingOptionsConverter, _TAP_SERVICE_EXTENSION_INTERFACE_, serviceConverters as interfaceConverters };
//# sourceMappingURL=iotize-tap-service-impl-interface.js.map
