import { IsDefined, IsString, IsNotEmpty, IsEmail, IsNumber, IsPhoneNumber } from "class-validator";
import { ApiProperty } from "@nestjs/swagger";
import { IsUserEmailUnique } from "src/modules/users/validators/is_user_email_unique";
import { IsUserPhoneUnique } from "src/modules/users/validators/is_user_phone_unique";
import { IsPhoneOnlyNumber } from "src/share/validators/is_phone_only_number";
import { IsName } from "src/share/validators/is_name";

export class RegisterDto {
  @ApiProperty({ example: "John Doe" })
  @IsDefined()
  @IsNotEmpty()
  @IsString()
  @IsName()
  name: string;

  @ApiProperty({ example: "john@example.com" })
  @IsDefined()
  @IsNotEmpty()
  @IsString()
  @IsEmail()
  @IsUserEmailUnique()
  email: string;

  @ApiProperty({ example: "083333333333" })
  @IsDefined()
  @IsNotEmpty()
  @IsString()
  @IsUserPhoneUnique()
  @IsPhoneOnlyNumber()
  phoneMobile: string;

  @ApiProperty({ example: "password" })
  @IsDefined()
  @IsNotEmpty()
  @IsString()
  password: string;
}
