import { Schema } from "mongoose";

//#region src/schemas/audit.schema.ts
const auditSchema = new Schema({
	url: {
		type: String,
		required: true
	},
	summary: {
		type: Schema.Types.Mixed,
		required: true
	},
	errors: {
		type: Schema.Types.Mixed,
		required: true,
		default: {}
	},
	score: {
		type: Number,
		required: true
	},
	label: {
		type: String,
		required: true
	},
	userId: {
		type: Schema.Types.ObjectId,
		ref: "User",
		required: false
	},
	projectId: {
		type: Schema.Types.ObjectId,
		ref: "Project",
		required: 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
export { auditSchema };
//# sourceMappingURL=audit.schema.mjs.map