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 TapDataError = /** @class */ (function (_super) {
    __extends(TapDataError, _super);
    function TapDataError(msg, code, cause) {
        var _this = _super.call(this, msg, code) || this;
        _this.cause = cause;
        return _this;
    }
    TapDataError.unexpectedEncodedValueError = function (variable, rawData, err) {
        return new TapDataError("An error occured while encoding value for variable " + variable.id + ". " + err.message, TapDataError.Code.UnexpectedEncodedValueError);
    };
    TapDataError.unexpectedVariableDataRead = function (variable, rawData, err) {
        return new TapDataError("An error occured while decoding value for variable " + variable.id + ". " + err.message, TapDataError.Code.UnexpectedVariableData);
    };
    TapDataError.bundleNotFound = function (key) {
        return new TapDataError("Bundle with identifier \"" + key.toString() + "\" is not registered", TapDataError.Code.BundleNotFound);
    };
    TapDataError.variableNotFound = function (key) {
        return new TapDataError("Variable with identifier \"" + key.toString() + "\" is not registered", TapDataError.Code.BundleNotFound);
    };
    TapDataError.bundleNotConfigured = function (config, err) {
        return new TapDataError("Bundle with id \"" + config.id + "\" does not exist on this Tap. You should reconfigure your Tap to add this bundle.", TapDataError.Code.BundleNotConfigured, err);
    };
    TapDataError.variableNotConfigured = function (config, err) {
        return new TapDataError("Variable with id \"" + config.id + "\" does not exist on this Tap. You should reconfigure your Tap to add this variable.", TapDataError.Code.VariableNotConfigured, err);
    };
    return TapDataError;
}(CodeError));
export { TapDataError };
(function (TapDataError) {
    var Code;
    (function (Code) {
        Code["UnexpectedVariableData"] = "TapDataErrorUnexpectedVariableData";
        Code["UnexpectedEncodedValueError"] = "TapDataErrorUnexpectedEncodedValueError";
        Code["BundleNotFound"] = "TapDataErrorBundleNotFound";
        Code["VariableNotFound"] = "TapDataErrorVariableNotFound";
        Code["BundleNotConfigured"] = "TapDataErrorBundleNotConfigured";
        Code["VariableNotConfigured"] = "TapDataErrorVariableNotConfigured";
    })(Code = TapDataError.Code || (TapDataError.Code = {}));
})(TapDataError || (TapDataError = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwLWRhdGEtZXJyb3IuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaW90aXplL3RhcC9kYXRhLyIsInNvdXJjZXMiOlsibGliL3RhcC1kYXRhLWVycm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFPakQ7SUFBa0MsZ0NBQTRCO0lBQzFELHNCQUFZLEdBQVcsRUFBRSxJQUF1QixFQUFTLEtBQWE7UUFBdEUsWUFDSSxrQkFBTSxHQUFHLEVBQUUsSUFBSSxDQUFDLFNBQ25CO1FBRndELFdBQUssR0FBTCxLQUFLLENBQVE7O0lBRXRFLENBQUM7SUFFTSx3Q0FBMkIsR0FBbEMsVUFBbUMsUUFBb0QsRUFBRSxPQUFZLEVBQUUsR0FBVTtRQUM3RyxPQUFPLElBQUksWUFBWSxDQUNuQix3REFBc0QsUUFBUSxDQUFDLEVBQUUsVUFBSyxHQUFHLENBQUMsT0FBUyxFQUNuRixZQUFZLENBQUMsSUFBSSxDQUFDLDJCQUEyQixDQUNoRCxDQUFDO0lBQ04sQ0FBQztJQUVNLHVDQUEwQixHQUFqQyxVQUFrQyxRQUFvRCxFQUFFLE9BQVksRUFBRSxHQUFVO1FBQzVHLE9BQU8sSUFBSSxZQUFZLENBQ25CLHdEQUFzRCxRQUFRLENBQUMsRUFBRSxVQUFLLEdBQUcsQ0FBQyxPQUFTLEVBQ25GLFl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