const mongoose = require("mongoose");

const carSchema = new mongoose.Schema(
  {
    userId: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User",
      required: true,
      index: true,
    },
    carNumber: { type: String, trim: true },
    plateNumber: { type: String, trim: true },
    type: { type: String, required: true, trim: true },
    model: { type: String, required: true, trim: true },
    manufacturingYear: { type: Number, required: true, min: 1900, max: 2100 },
    driverPhone: { type: String, required: true, trim: true },
    mechanicName: { type: String, required: true, trim: true },
  },
  { timestamps: true }
);


module.exports = mongoose.model("Car", carSchema);
