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

export enum ChartPeriodEnum {
    Daily = 'daily',
    Weekly = 'weekly',
    Monthly = 'monthly',
}

export class PaymentChartDto {
    @ApiPropertyOptional({
        description: 'Start date for filtering (ISO date string)',
        type: String,
        format: 'date-time',
        example: '2024-01-01T00:00:00Z',
    })
    @IsOptional()
    @IsDateString()
    startDate?: string;

    @ApiPropertyOptional({
        description: 'End date for filtering (ISO date string)',
        type: String,
        format: 'date-time',
        example: '2024-12-31T23:59:59Z',
    })
    @IsOptional()
    @IsDateString()
    endDate?: string;

    @ApiPropertyOptional({
        description: 'Period type for grouping data',
        enum: ChartPeriodEnum,
        default: ChartPeriodEnum.Daily,
        example: ChartPeriodEnum.Daily,
    })
    @IsOptional()
    @IsEnum(ChartPeriodEnum)
    type?: ChartPeriodEnum = ChartPeriodEnum.Daily;
}

