import { Type } from 'class-transformer'
import { IsBoolean, IsInt, IsOptional, Min, ValidateNested } from 'class-validator'

class AmountsDto {
  @IsOptional() @IsInt() @Min(0) DKK?: number
  @IsOptional() @IsInt() @Min(0) EUR?: number
  @IsOptional() @IsInt() @Min(0) USD?: number
}

// All fields optional — PATCH a single currency, the active flag, or both.
// plan + cycle are the row identity and are not editable here (deactivate
// and create a new row if those need to change, which the partial unique
// index enforces).
export class UpdatePriceDto {
  @IsOptional() @ValidateNested() @Type(() => AmountsDto)
  amounts?: AmountsDto

  @IsOptional() @IsBoolean()
  active?: boolean
}
