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 { IsValidMessageType, parseMessageType } from "../../../util/messageType.mjs";
import { DidCommMessage } from "../../../DidCommMessage.mjs";
import { DateParser } from "../../../util/transformers.mjs";
import { Expose, Transform } from "class-transformer";
import { IsDate, IsString } from "class-validator";

//#region ../didcomm/src/modules/basic-messages/messages/DidCommBasicMessage.ts
var _ref;
var DidCommBasicMessage = class DidCommBasicMessage extends DidCommMessage {
	/**
	* Create new DidCommBasicMessage instance.
	* sentTime will be assigned to new Date if not passed, id will be assigned to uuid/v4 if not passed
	* @param options
	*/
	constructor(options) {
		super();
		this.allowDidSovPrefix = true;
		this.type = DidCommBasicMessage.type.messageTypeUri;
		if (options) {
			this.id = options.id || this.generateId();
			this.sentTime = options.sentTime || /* @__PURE__ */ new Date();
			this.content = options.content;
			this.addLocale(options.locale || "en");
		}
	}
};
DidCommBasicMessage.type = parseMessageType("https://didcomm.org/basicmessage/1.0/message");
__decorate([IsValidMessageType(DidCommBasicMessage.type), __decorateMetadata("design:type", Object)], DidCommBasicMessage.prototype, "type", void 0);
__decorate([
	Expose({ name: "sent_time" }),
	Transform(({ value }) => DateParser(value)),
	IsDate(),
	__decorateMetadata("design:type", typeof (_ref = typeof Date !== "undefined" && Date) === "function" ? _ref : Object)
], DidCommBasicMessage.prototype, "sentTime", void 0);
__decorate([
	Expose({ name: "content" }),
	IsString(),
	__decorateMetadata("design:type", String)
], DidCommBasicMessage.prototype, "content", void 0);

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