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

export class FunnelStepDto {
  @ApiProperty({ description: 'Step name for display' })
  @IsString()
  name!: string;

  @ApiProperty({ description: 'Event type to track for this step' })
  @IsString()
  eventType!: string;
}

export class FunnelQueryDto {
  @ApiProperty({ type: [FunnelStepDto], description: 'Ordered list of funnel steps' })
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => FunnelStepDto)
  steps!: FunnelStepDto[];

  @ApiProperty({ description: 'Start date in ISO 8601 format' })
  @IsDateString()
  startDate!: string;

  @ApiProperty({ description: 'End date in ISO 8601 format' })
  @IsDateString()
  endDate!: string;
}
