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

export interface IDoctor extends Document {
  userId: Types.ObjectId; // Reference to User collection
  isDentist: boolean;
  specialization?: string;
  licenseNumber?: string;
  logoUrl?: string;
  signatureUrl?: string;
  createdAt: Date;
}

const doctorSchema = new Schema<IDoctor>({
  userId: {
    type: Schema.Types.ObjectId,
    ref: 'User',
    required: true,
    unique: true
  },
  isDentist: {
    type: Boolean,
    default: false
  },
  licenseNumber: {
    type: String,
    unique: true,
    sparse: true
  },
  specialization: String,
  logoUrl: String,
  signatureUrl: String,
  createdAt: {
    type: Date,
    default: Date.now
  }
});

export default mongoose.model<IDoctor>('Doctor', doctorSchema);
