const { Schema, model } = require('mongoose')

const schema = new Schema({
  image: String,
  imageRating: String,
  imageDescription: String,
  orderId: {
    type: Schema.Types.ObjectId,
    ref: 'dry-wash-order'
  },
  created: {
    type: Date,
    default: () => new Date().toISOString(),
  },
})

schema.set('toJSON', {
    virtuals: true,
    versionKey: false,
    transform(_doc, ret) {
        delete ret._id
    }
})

schema.virtual('id').get(function () {
    return this._id.toHexString()
})

exports.OrderCarImgModel = model('dry-wash-order-car-image', schema)