import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types, HydratedDocument } from 'mongoose';
import moment from 'moment';
import { Users } from './user.schema';

@Schema({ timestamps: true })
export class TwilioConfig extends Document {

  @Prop({ type: Types.ObjectId, ref: Users.name, default: null })
  user_id: Types.ObjectId = null

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

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

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

  @Prop({ type: String, default: null })
  country: string
  
  @Prop({ type: String, default: "ACTIVE", enum:["ACTIVE", "IN_ACTIVE"] })
  status: string

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

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

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

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

export const TwilioConfigSchema = SchemaFactory.createForClass(TwilioConfig);