public function isValid()
    {
        $isValid = $this->hasDestination() && $this->hasOrigin();

        for ($i = 0; $isValid && ($i < count($this->waypoints)); $i++) {
            $isValid = $this->waypoints[$i]->isValid();
        }

        if ($this->getTravelMode() === TravelMode::TRANSIT) {
            $isValid = $this->hasArrivalTime() || $this->hasDepartureTime();
        }

        return $isValid;
    }