# 路線、車站與地點 (https://nolantw.github.io/tdx/reference/resources/)

## `Mode`

```python
type Mode = Literal['bus', 'rail', 'bike', 'parking']
```

## `BoardStop`

```python
class BoardStop:
    stop: RouteStop
    arrivals: tuple[BusArrival, ...]
```

路線上的一個站牌與其到站預估。

### `estimate_seconds`

```python
estimate_seconds: int | None
```

最短的預估到站秒數，沒有預估時為 `None`。

## `RouteBoard`

```python
class RouteBoard:
    route_name: Name
    subroute_name: Name | None
    direction: int | None
    stops: tuple[BoardStop, ...]
```

單一方向的站牌順序與到站預估。

## `StationTrain`

```python
class StationTrain:
    train_number: str | None
    line: str | None
    destination: Name | None
    arrival_time: str | None
    departure_time: str | None
    delay_minutes: int | None
    estimate_seconds: int | None
    platform: str | None
```

## `BikeStationStatus`

```python
class BikeStationStatus:
    station: BikeStation
    availability: BikeAvailability | None
```

## `CarParkStatus`

```python
class CarParkStatus:
    car_park: CarPark
    availability: CarParkAvailability | None
```

## `Nearest`

```python
class Nearest:
    item: T
    distance: float
```

## `Nearby`

```python
class Nearby:
    bus_stops: tuple[Nearest[BusStop], ...]
    rail_stations: tuple[Nearest[RailStation], ...]
    bike_stations: tuple[Nearest[BikeStationStatus], ...]
    car_parks: tuple[Nearest[CarParkStatus], ...]
```

## `BusRouteResource`

```python
class BusRouteResource:
    ...
```

一條公車路線，依完整路線名稱查詢，每次呼叫都會重新取得資料。

### `info`

```python
def info(*, cache_ttl: float | None = None) -> Records[BusRoute]
```

取得路線資料。

### `stops`

```python
def stops(*, cache_ttl: float | None = None) -> Records[BusRouteStops]
```

取得各方向與附屬路線的站序。

### `schedules`

```python
def schedules(*, cache_ttl: float | None = None) -> Records[BusSchedule]
```

取得定期班表。

### `shapes`

```python
def shapes(*, cache_ttl: float | None = None) -> Records[BusShape]
```

取得路線線型。

### `fares`

```python
def fares(*, cache_ttl: float | None = None) -> tuple[BusRouteFare, ...]
```

查詢路線代碼後取得票價。

### `arrivals`

```python
def arrivals() -> Records[BusArrival]
```

取得最新的到站預估。

### `vehicles`

```python
def vehicles() -> Records[BusVehiclePosition]
```

取得最新的車輛位置。

### `stop_events`

```python
def stop_events() -> Records[BusStopEvent]
```

取得最新的到離站動態。

### `board`

```python
def board(*, cache_ttl: float | None = None) -> tuple[RouteBoard, ...]
```

依序列出站牌與即時到站預估。

## `RailStationResource`

```python
class RailStationResource:
    system: RailSystem
```

一個鐵路或捷運車站。

### `info`

```python
def info(*, cache_ttl: float | None = None) -> RailStation | None
```

取得車站資料。

### `exits`

```python
def exits(*, cache_ttl: float | None = None) -> Records[RailStationExits]
```

取得車站出入口。

### `facilities`

```python
def facilities(
    *,
    cache_ttl: float | None = None,
) -> Records[RailStationFacilities]
```

取得車站設施。

### `trains`

```python
def trains() -> tuple[StationTrain, ...]
```

取得即時列車，高鐵則為今天的班次。

### `journeys_to`

```python
def journeys_to(
    station_id: str,
    service_date: date | None = None,
    *,
    cache_ttl: float | None = None,
) -> Records[RailJourney]
```

取得今天或指定日期前往另一站的車次。

### `fares_to`

```python
def fares_to(
    station_id: str,
    *,
    cache_ttl: float | None = None,
) -> Records[RailFare]
```

取得前往同系統另一站的票價。