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

//#region src/schemas/dictionary.schema.ts
const versionedContentElSchema = new mongoose.Schema({
	name: { type: String },
	description: { type: String },
	content: {
		type: mongoose.Schema.Types.Mixed,
		required: true
	}
}, { timestamps: true });
const dictionarySchema = new mongoose.Schema({
	projectIds: {
		type: [mongoose.Schema.Types.ObjectId],
		ref: "Project",
		required: true
	},
	key: {
		type: String,
		required: true
	},
	title: {
		type: String,
		default: ""
	},
	description: {
		type: String,
		default: ""
	},
	tags: {
		type: [String],
		default: []
	},
	content: {
		type: Map,
		of: versionedContentElSchema,
		required: true,
		default: null
	},
	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.dictionarySchema = dictionarySchema;
//# sourceMappingURL=dictionary.schema.cjs.map