#!/usr/bin/env python3
from .base import Serializable
from .locations import Platform
from datetime import datetime


class TimeAndPlace(Serializable):
    def __init__(self, platform=None, arrival=None, departure=None):
        super().__init__()
        self.platform = platform
        self.arrival = arrival
        self.departure = departure
        self.passthrough = False

    @classmethod
    def _validate(cls):
        return {
            'platform': (None, Platform),
            'arrival': (None, datetime),
            'departure': (None, datetime),
            'passthrough': bool
        }

    @property
    def stop(self):
        return self.platform.stop

    def __eq__(self, other):
        assert isinstance(other, TimeAndPlace)
        return (self.platform == other.platform and
                self.arrival == other.arrival and
                self.departure == other.departure)

    def __repr__(self):
        return ('<TimeAndPlace %s %s %s>' % (self.arrival, self.departure, self.platform))

#!/usr/bin/env python3
from .base import Serializable
from .locations import Platform
from .realtime import RealtimeTime


class TimeAndPlace(Serializable):
    def __init__(self, platform=None, arrival=None, departure=None):
        super().__init__()
        self.platform = platform
        self.arrival = arrival
        self.departure = departure
        self.passthrough = False

    @classmethod
    def _validate(cls):
        return {
            'platform': (None, Platform),
            'arrival': (None, RealtimeTime),
            'departure': (None, RealtimeTime),
            'passthrough': bool
        }

    @property
    def stop(self):
        return self.platform.stop

    def __eq__(self, other):
        assert isinstance(other, TimeAndPlace)
        return (self.platform == other.platform and
                self.arrival == other.arrival and
                self.departure == other.departure)

    def __repr__(self):
        return ('<TimeAndPlace %s %s %s>' % (self.arrival, self.departure, self.platform))

Revert "TimeAndPlace no longer refers to realtime data"
Revert "TimeAndPlace no longer refers to realtime data"

This reverts commit cf92e191e3748c67102f142b411937517c5051f4.
