mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 09:45:22 +03:00
Use enum to restrict values
This commit is contained in:
parent
aa5761f716
commit
4cfbda8f92
@ -277,6 +277,13 @@ class RuntimeFilterConfig(FilterConfig):
|
|||||||
extra = Extra.ignore
|
extra = Extra.ignore
|
||||||
|
|
||||||
|
|
||||||
|
class BoundingBoxTriggerEnum(str, Enum):
|
||||||
|
bottom_center = "bottom-center"
|
||||||
|
left_center = "left-center"
|
||||||
|
top_center = "top-center"
|
||||||
|
right_center = "right-center"
|
||||||
|
|
||||||
|
|
||||||
# this uses the base model because the color is an extra attribute
|
# this uses the base model because the color is an extra attribute
|
||||||
class ZoneConfig(BaseModel):
|
class ZoneConfig(BaseModel):
|
||||||
filters: Dict[str, FilterConfig] = Field(
|
filters: Dict[str, FilterConfig] = Field(
|
||||||
@ -289,8 +296,8 @@ class ZoneConfig(BaseModel):
|
|||||||
default_factory=list,
|
default_factory=list,
|
||||||
title="List of objects that can trigger the zone.",
|
title="List of objects that can trigger the zone.",
|
||||||
)
|
)
|
||||||
bounding_box_trigger: str = Field(
|
bounding_box_trigger: BoundingBoxTriggerEnum = Field(
|
||||||
default="bottom-center",
|
default=BoundingBoxTriggerEnum.bottom_center,
|
||||||
title="Point of an objects bounding box that triggers this zone.",
|
title="Point of an objects bounding box that triggers this zone.",
|
||||||
)
|
)
|
||||||
_color: Optional[Tuple[int, int, int]] = PrivateAttr()
|
_color: Optional[Tuple[int, int, int]] = PrivateAttr()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user