import {
  IsBoolean,
  IsEnum,
  IsNumber,
  IsOptional,
  IsString,
  MinLength,
} from "class-validator";
import { ServiceKind } from "@jorgecuadros/database";

export class CreatePropertyDto {
  @IsString() @MinLength(1) customerId!: string;
  @IsOptional() @IsString() policyId?: string;
  @IsOptional() @IsString() addressLine1?: string;
  @IsOptional() @IsString() addressLine2?: string;
  @IsOptional() @IsString() phone1?: string;
  @IsOptional() @IsString() phone2?: string;
  @IsOptional() @IsString() phone3?: string;
  @IsOptional() @IsString() zone?: string;
}

export class UpdatePropertyDto {
  @IsOptional() @IsString() policyId?: string;
  @IsOptional() @IsString() addressLine1?: string;
  @IsOptional() @IsString() addressLine2?: string;
  @IsOptional() @IsString() phone1?: string;
  @IsOptional() @IsString() phone2?: string;
  @IsOptional() @IsString() phone3?: string;
  @IsOptional() @IsString() zone?: string;
}

export class ServiceDto {
  @IsEnum(ServiceKind) kind!: ServiceKind;
  @IsOptional() @IsString() accountNumber?: string;
  @IsOptional() @IsString() meterNumber?: string;
  @IsOptional() @IsString() route?: string;
  @IsOptional() @IsString() dueDay?: string;
  @IsOptional() @IsBoolean() active?: boolean;
  @IsOptional() @IsString() notes?: string;
}
export class UpdateServiceDto {
  @IsOptional() @IsEnum(ServiceKind) kind?: ServiceKind;
  @IsOptional() @IsString() accountNumber?: string;
  @IsOptional() @IsString() meterNumber?: string;
  @IsOptional() @IsString() route?: string;
  @IsOptional() @IsString() dueDay?: string;
  @IsOptional() @IsBoolean() active?: boolean;
  @IsOptional() @IsString() notes?: string;
}

/** Trust is 1:1 with a property — this both creates and updates it (upsert). */
export class TrustDto {
  @IsOptional() @IsString() bankName?: string;
  @IsOptional() @IsString() trustNumber?: string;
  @IsOptional() @IsNumber() bankFee?: number;
  @IsOptional() @IsString() dueDate1?: string;
  @IsOptional() @IsString() dueDate2?: string;
}
