import { ApiProperty } from '@nestjs/swagger';
import { PartialType } from '@nestjs/mapped-types';
import {
  IsDefined,
  IsNotEmpty,
  IsOptional,
  IsString,
  ValidateIf,
  IsEmail,
} from 'class-validator';
export class SaleForceUserDto {
  @IsOptional()
  @IsDefined()
  isUpdate: boolean;

  @IsNotEmpty()
  @ApiProperty()
  @IsString()
  Id: string;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  @IsString()
  @IsOptional()
  FirstName: string;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  @IsString()
  LastName: string;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  @IsString()
  Name: string;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  @IsEmail()
  @IsOptional()
  Email: string;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  @IsString()
  @IsOptional()
  Department: string;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  @IsOptional()
  Role_Admin_Use__c: string;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  CreatedDate: string;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  @IsString()
  'Manager.Name': string;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  @IsString()
  @IsOptional()
  ManagerId: string;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  @IsNotEmpty()
  @IsOptional()
  IsActive: string | boolean;

  @ValidateIf((o) => o.isUpdate === true)
  @ApiProperty()
  @IsString()
  'Profile.Name': string;
}

export class UpdateSaleForceUserDto extends PartialType(SaleForceUserDto) {}
