import { IsString, IsIn, IsNotEmpty, ValidateIf } from 'class-validator';
import { db } from './constants';

export class ReqDto {

    @IsString()
    @IsIn(['site','dataservice'])
    type: string;

    @ValidateIf(o => o.type === 'site')
    @IsNotEmpty()
    @IsIn(db)
    @IsString()
    databaseName: string;

    @ValidateIf(o => o.type === 'dataservice')
    @IsNotEmpty()
    className: string;

    @ValidateIf(o => o.type === 'dataservice')
    filter: string;

    
}