Skip to content

Commit 16530b7

Browse files
committed
SkiRunConvention StrEnum
1 parent 4eb35e0 commit 16530b7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

openskistats/models.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ class OpenSkiMapStatus(StrEnum):
2525
abandoned = "abandoned"
2626

2727

28+
class SkiRunConvention(StrEnum):
29+
"""
30+
Convention for the ski run difficulty coloring.
31+
See <https://github.com/russellporter/openskidata-format/blob/e421ef0a0814437c362611e07cb43c32bac4172c/src/Run.ts#L113>.
32+
"""
33+
34+
north_america = "north_america"
35+
europe = "europe"
36+
japan = "japan"
37+
38+
2839
class SkiRunDifficulty(StrEnum):
2940
"""
3041
https://wiki.openstreetmap.org/wiki/Key:piste:difficulty
@@ -277,7 +288,7 @@ class RunModel(Model): # type: ignore [misc]
277288
Field(description="OpenSkiMap difficulty rating for the run."),
278289
]
279290
run_convention: Annotated[
280-
Literal["north_america", "europe", "japan"] | None,
291+
SkiRunConvention | None,
281292
Field(description="OpenSkiMap convention for the run."),
282293
]
283294
ski_area_ids: Annotated[
@@ -424,7 +435,7 @@ class SkiAreaModel(Model): # type: ignore [misc]
424435
),
425436
]
426437
osm_run_convention: Annotated[
427-
Literal["japan", "europe", "north_america"],
438+
SkiRunConvention,
428439
Field(description="OpenSkiMap convention for the runs in the ski area."),
429440
]
430441
osm_status: OpenSkiMapStatus | None = Field(

0 commit comments

Comments
 (0)