import { ArrayMaxSize, IsArray, IsIn, IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator';
import { Trim } from '../../../common/dto/field-transforms';
import { CUSTOM_REPORT_CHARTS } from '../custom-report.constants';

export class ExportCustomReportDto {
  @Trim()
  @IsString()
  @IsNotEmpty()
  @MaxLength(150)
  name!: string;

  @IsString()
  @IsNotEmpty()
  @MaxLength(50)
  object!: string;

  @IsString()
  @IsNotEmpty()
  @MaxLength(50)
  group!: string;

  @IsString()
  @IsNotEmpty()
  @MaxLength(50)
  measure!: string;

  @IsOptional()
  @IsIn(CUSTOM_REPORT_CHARTS)
  chart?: string;

  @IsArray()
  @ArrayMaxSize(200)
  rows!: [string, number][];
}
