const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
const require_utils_validation_validateTag = require('../utils/validation/validateTag.cjs');
let mongoose = require("mongoose");
mongoose = require_rolldown_runtime.__toESM(mongoose);

//#region src/schemas/tag.schema.ts
const tagSchema = new mongoose.Schema({
	organizationId: {
		type: mongoose.Schema.Types.ObjectId,
		ref: "Organization",
		required: true
	},
	projectId: {
		type: mongoose.Schema.Types.ObjectId,
		ref: "Project",
		required: true
	},
	key: {
		type: String,
		required: true,
		minlength: require_utils_validation_validateTag.KEY_MIN_LENGTH,
		maxlength: require_utils_validation_validateTag.KEY_MAX_LENGTH
	},
	name: {
		type: String,
		minlength: require_utils_validation_validateTag.NAME_MIN_LENGTH,
		maxlength: require_utils_validation_validateTag.NAME_MAX_LENGTH
	},
	description: { type: String },
	instructions: { type: String },
	creatorId: {
		type: mongoose.Schema.Types.ObjectId,
		ref: "User",
		required: true
	}
}, {
	timestamps: true,
	toJSON: {
		virtuals: true,
		versionKey: false,
		transform(_doc, ret) {
			const { _id,...rest } = ret;
			return {
				...rest,
				id: _id.toString()
			};
		}
	},
	toObject: {
		virtuals: true,
		transform(_doc, ret) {
			const { _id,...rest } = ret;
			return {
				...rest,
				id: _id
			};
		}
	}
});

//#endregion
exports.tagSchema = tagSchema;
//# sourceMappingURL=tag.schema.cjs.map