import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import { Role } from '../roles/role.enum';

export type UserDocument = User & Document;

@Schema({ timestamps: true })
export class User {
  @Prop({ unique: true })
  email: string;

  @Prop()
  firstName: string;

  @Prop()
  lastName: string;

  @Prop()
  street: string;

  @Prop()
  stNumber: string;

  @Prop()
  postcode: number;

  @Prop()
  location: string;

  @Prop()
  phone: string;

  @Prop()
  role: Role;

  @Prop()
  password: string;
}

export const UserSchema = SchemaFactory.createForClass(User);
