import { IsInt, IsString } from "class-validator";
import { Track } from '../entities/Track';

/**
 * Defines the track response.
*/
export class ResponseTrack {
    /**
     * The track's id.
     */
    @IsInt()
    id: number;;

    /**
     * The track's name.
     */
    @IsString()
    name: string;

    /**
     * The track's length/distance in meters.
     */
    @IsInt()
    distance: number;

    /**
     * Creates a ResponseTrack object from a track.
     * @param track The track the response shall be build for.
     */
    public constructor(track: Track) {
        this.id = track.id;
        this.name = track.name;
        this.distance = track.distance;
    }
}
