var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { CodeError } from '@iotize/common/error';
var SinglePacketError = /** @class */ (function (_super) {
    __extends(SinglePacketError, _super);
    function SinglePacketError(code, msg) {
        return _super.call(this, msg, code) || this;
    }
    SinglePacketError.authSessionRequiredToEncryptSinglePacket = function () {
        return new SinglePacketError(SinglePacketError.Code.AuthSessionRequiredToEncryptSinglePacket, "A valid authenticated Tap session is required to encrypt single packet");
    };
    SinglePacketError.credentialsRequiredForEncryptedSinglePacket = function () {
        return new SinglePacketError(SinglePacketError.Code.CredentialsRequiredForEncryptedSinglePacket, "Single packet encryption is enabled, you need to provid encryption credentials");
    };
    SinglePacketError.internalError = function (msg) {
        return new SinglePacketError(SinglePacketError.Code.SinglePacketInternalError, "Single packet related internal error: " + msg);
    };
    SinglePacketError.maxSinglePacketPartSizeExceeded = function (packet, max) {
        return new SinglePacketError(SinglePacketError.Code.MaxSinglePacketPartSizeExceeded, "Single packet part size of " + packet.data.length + " bytes is above single packet maximum size of " + max + " bytes");
    };
    SinglePacketError.maxSinglePacketSizeExceeded = function (length, max) {
        return new SinglePacketError(SinglePacketError.Code.MaxSinglePacketSizeExceeded, "Single packet size of " + length + " bytes is above single packet maximum size of " + max + " bytes");
    };
    return SinglePacketError;
}(CodeError));
export { SinglePacketError };
(function (SinglePacketError) {
    var Code;
    (function (Code) {
        Code["SinglePacketInternalError"] = "SinglePacketErrorInternalError";
        Code["AuthSessionRequiredToEncryptSinglePacket"] = "SinglePacketErrorAuthSessionRequiredToEncryptSinglePacket";
        Code["MaxSinglePacketPartSizeExceeded"] = "SinglePacketErrorMaxSinglePacketPartSizeExceeded";
        Code["MaxSinglePacketSizeExceeded"] = "SinglePacketErrorMaxSinglePacketSizeExceeded";
        Code["CredentialsRequiredForEncryptedSinglePacket"] = "SinglePacketErrorCredentialsRequiredForEncryptedSinglePacket";
    })(Code = SinglePacketError.Code || (SinglePacketError.Code = {}));
})(SinglePacketError || (SinglePacketError = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmaW5pdGlvbnMuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaW90aXplL3RhcC9zZXJ2aWNlL2ltcGwvc2luZ2xlLXBhY2tldC8iLCJzb3VyY2VzIjpbImxpYi9jdXN0b20vZGVmaW5pdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQWlCakQ7SUFBdUMscUNBQWlDO0lBRXBFLDJCQUFZLElBQTRCLEVBQUUsR0FBVztlQUNqRCxrQkFBTSxHQUFHLEVBQUUsSUFBSSxDQUFDO0lBQ3BCLENBQUM7SUFFTSwwREFBd0MsR0FBL0M7UUFDSSxPQUFPLElBQUksaUJBQWlCLENBQ3hCLGlCQUFpQixDQUFDLElBQUksQ0FBQyx3Q0FBd0MsRUFDL0Qsd0VBQXdFLENBQzNFLENBQUM7SUFDTixDQUFDO0lBQ00sNkRBQTJDLEdBQWxEO1FBQ0ksT0FBTyxJQUFJLGlCQUFpQixDQUN4QixpQkFBaUIsQ0FBQyxJQUFJLENBQUMsMkNBQTJDLEVBQ2xFLGdGQUFnRixDQUNuRixDQUFDO0lBQ04sQ0FBQztJQUVNLCtCQUFhLEdBQXBCLFVBQXFCLEdBQVc7UUFDNUIsT0FBTyxJQUFJLGlCQUFpQixDQUN4QixpQkFBaUIsQ0FBQyxJQUFJLENBQUMseUJBQXlCLEVBQ2hELDJD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