2023-11-18 21:29:35 +01:00
|
|
|
from typing import Optional
|
|
|
|
|
2023-11-19 00:12:10 +01:00
|
|
|
from ninja import Schema, Swagger
|
2023-11-18 21:29:35 +01:00
|
|
|
from pydantic import Field as APIField
|
|
|
|
from pydantic import PositiveFloat, PositiveInt
|
|
|
|
|
|
|
|
from c3nav.api.utils import NonEmptyStr
|
|
|
|
from c3nav.mapdata.schemas.model_base import SpecificLocationSchema
|
|
|
|
|
|
|
|
|
|
|
|
class LevelSchema(SpecificLocationSchema):
|
2023-11-19 00:12:10 +01:00
|
|
|
"""
|
|
|
|
A physical level of the map, containing building, spaces, doors…
|
|
|
|
|
|
|
|
A level is a specific location, and can therefor be routed to and from, as well as belong to location groups.
|
|
|
|
"""
|
2023-11-18 21:29:35 +01:00
|
|
|
short_label: NonEmptyStr = APIField(
|
|
|
|
title="short label (for level selector)",
|
|
|
|
description="unique among levels",
|
|
|
|
)
|
|
|
|
on_top_of: Optional[PositiveInt] = APIField(
|
|
|
|
title="on top of level ID",
|
|
|
|
description="if set, this is not a main level, but it's on top of this other level"
|
|
|
|
)
|
|
|
|
base_altitude: float = APIField(
|
|
|
|
title="base/default altitude",
|
|
|
|
)
|
|
|
|
default_height: PositiveFloat = APIField(
|
|
|
|
title="default ceiling height",
|
|
|
|
)
|
|
|
|
door_height: PositiveFloat = APIField(
|
|
|
|
title="door height",
|
|
|
|
)
|
|
|
|
|
|
|
|
class Config(Schema.Config):
|
|
|
|
title = "Level"
|