import mongoose, { Document, Schema } from 'mongoose';

export interface ITestimonial extends Document {
  quote: string;
  rating: number;
  authorName: string;
  role: string;
  doctorId: mongoose.Types.ObjectId;
  approved: boolean;
  createdAt: Date;
  updatedAt: Date;
}

const testimonialSchema = new Schema<ITestimonial>(
  {
    quote: { type: String, required: true, trim: true },
    rating: { type: Number, required: true, min: 1, max: 5, default: 5 },
    authorName: { type: String, required: true, trim: true },
    role: { type: String, required: true, trim: true },
    doctorId: { type: Schema.Types.ObjectId, ref: 'User', required: true },
    approved: { type: Boolean, default: true },
  },
  { timestamps: true }
);

export default mongoose.model<ITestimonial>('Testimonial', testimonialSchema);
