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

//#region src/schemas/discussion.schema.ts
const discussionSchema = new mongoose.Schema({
	discussionId: {
		type: String,
		required: true,
		unique: true
	},
	messages: [{
		role: {
			type: String,
			required: true,
			enum: [
				"user",
				"assistant",
				"system"
			]
		},
		content: {
			type: String,
			required: true
		},
		timestamp: {
			type: Date,
			default: Date.now
		},
		relatedFiles: { type: [String] }
	}],
	userId: {
		type: mongoose.Schema.Types.ObjectId,
		ref: "user",
		required: true
	},
	projectId: {
		type: mongoose.Schema.Types.ObjectId,
		ref: "project",
		required: true
	},
	organizationId: {
		type: mongoose.Schema.Types.ObjectId,
		ref: "organization",
		required: true
	},
	title: {
		type: String,
		required: false
	},
	isArchived: {
		type: Boolean,
		default: false
	}
}, {
	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.discussionSchema = discussionSchema;
//# sourceMappingURL=discussion.schema.cjs.map