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

export enum ChartGroupBy {
    DAY = 'day',
    WEEK = 'week',
    MONTH = 'month',
}

export class TransactionChartQueryDto {

    @ApiProperty({
        example: '2026-03-01',
        description: 'Start date (YYYY-MM-DD)'
    })
    @IsDateString()
    startDate: string;

    @ApiProperty({
        example: '2026-03-10',
        description: 'End date (YYYY-MM-DD)'
    })
    @IsDateString()
    endDate: string;

    @ApiProperty({
        enum: ChartGroupBy,
        example: 'day'
    })
    @IsEnum(ChartGroupBy)
    groupBy: ChartGroupBy;

    @ApiPropertyOptional({
        example: 'branch-uuid'
    })
    @IsOptional()
    @IsUUID()
    branchId?: string;
}