import { ApiProperty } from '@nestjs/swagger';
import {
  IsIn,
  IsNotEmpty,
  IsOptional,
  IsString,
  IsStrongPassword,
} from 'class-validator';

export class SignUpDto {
  @IsString()
  @IsNotEmpty({ message: `First name can't be empty.` })
  @ApiProperty({
    required: true,
    type: String,
    description: 'First name',
  })
  first_name: string;

  @IsOptional()
  @IsString()
  @ApiProperty({
    required: false,
    type: String,
    description: 'Last name',
  })
  last_name: string;

  @IsString()
  @IsNotEmpty({ message: `Username can't be empty.` })
  @ApiProperty({
    required: true,
    type: String,
    description: 'Username',
  })
  username: string;

  @IsString()
  @IsStrongPassword(undefined, { message: `Password must be strong.` })
  @IsNotEmpty({ message: `Password can't be empty.` })
  @ApiProperty({
    required: true,
    type: String,
    description: 'Password',
  })
  password: string;

  @IsString()
  @IsNotEmpty({ message: `Please re-enter your password.` })
  @ApiProperty({
    required: true,
    type: String,
    description: 'Confirm your password',
  })
  confirm_password: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({
    required: true,
    type: String,
    description: 'Country Code',
  })
  country_phone_code: string;

  @IsString()
  @IsNotEmpty({ message: `Mobile number can't be empty` })
  @ApiProperty({
    required: true,
    type: String,
    description: 'Phone Number',
  })
  phone_number: string;

  @IsString()
  @IsIn(['ios', 'android'])
  @IsNotEmpty()
  @ApiProperty({
    required: true,
    type: String,
    description: 'Device Type',
    enum: ['ios', 'android'],
  })
  device_type: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({
    required: true,
    type: String,
    description: 'Device Id',
  })
  device_id: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({
    required: true,
    type: String,
    description: 'Device Token',
  })
  device_token: string;
}
