# SPDX-License-Identifier: CC0-1.0 # Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org> # # Available under the terms of Creative Commons Zero v1.0 Universal. import enum import dataclasses as dc import typing as t import flask from .. import state as st class UIDomain(enum.Enum): MAIN = enum.auto() LANDING_PAGE = enum.auto() @dc.dataclass(init=False) class WebUIApp(flask.Flask): _haketilo_state: st.HaketiloState _haketilo_ui_domain: t.ClassVar[UIDomain] def get_haketilo_state() -> st.HaketiloState: return t.cast(WebUIApp, flask.current_app)._haketilo_state def get_haketilo_ui_domain() -> UIDomain: return t.cast(WebUIApp, flask.current_app)._haketilo_ui_domain