

import { __decorateMetadata } from "../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.mjs";
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.mjs";
import { JsonTransformer } from "../utils/JsonTransformer.mjs";
import { Metadata } from "./Metadata.mjs";
import { DateTransformer, MetadataTransformer } from "../utils/transformers.mjs";
import { Exclude } from "class-transformer";

//#region src/storage/BaseRecord.ts
var _ref, _ref2, _ref3;
var BaseRecord = class BaseRecord {
	constructor() {
		this._tags = {};
		this.type = BaseRecord.type;
		this.allowCache = BaseRecord.allowCache;
		this.metadata = new Metadata({});
	}
	/**
	* Set the value for a tag
	* @param name name of the tag
	* @param value value of the tag
	*/
	setTag(name, value) {
		this._tags[name] = value;
	}
	/**
	* Get the value for a tag
	* @param name name of the tag
	* @returns The tag value, or undefined if not found
	*/
	getTag(name) {
		return this.getTags()[name];
	}
	/**
	* Set custom tags. This will merge the tags object with passed in tag properties
	*
	* @param tags the tags to set
	*/
	setTags(tags) {
		this._tags = {
			...this._tags,
			...tags
		};
	}
	/**
	* Replace tags. This will replace the whole tags object.
	* Default tags will still be overridden when retrieving tags
	*
	* @param tags the tags to set
	*/
	replaceTags(tags) {
		this._tags = tags;
	}
	toJSON() {
		return JsonTransformer.toJSON(this);
	}
	/**
	* Clones the record.
	*/
	clone() {
		return JsonTransformer.clone(this);
	}
};
BaseRecord.type = "BaseRecord";
BaseRecord.allowCache = false;
__decorate([DateTransformer(), __decorateMetadata("design:type", typeof (_ref = typeof Date !== "undefined" && Date) === "function" ? _ref : Object)], BaseRecord.prototype, "createdAt", void 0);
__decorate([DateTransformer(), __decorateMetadata("design:type", typeof (_ref2 = typeof Date !== "undefined" && Date) === "function" ? _ref2 : Object)], BaseRecord.prototype, "updatedAt", void 0);
__decorate([Exclude(), __decorateMetadata("design:type", Object)], BaseRecord.prototype, "type", void 0);
__decorate([Exclude(), __decorateMetadata("design:type", Object)], BaseRecord.prototype, "allowCache", void 0);
__decorate([MetadataTransformer(), __decorateMetadata("design:type", typeof (_ref3 = typeof Metadata !== "undefined" && Metadata) === "function" ? _ref3 : Object)], BaseRecord.prototype, "metadata", void 0);

//#endregion
export { BaseRecord };
//# sourceMappingURL=BaseRecord.mjs.map