import { Expose, Type } from 'class-transformer';
import { ArrayMinSize, IsArray, IsDefined, IsIn, IsOptional, IsString, ValidateNested } from 'class-validator';
import { TimeTrackingEntrySource } from '../../business/types/source';
import { CreateTimeTrackingEntryRequestsVC } from './createTimeTrackingEntryRequestsVC';

export class CreateOfflineTimeTrackingEntryRequestsVC extends CreateTimeTrackingEntryRequestsVC {
    @IsIn(Object.values(TimeTrackingEntrySource))
    @IsOptional()
    @IsString()
    @Expose()
    source!: TimeTrackingEntrySource;
}

export class CreateOfflineTimeTrackingEntriesRequestsVC {
    @IsArray()
    @IsDefined()
    @ArrayMinSize(0)
    @ValidateNested({ each: true })
    @Type(() => CreateOfflineTimeTrackingEntryRequestsVC)
    @Expose()
    entries!: CreateOfflineTimeTrackingEntryRequestsVC[];
}
