import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types, HydratedDocument } from 'mongoose';
import moment from 'moment';
import { Workspace } from './workspace.model';

@Schema()
export class WorkspacesKeys extends Document {

    @Prop({ type: Types.ObjectId, ref: Workspace.name, default: null })
    workspace_id: string

    @Prop({ type: String, default: null })
    key: string = null

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

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

    @Prop({ default: moment().utc().valueOf() })
    updated_at: number = moment().utc().valueOf();
}

export const WorkspacesKeysSchema = SchemaFactory.createForClass(WorkspacesKeys);