import BaseModel from './BaseModel';
import { prop, Ref, mongoose } from '@typegoose/typegoose';
import GMMail from './GMMail';

class Reward {
    @prop({ required: true })
    id: number;
    @prop({ required: true })
    count: number;
}

export default class MailTemp extends BaseModel {

    @prop({ required: true })
    contentId: number;                  // dic_email_content.json中的id

    @prop({ ref: 'GMMail', type: mongoose.Schema.Types.ObjectId })
    mail: Ref<GMMail>;

    @prop({ required: true })
    sendTime: number;

    @prop({ required: true })
    endTime: number;

    @prop({ required: true, type: String, _id: false})
    params: string[];

    @prop({ required: true })
    sendName: string;                   // 发件人

    @prop({ required: true })
    hasGoods: boolean;

    @prop({ required: true, type: Reward, default: [], _id: false })
    goods: Array<Reward>;

}