import { CodeError } from '@iotize/common/error';
export class SinglePacketError extends CodeError {
    constructor(code, msg) {
        super(msg, code);
    }
    static authSessionRequiredToEncryptSinglePacket() {
        return new SinglePacketError(SinglePacketError.Code.AuthSessionRequiredToEncryptSinglePacket, `A valid authenticated Tap session is required to encrypt single packet`);
    }
    static credentialsRequiredForEncryptedSinglePacket() {
        return new SinglePacketError(SinglePacketError.Code.CredentialsRequiredForEncryptedSinglePacket, `Single packet encryption is enabled, you need to provid encryption credentials`);
    }
    static internalError(msg) {
        return new SinglePacketError(SinglePacketError.Code.SinglePacketInternalError, `Single packet related internal error: ${msg}`);
    }
    static maxSinglePacketPartSizeExceeded(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`);
    }
    static maxSinglePacketSizeExceeded(length, max) {
        return new SinglePacketError(SinglePacketError.Code.MaxSinglePacketSizeExceeded, `Single packet size of ${length} bytes is above single packet maximum size of ${max} bytes`);
    }
}
(function (SinglePacketError) {
    let 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmaW5pdGlvbnMuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaW90aXplL3RhcC9zZXJ2aWNlL2ltcGwvc2luZ2xlLXBhY2tldC8iL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