from collections.abc import Callable from enum import StrEnum, auto from gchr.export_format.honda import export_honda_csv from gchr.export_format.skr51 import export_skr51_xml from gchr.export_format.volkswagen import export_volkswagen_xml from gchr.gchr_model import GchrExportConfig class GchrExportFormat(StrEnum): Honda = auto() SKR51 = auto() Volkswagen = auto() GchrExportFn = Callable[[GchrExportConfig], None] EXPORT_FN: dict[GchrExportFormat, GchrExportFn] = { GchrExportFormat.Honda: export_honda_csv, GchrExportFormat.SKR51: export_skr51_xml, GchrExportFormat.Volkswagen: export_volkswagen_xml, } def export_dummy(export_cfg: GchrExportConfig) -> None: print("DUMMY") print(export_cfg.main_site) pass def get_export_fn(export_format: str) -> GchrExportFn: export_format_enum = GchrExportFormat[export_format] return EXPORT_FN.get(export_format_enum, export_dummy)