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 DataLoggerError = /** @class */ (function (_super) {
    __extends(DataLoggerError, _super);
    function DataLoggerError(code, msg, cause) {
        var _this = _super.call(this, msg, code) || this;
        _this.cause = cause;
        return _this;
    }
    DataLoggerError.decodePacketError = function (singlePacket, cause) {
        return new DataLoggerError.CannotDecodePacketError(singlePacket, cause);
    };
    DataLoggerError.notAuthorizedToPerformAction = function (msg, cause) {
        return new DataLoggerError(DataLoggerError.Code.ActionUnauthorizedError, msg, cause);
    };
    return DataLoggerError;
}(CodeError));
export { DataLoggerError };
(function (DataLoggerError) {
    var CannotDecodePacketError = /** @class */ (function (_super) {
        __extends(CannotDecodePacketError, _super);
        function CannotDecodePacketError(singlePacket, cause) {
            var _this = _super.call(this, Code.DecodePacketError, "Cannot parse data log packet. Error: " + cause.message, cause) || this;
            _this.singlePacket = singlePacket;
            return _this;
        }
        return CannotDecodePacketError;
    }(DataLoggerError));
    DataLoggerError.CannotDecodePacketError = CannotDecodePacketError;
    var Code;
    (function (Code) {
        Code["DecodePacketError"] = "DataLoggerErrorDecodePacket";
        Code["ActionUnauthorizedError"] = "DataLoggerErrorActionUnauthorized";
    })(Code = DataLoggerError.Code || (DataLoggerError.Code = {}));
})(DataLoggerError || (DataLoggerError = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGlvdGl6ZS90YXAvZGF0YS1sb2cvIiwic291cmNlcyI6WyJsaWIv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