import mongoose, { Schema, Document } from 'mongoose'; export interface IProject extends Document { name: string; client: string; startDate?: Date | null; endDate?: Date | null; technician?: string | null; environment?: string | null; organizationId?: string; weightKg?: number | null; status: 'active' | 'archived'; createdAt: Date; updatedAt: Date; } const ProjectSchema: Schema = new Schema({ name: { type: String, required: true }, client: { type: String, required: true }, organizationId: { type: String, index: true }, startDate: { type: Date }, endDate: { type: Date }, technician: { type: String }, environment: { type: String }, weightKg: { type: Number }, status: { type: String, enum: ['active', 'archived'], default: 'active', index: true }, }, { timestamps: true }); export default mongoose.models.Project || mongoose.model('Project', ProjectSchema);