from dataclasses import dataclass

from bavaria.exceptions import UnknownStationError


@dataclass(frozen=True)
class Station:
    # Name of the station.
    name: str

    # UIC,  is a unique, european identifier of the railway station.
    uic: int


def by_name(name: str) -> Station:
    """ Find station by name. """
    for station in stations:
        if station.name == name:
            return station

    raise UnknownStationError(f'Station with name "{name}" doesn\'t exists.')

def by_uic(uic: int) -> Station:
    """ Find station by UIC. """
    for station in stations:
        if station.uic== uic:
            return station

    raise UnknownStationError(f'Station with UIC "{uic}" doesn\'t exists.')

stations = [
    Station(name='Geltendorf', uic=8000119),
    Station(name='München Hbf', uic=8000261),
    Station(name='München Ost', uic=8000262),
    Station(name='Altenerding', uic=8000524),
    Station(name='Altomünster', uic=8000556),
    Station(name='Arnbach', uic=8000603),
    Station(name='Aufhausen(b Erding)', uic=8000653),
    Station(name='Aying', uic=8000675),
    Station(name='Bachern', uic=8000685),
    Station(name='Baierbrunn', uic=8000781),
    Station(name='Baldham', uic=8000785),
    Station(name='Buchenau(Oberbay)', uic=8001229),
    Station(name='Buchenhain', uic=8001231),
    Station(name='Dachau Bahnhof', uic=8001354),
    Station(name='Dachau Stadt', uic=8001355),
    Station(name='Deisenhofen', uic=8001404),
    Station(name='Dürrnhaar', uic=8001578),
    Station(name='Ebenhausen-Schäftlarn', uic=8001621),
    Station(name='Ebersberg(Oberbay)', uic=8001634),
    Station(name='Eching', uic=8001647),
    Station(name='Eglharting', uic=8001682),
    Station(name='Eichenau(Oberbay)', uic=8001702),
    Station(name='Erding', uic=8001825),
    Station(name='Erdweg', uic=8001829),
    Station(name='Vierkirchen-Esterhofen', uic=8001922),
    Station(name='Fasanenpark', uic=8001963),
    Station(name='Feldafing', uic=8001970),
    Station(name='Feldkirchen(b München)', uic=8001973),
    Station(name='Esting', uic=8001996),
    Station(name='Freising', uic=8002078),
    Station(name='Fürstenfeldbruck', uic=8002141),
    Station(name='Furth(b Deisenhofen)', uic=8002161),
    Station(name='Gauting', uic=8002198),
    Station(name='Geisenbrunn', uic=8002210),
    Station(name='Gernlinden', uic=8002247),
    Station(name='Gilching-Argelsried', uic=8002275),
    Station(name='Gräfelfing', uic=8002339),
    Station(name='Grafing Bahnhof', uic=8002347),
    Station(name='Grafing Stadt', uic=8002348),
    Station(name='Grafrath', uic=8002351),
    Station(name='Gröbenzell', uic=8002377),
    Station(name='Gronsdorf', uic=8002383),
    Station(name='Großhelfendorf', uic=8002420),
    Station(name='Großhesselohe Isartalbf', uic=8002422),
    Station(name='Grub(Oberbay)', uic=8002435),
    Station(name='Haar', uic=8002491),
    Station(name='Hallbergmoos', uic=8002534),
    Station(name='Harthaus', uic=8002610),
    Station(name='Heimstetten', uic=8002715),
    Station(name='Herrsching', uic=8002792),
    Station(name='Höhenkirchen-Siegertsbrunn', uic=8002894),
    Station(name='Höllriegelskreuth', uic=8002899),
    Station(name='Hohenbrunn', uic=8002940),
    Station(name='Hohenschäftlarn', uic=8002955),
    Station(name='Holzkirchen', uic=8002980),
    Station(name='Icking', uic=8003039),
    Station(name='Markt Indersdorf', uic=8003072),
    Station(name='Ismaning', uic=8003092),
    Station(name='Kirchseeon', uic=8003290),
    Station(name='Kleinberghofen', uic=8003317),
    Station(name='Kreuzstraße', uic=8003438),
    Station(name='Lochham', uic=8003720),
    Station(name='Lohhof', uic=8003735),
    Station(name='Maisach', uic=8003824),
    Station(name='Malching(Oberbay)', uic=8003828),
    Station(name='Markt Schwaben', uic=8003879),
    Station(name='München Donnersbergerbrücke', uic=8004128),
    Station(name='München Hackerbrücke', uic=8004129),
    Station(name='München Harras', uic=8004130),
    Station(name='München Isartor', uic=8004131),
    Station(name='München Karlsplatz', uic=8004132),
    Station(name='München Leienfelsstr.', uic=8004133),
    Station(name='München Leuchtenbergring', uic=8004134),
    Station(name='München Marienplatz', uic=8004135),
    Station(name='München Rosenheimer Platz', uic=8004136),
    Station(name='München Siemenswerke', uic=8004137),
    Station(name='München St.Martin-Str.', uic=8004138),
    Station(name='München-Untermenzing', uic=8004139),
    Station(name='München-Allach', uic=8004140),
    Station(name='München-Aubing', uic=8004141),
    Station(name='München-Berg am Laim', uic=8004142),
    Station(name='München-Daglfing', uic=8004143),
    Station(name='München-Englschalking', uic=8004144),
    Station(name='München-Fasanerie', uic=8004145),
    Station(name='München-Fasangarten', uic=8004146),
    Station(name='München-Feldmoching', uic=8004147),
    Station(name='München-Giesing', uic=8004148),
    Station(name='München-Johanneskirchen', uic=8004149),
    Station(name='München-Karlsfeld', uic=8004150),
    Station(name='München-Laim', uic=8004151),
    Station(name='München-Langwied', uic=8004152),
    Station(name='München-Lochhausen', uic=8004153),
    Station(name='München-Mittersendling', uic=8004154),
    Station(name='München-Moosach', uic=8004155),
    Station(name='München-Neuaubing', uic=8004156),
    Station(name='München-Obermenzing', uic=8004157),
    Station(name='München-Pasing', uic=8004158),
    Station(name='München-Perlach', uic=8004159),
    Station(name='München-Riem', uic=8004160),
    Station(name='München-Solln', uic=8004161),
    Station(name='München-Trudering', uic=8004162),
    Station(name='München-Westkreuz', uic=8004163),
    Station(name='München Flughafen Besucherpark', uic=8004167),
    Station(name='München Flughafen Terminal', uic=8004168),
    Station(name='München Hirschgarten', uic=8004179),
    Station(name='München-Freiham', uic=8004181),
    Station(name='Mammendorf', uic=8004204),
    Station(name='Neugilching', uic=8004249),
    Station(name='Neubiberg', uic=8004252),
    Station(name='Neufahrn(b Freising)', uic=8004279),
    Station(name='Niederroth', uic=8004404),
    Station(name='Oberschleißheim', uic=8004580),
    Station(name='Olching', uic=8004667),
    Station(name='Ottenhofen(Oberbay)', uic=8004723),
    Station(name='Otterfing', uic=8004726),
    Station(name='Ottobrunn', uic=8004733),
    Station(name='Peiß', uic=8004761),
    Station(name='Petershausen(Obb)', uic=8004775),
    Station(name='Planegg', uic=8004827),
    Station(name='Poing', uic=8004854),
    Station(name='Possenhofen', uic=8004874),
    Station(name='Puchheim', uic=8004893),
    Station(name='Pullach', uic=8004899),
    Station(name='Pulling(b Freising)', uic=8004900),
    Station(name='Röhrmoos', uic=8005127),
    Station(name='Sauerlach', uic=8005299),
    Station(name='Schöngeising', uic=8005406),
    Station(name='München Heimeranplatz', uic=8005419),
    Station(name='Schwabhausen(b Dachau)', uic=8005442),
    Station(name='Seefeld-Hechendorf', uic=8005504),
    Station(name='St Koloman', uic=8005652),
    Station(name='Starnberg Nord', uic=8005675),
    Station(name='Starnberg', uic=8005676),
    Station(name='Steinebach', uic=8005699),
    Station(name='Stockdorf', uic=8005735),
    Station(name='Taufkirchen', uic=8005831),
    Station(name='Türkenfeld', uic=8005920),
    Station(name='Tutzing', uic=8005927),
    Station(name='Unterföhring', uic=8005986),
    Station(name='Unterhaching', uic=8005991),
    Station(name='Germering-Unterpfaffenhofen', uic=8006006),
    Station(name='Vaterstetten', uic=8006059),
    Station(name='Wächterhof', uic=8006131),
    Station(name='Hebertshausen', uic=8006189),
    Station(name='Weßling(Oberbay)', uic=8006359),
    Station(name='Wolfratshausen', uic=8006550),
    Station(name='Zorneding', uic=8006671),
    Station(name='Unterschleißheim', uic=8006688),
    Station(name='München-Neuperlach Süd', uic=8006696),
]
