import { Document, Schema, model } from 'mongoose';

export interface MerchantInterface extends Document {
  name: string,
  key: string,
  privileged: boolean,
  /**
   * type
   * - 0: soft
   * - 1: hard
   */
  type: 0 | 1;
  pulls: [{ type: 0 | 1, reason: string, date: Date }],
}

const Merchant: Schema = new Schema({
  name: String,
  key: String,
  privileged: Boolean,
  type: Number,
  pulls: Array,
});

export default model<MerchantInterface>('Merchant', Merchant);
