import { Expose } from 'class-transformer';
import { ArrayMinSize, IsArray, IsDateString, IsDefined, IsIn, IsNumber, IsOptional, IsString, ValidateIf } from 'class-validator';
import { GROUP_MEMBER_POLICIES } from '../../../regions/business/types/regions';

export default class AssignUserPoliciesVC {
    @IsDefined()
    @IsIn(Object.values(GROUP_MEMBER_POLICIES))
    @IsString()
    @Expose()
    userMode!: string;

    @ValidateIf((params: AssignUserPoliciesVC) => params.userMode === GROUP_MEMBER_POLICIES.TARGETED_USERS)
    @IsDefined()
    @IsArray()
    @ArrayMinSize(1)
    @IsNumber({}, { each: true })
    @Expose()
    collaborators?: number[];

    @IsOptional()
    @IsDateString()
    @Expose()
    fromDate?: string;
}
