import { IsDateString, IsNotEmpty } from "class-validator"; import { TrackScan } from '../entities/TrackScan'; import { ResponseRunnerCard } from './ResponseRunnerCard'; import { ResponseScan } from './ResponseScan'; import { ResponseScanStation } from './ResponseScanStation'; import { ResponseTrack } from './ResponseTrack'; /** * Defines the trackScan response. */ export class ResponseTrackScan extends ResponseScan { /** * The scan's associated track. */ @IsNotEmpty() track: ResponseTrack; /** * The runnerCard associated with the scan. */ @IsNotEmpty() card: ResponseRunnerCard; /** * The scanning station that created the scan. */ @IsNotEmpty() station: ResponseScanStation; /** * The scan's creation timestamp. */ @IsDateString() @IsNotEmpty() timestamp: number; /** * Creates a ResponseTrackScan object from a scan. * @param scan The trackSscan the response shall be build for. */ public constructor(scan: TrackScan) { super(scan); this.track = new ResponseTrack(scan.track); this.card = scan.card.toResponse(); this.station = scan.station.toResponse(); this.timestamp = scan.timestamp; this.distance = scan.distance; } }