import mongoose from "mongoose";

const carSchema = new mongoose.Schema({
  plateNumber: {
    type: String,
    required: true,
    unique: true,
    uppercase: true,
    trim: true
  },
  brand: {
    type: String,
    required: true,
    trim: true
  },
  model: {
    type: String,
    required: true,
    trim: true
  },
  year: {
    type: Number,
    required: true
  },
  color: {
    type: String,
    required: true,
    trim: true
  },
  dailyRate: {
    type: Number,
    required: true,
    min: 0
  },
  image: {
    type: String,
    default: ""
  },
  status: {
    type: String,
    enum: ["available", "rented", "maintenance"],
    default: "available"
  }
}, {
  timestamps: true
});

const Car = mongoose.model("Car", carSchema);

export default Car;