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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmaW5pdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zZXJ2aW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