import { Expose, Type } from 'class-transformer';
import { IsBoolean, IsDefined, IsIn, IsNumber, IsOptional, IsString, MaxLength, ValidateNested } from 'class-validator';
import { TimeTrackingEntryType } from '../../business/types/entry';
import { TimeTrackingEntrySource } from '../../business/types/source';
import { LocationVC } from './locationValidationClass';

export class BaseTimeTrackingEntryRequestsVC {
    @IsString()
    @IsIn(Object.values(TimeTrackingEntryType))
    @Expose()
    @IsDefined()
    type!: TimeTrackingEntryType;

    @IsNumber()
    @Expose()
    @IsOptional()
    siteId?: number;

    @IsOptional()
    @ValidateNested()
    @Type(() => LocationVC)
    @Expose()
    location?: LocationVC;

    @IsOptional()
    @IsString()
    @MaxLength(250)
    @Expose()
    comment?: string;

    @IsOptional()
    @IsBoolean()
    @Expose()
    facialRecognitionSkipped?: boolean;

    @IsString()
    @Expose()
    @IsOptional()
    @IsIn(Object.values(TimeTrackingEntrySource))
    source?: TimeTrackingEntrySource;
}
