1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

73 lines
1.6 KiB
Python
Raw Normal View History

2021-09-10 01:18:38 -07:00
"""UI Configuration models."""
# Standard Library
from typing import Any, Dict, List, Tuple, Union, Literal, Optional
# Third Party
from pydantic import StrictStr, StrictBool
# Local
from .main import HyperglassModel
2021-09-10 01:18:38 -07:00
from .config.web import WebPublic
from .config.cache import CachePublic
from .config.params import ParamsPublic
from .config.messages import Messages
Alignment = Union[Literal["left"], Literal["center"], Literal["right"], None]
StructuredDataField = Tuple[str, str, Alignment]
class UIDirectiveInfo(HyperglassModel):
2021-09-10 01:18:38 -07:00
"""UI: Directive Info."""
enable: StrictBool
params: Dict[str, str]
content: StrictStr
class UIDirective(HyperglassModel):
2021-09-10 01:18:38 -07:00
"""UI: Directive."""
id: StrictStr
name: StrictStr
field_type: StrictStr
groups: List[StrictStr]
description: StrictStr
info: Optional[UIDirectiveInfo] = None
options: Optional[List[Dict[str, Any]]]
class UILocation(HyperglassModel):
2021-09-10 01:18:38 -07:00
"""UI: Location (Device)."""
id: StrictStr
name: StrictStr
network: StrictStr
directives: List[UIDirective] = []
class UINetwork(HyperglassModel):
2021-09-10 01:18:38 -07:00
"""UI: Network."""
display_name: StrictStr
locations: List[UILocation] = []
class UIContent(HyperglassModel):
2021-09-10 01:18:38 -07:00
"""UI: Content."""
credit: StrictStr
greeting: StrictStr
class UIParameters(ParamsPublic, HyperglassModel):
2021-09-10 01:18:38 -07:00
"""UI Configuration Parameters."""
cache: CachePublic
web: WebPublic
messages: Messages
2021-09-10 01:18:38 -07:00
version: StrictStr
networks: List[UINetwork] = []
parsed_data_fields: Tuple[StructuredDataField, ...]
content: UIContent