from dataclasses import dataclass, field from core.enums import ActivityRefType, ActivityType @dataclass class Activity: """Data class that defines an Activity (formerly referred to as a "Special Interest Group" or "SIG", a term which is still used for the `sig` field name in the API for backwards compatibility). Each contains a name and a longer form description. They also contain comment_names which attempts to separate out the way people might refer to it in cluster comments from how it is referred to in the UI & API. (For example, "TOTA" in cluster spot comments almost always means Towers on the Air, but no single programme is referred to in the UI as "TOTA" as it's ambiguous between Towers, Toilets and Tiles. And while Beaches got the name "BOTA" first, "BOTA" spots are much more likely to be bunkers.) Finally, there is a ref_regex which provides a regular expression to match what references (such as parks and summits) look like for that programme.""" # Activity name as used in the UI and API, e.g. "Towers" name: str # Description, e.g. "Towers on the Air" description: str # Type, either Worldwide, Regional or Event. Used for sorting in the web UI. # Note: this field is still named "sig_type" in the API for backwards compatibility. sig_type: ActivityType # Identifies that the activity's reference ID structure defined by its regex is unique across all programmes and # anything else we expect a user to put in a spot comment, and therefore we can pull references out of # spot comments without also needing to see the activity name first. For example, "OHFF-1234" or "B/G-1234" are # obviously WWFF and WWBOTA, nothing else looks like those. But "SZ09" could be WAB or Tiles, "GB1234" could # conceivably be POTA or ILLW, etc. refs_globally_unique: bool # Activity names as they might appear in cluster spot comments, e.g. ["TOTA"] comment_names: list[str] = field(default_factory=list) # Reference type, what gets activated e.g. Park, Summit. May be None if the activity is for multiple types of # things, in which case the spot data will have to provide this instead. ref_type: ActivityRefType | None = None # Regex matcher for references, e.g. for POTA r"[A-Z]{2}\-\d+". ref_regex: str | None = None # Icon to use in the UI when referencing this activity. Chosen from the Font Awesome set. icon: str | None = None # Emoji flag for the country or region where this activity is relevant, if any. If None, this implies the # activity is in worldwide usage. region_flag: str | None = None