import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsNotEmpty, IsArray, ValidateNested, IsNumber } from 'class-validator';
import { Type } from 'class-transformer';

class CreatePricingTierDto {
  @ApiProperty({ example: 'Basic' })
  @IsString()
  @IsNotEmpty()
  name: string;

  @ApiProperty({ example: 'Perfect for small teams' })
  @IsString()
  @IsNotEmpty()
  hookline: string;

  @ApiProperty({ example: ['Feature 1', 'Feature 2'], type: [String] })
  @IsArray()
  @IsString({ each: true })
  features: string[];

  @ApiProperty({ example: 15000 })
  @IsNumber()
  price: number;
}

export class CreateClientPricingDto {
  @ApiProperty({ example: 'SecureView' })
  @IsString()
  @IsNotEmpty()
  title: string;

  @ApiProperty({ example: 'Essential Security Monitoring' })
  @IsString()
  @IsNotEmpty()
  subtitle: string;

  @ApiProperty({ example: ['feat1 ', 'feat2'], type: [String] })
  @IsArray()
  @IsNotEmpty()
  mainFeatures: string[];

  @ApiProperty({ example: 'icons-name', type: String })
  @IsString()
  @IsNotEmpty()
  icon: string;

  @ApiProperty({ type: [CreatePricingTierDto] })
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => CreatePricingTierDto)
  tiers: CreatePricingTierDto[];
}
