import mongoose from "mongoose";

const TeamMemberSchema = new mongoose.Schema(
  {
    name: { type: String, required: true, trim: true },
    role: { type: String, required: true, trim: true },
    phd: { type: String, trim: true }, // Description/expertise area
    img: { type: String, required: true, trim: true }, // Image URL (Cloudinary or local path)
    category: { type: String, required: true, enum: ["Leadership", "Core Team"], default: "Core Team" },
    order: { type: Number, default: 0 }, // For custom sorting
    status: { type: String, enum: ["Active", "Inactive"], default: "Active" },
  },
  { timestamps: true }
);

TeamMemberSchema.index({ category: 1, order: 1 });
TeamMemberSchema.index({ createdAt: -1 });

const TeamMemberModel = mongoose.models.TeamMember || mongoose.model("TeamMember", TeamMemberSchema);

export { TeamMemberModel };

