import { IsString, IsDateString, IsOptional, IsEnum } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export enum ReportType {
  REVENUE = 'REVENUE',
  OCCUPANCY = 'OCCUPANCY',
  AGENT_SALES = 'AGENT_SALES',
  CANCELLATIONS = 'CANCELLATIONS',
  PAYMENT_METHODS = 'PAYMENT_METHODS'
}

export enum ExportFormat {
  JSON = 'JSON',
  CSV = 'CSV',
  PDF = 'PDF'
}

export class GenerateReportDto {
  @ApiProperty({ enum: ReportType }) @IsEnum(ReportType) reportType: ReportType;
  @ApiProperty({ example: '2026-01-01' }) @IsDateString() dateFrom: string;
  @ApiProperty({ example: '2026-01-31' }) @IsDateString() dateTo: string;
  @ApiPropertyOptional() @IsOptional() @IsString() routeId?: string;
  @ApiPropertyOptional() @IsOptional() @IsString() agentId?: string;
}

export class ExportReportDto {
  @ApiProperty() @IsString() reportId: string;
  @ApiProperty({ enum: ExportFormat }) @IsEnum(ExportFormat) format: ExportFormat;
}
