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

const OrderStatus = new Schema(
  {
    order_id   :  { type: Schema.Types.ObjectId, ref: 'Order'},
    mark_by    :  { type: Schema.Types.ObjectId, ref: 'User'},
    mark_on    :  { type: Date },
    status     :  { type: String }, // new, cancel, complete, accept
  },
  {
    timestamps: {
      createdAt: "created_at",
      updatedAt: "updated_at",
    },
  }
);

mongoose.plugin(aggregatePaginate);

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