import { IsString, IsOptional, IsEmail, IsPhoneNumber, MinLength } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class RegisterDto {
  @ApiProperty()
  @IsString()
  name: string;

  @ApiPropertyOptional()
  @IsPhoneNumber('IN')
  @IsOptional()
  phone?: string;

  @ApiPropertyOptional()
  @IsEmail()
  @IsOptional()
  email?: string;

  @ApiPropertyOptional()
  @IsString()
  @MinLength(8)
  @IsOptional()
  password?: string;
}

export class SendOtpDto {
  @ApiProperty()
  @IsPhoneNumber('IN')
  phone: string;
}

export class VerifyOtpDto {
  @ApiProperty()
  @IsPhoneNumber('IN')
  phone: string;

  @ApiProperty()
  @IsString()
  code: string;
}

export class LoginDto {
  @ApiProperty()
  @IsEmail()
  email: string;

  @ApiProperty()
  @IsString()
  password: string;
}

export class RefreshTokenDto {
  @ApiProperty()
  @IsString()
  refreshToken: string;
}
