import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsBoolean, IsInt, IsOptional, IsString, MaxLength, Min } from 'class-validator';

export class CreatePriorityRuleDto {
  @ApiProperty({ description: 'Human-readable label', maxLength: 100 })
  @IsString()
  @MaxLength(100)
  label!: string;

  @ApiProperty({ description: 'Points added to booking.priority_score when condition matches', default: 0 })
  @IsInt()
  @Min(0)
  score!: number;

  @ApiPropertyOptional({
    description: 'If set, rule only matches bookings with this payment currency (e.g. USD). Null = matches all.',
    maxLength: 5,
  })
  @IsOptional()
  @IsString()
  @MaxLength(5)
  conditionCurrency?: string;

  @ApiPropertyOptional({ default: false, description: 'Feature flag — toggle without code deploy' })
  @IsOptional()
  @IsBoolean()
  isActive?: boolean;
}
