import { Expose } from 'class-transformer';
import { IsArray, IsDefined, IsNumber } from 'class-validator';
import { OptionalNumbersStringToNumbersArray } from './decorators/optionalNumbersStringToNumbersArray';
import { OptionalStringToStringsArray } from './decorators/optionalStringToStringsArray';
import { ValidationClass } from './validationClass';

export class ReportFilterVC extends ValidationClass {
    constructor(groupIds: number[], userFields: string[]) {
        super();
        this.groupIds = groupIds;
        this.userFields = userFields;
    }

    @IsDefined()
    @IsNumber({}, { each: true })
    @OptionalNumbersStringToNumbersArray()
    @IsArray()
    @Expose()
    groupIds!: number[];

    @IsDefined()
    @OptionalStringToStringsArray()
    @IsArray()
    @Expose()
    userFields!: string[];
}
