const mongoose = require("mongoose");

const serviceRecordSchema = new mongoose.Schema(
  {
    userId: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User",
      required: true,
      index: true,
    },
    recordNumber: { type: String, required: true, unique: true, trim: true },
    serviceDate: { type: Date, required: true },
    car: { type: mongoose.Schema.Types.ObjectId, ref: "Car", required: true },
    service: { type: mongoose.Schema.Types.ObjectId, ref: "Service", required: true },
  },
  { timestamps: true }
);


module.exports = mongoose.model("ServiceRecord", serviceRecordSchema);
