1"""Bot-key sign-up lookup/upsert by Discord id, for Discord's Going/Maybe/Can't buttons.
2
3``GET/PUT /api/guilds/{guild_id}/events/{event_id}/signups/by-discord/{discord_id}``: lets the bot read and write a
4member's signup without a site session, identifying them by Discord id instead (same shape of trick as
5``signup_notices``'s bot-key roster-confirmation routes).
6"""
7
8from pydantic import BaseModel, ConfigDict, Field
9
10from sidequest_common.schemas.events import EventKind, Signup, SignupRole, WowClass
11
12
[docs]
13class SignupDefaults(BaseModel):
14 """A member's most recent character/class/role from any earlier signup, to prefill a new one."""
15
16 model_config = ConfigDict(populate_by_name=True, serialize_by_alias=True)
17
18 character: str | None
19 wow_class: WowClass | None = Field(alias="class")
20 role: SignupRole | None
21
22
[docs]
23class SignupByDiscord(BaseModel):
24 """``GET .../signups/by-discord/{discord_id}``: the member's current signup for this event, plus defaults.
25
26 ``signup`` is ``None`` if the member hasn't signed up for this event yet. ``defaults`` is ``None`` if the
27 member has never given character/class/role on any event. ``kind`` is the event's kind, so the bot can tell
28 whether a bare RSVP is enough without a second round trip.
29 """
30
31 signup: Signup | None
32 defaults: SignupDefaults | None
33 kind: EventKind