import * as mongoose from "mongoose";
import { model, AggregatePaginateModel } from "mongoose";
const aggregatePaginate = require("mongoose-aggregate-paginate-v2");
const Schema = mongoose.Schema;

const CashEntry = new Schema(
  {
    order_id: { type: Schema.Types.ObjectId, ref: 'Order'},
    customer_id: { type: Schema.Types.ObjectId, ref: 'User'},
    washer_id: { type: Schema.Types.ObjectId, ref: 'User'},
    amount: {
      type: Number,
      default: null,
    },
    date_time_service: {
      type: String,
      default: null,
    },
  },
  {
    timestamps: {
      createdAt: "created_at",
      updatedAt: "updated_at",
    },
  }
);

mongoose.plugin(aggregatePaginate);

export default model<any, AggregatePaginateModel<any>>("CashEntry", CashEntry);
