import { IsNotEmpty, IsOptional, IsString, IsBoolean, IsIn, MaxLength, IsEmail, ValidateIf } from 'class-validator';

export class CreateTripSourceDto {
  @IsString() @IsNotEmpty() @IsIn(['B2B_AGENT', 'DIRECT', 'WEBSITE', 'REFERRAL'])
  source_type: string;

  @IsString() @IsNotEmpty() @MaxLength(255)
  name: string;

  @IsString() @IsNotEmpty() @MaxLength(100)
  short_name: string;

  @IsString() @IsNotEmpty() @MaxLength(255)
  contact_name: string;

  @IsOptional()
  @ValidateIf((o) => o.contact_email !== '' && o.contact_email !== null)
  @IsEmail()
  @MaxLength(255)
  contact_email?: string;

  @IsString() @IsOptional() @MaxLength(10)
  contact_phone_code?: string;

  @IsString() @IsOptional() @MaxLength(20)
  contact_phone?: string;

  @IsString() @IsOptional() @MaxLength(100)
  city?: string;

  @IsString() @IsOptional() @MaxLength(100)
  state?: string;

  @IsString() @IsOptional() @MaxLength(100)
  country?: string;

  @IsString() @IsOptional() @MaxLength(20)
  pin_code?: string;

  @IsString() @IsOptional() @MaxLength(500)
  street_address?: string;

  @IsString() @IsOptional() @MaxLength(255)
  locality?: string;

  @IsString() @IsOptional() @MaxLength(255)
  landmark?: string;

  @IsString() @IsOptional() @MaxLength(255)
  billing_name?: string;

  @IsString() @IsOptional()
  billing_details?: string;

  @IsBoolean() @IsOptional()
  is_active?: boolean;
}
