import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import moment from 'moment';

@Schema()
export class Plan extends Document {
    @Prop({ type: String, default: null })
    name: string;

    @Prop({ type: String, default: null })
    description: string;

    @Prop({ type: String, default: null })
    product_id: string;

    @Prop({ type: String, default: null })
    plan_id: string;

    @Prop({ type: Number, default: null })
    amount: number;

    @Prop({ type: String, default: null })
    interval: string;

    @Prop({ type: String, default: null })
    currency: string;

    @Prop({ type: Number, default: 1 })
    interval_count: number;

    @Prop({ type: Boolean, default: false })
    is_delete: boolean;

    @Prop({ type: [String], default: false })
    highlights: string[];

    @Prop({ type: Number, default: () => moment().utc().valueOf() })
    created_at: number;
}

export const PlanSchema = SchemaFactory.createForClass(Plan);
