module.exports = mongoose => {
	var schema = mongoose.Schema(
		{
			repair_date: String,
			site: Number,
			repair_description: String,
			part_name: String,
			part_name_other: String,
			mileage_at_replacement: String,
			quantity: String,
			repair_price: String,
			repair_location: String,
			next_replacement_reminder: String,
			vehicle: String,
			create_date: Date
		},
		{ collection: 'vehicle_repair', timestamps: true }
	);
	schema.method("toJSON", function() {
		const { __v, _id, ...object } = this.toObject();
		object.id = _id;
		return object;
	});
	schema.index({tag: 1, site:1}, {unique: true});
	const VehicleRepair = mongoose.model("vehicle_repair", schema);
	return VehicleRepair;
};