import { CodeError } from '@iotize/common/error';
export class TapDataError extends CodeError {
    constructor(msg, code, cause) {
        super(msg, code);
        this.cause = cause;
    }
    static unexpectedEncodedValueError(variable, rawData, err) {
        return new TapDataError(`An error occured while encoding value for variable ${variable.id}. ${err.message}`, TapDataError.Code.UnexpectedEncodedValueError);
    }
    static unexpectedVariableDataRead(variable, rawData, err) {
        return new TapDataError(`An error occured while decoding value for variable ${variable.id}. ${err.message}`, TapDataError.Code.UnexpectedVariableData);
    }
    static bundleNotFound(key) {
        return new TapDataError(`Bundle with identifier "${key.toString()}" is not registered`, TapDataError.Code.BundleNotFound);
    }
    static variableNotFound(key) {
        return new TapDataError(`Variable with identifier "${key.toString()}" is not registered`, TapDataError.Code.BundleNotFound);
    }
    static bundleNotConfigured(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);
    }
    static variableNotConfigured(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);
    }
}
(function (TapDataError) {
    let 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwLWRhdGEtZXJyb3IuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaW90aXplL3RhcC9kYXRhLyIsInNvdXJjZXMiOlsibGliL3RhcC1kYXRhLWVycm9yLnRzIl0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