recruitment =========== .. py:module:: sidequest_common.schemas.recruitment .. autoapi-nested-parse:: Recruitment drive schemas: constants, enums, the addon export/import additions, and the site HTTP API. ``local://recruitment-contract.md`` is the source of truth. A drive is a ``GuildEvent`` of kind ``recruitment`` (``sidequest_common.schemas.events.EventKind.RECRUITMENT``) running 14 days by default; the inviter with the most recruits who stay ``RECRUIT_STAY_DAYS`` days and reach ``RECRUIT_MIN_LEVEL`` wins ``DRIVE_PRIZE_COPPER``, ties each win it, settled ``DRIVE_SETTLE_DAYS`` after the drive ends. Who invited whom comes from the in-game guild log (``ExportGuildLogEntry``), not the addon. .. py:data:: DRIVE_PRIZE_COPPER :value: 100000 10g, paid to the inviter(s) with the most qualifying recruits in a drive. Ties each win it. .. py:data:: RECRUIT_MIN_LEVEL :value: 10 .. py:data:: RECRUIT_STAY_DAYS :value: 7 .. py:data:: DRIVE_SETTLE_DAYS :value: 7 Payouts settle this many days after the drive's ``ends_at``. .. py:data:: DRIVE_DEFAULT_DAYS :value: 14 The site form's default drive length. .. py:data:: RECRUIT_JOIN_WINDOW A join must follow its invite within this window, else the recruit is ``never_joined``. .. py:data:: MAX_GUILD_LOG_ENTRIES :value: 500 .. py:data:: MAX_RECRUIT_PAYOUTS_PAID :value: 200 .. py:data:: MAX_RECRUITMENT_LEADERS :value: 15 Cap on ``RecruitmentTally.leaders``, the most relevant inviters for the forum starter post. .. py:data:: GUILD_LOG_DEDUPE_WINDOW A re-uploaded guild log row with the same kind/actor/target within this window of a stored row is the same entry. .. py:data:: RECRUIT_NAME_MAX_LENGTH :value: 64 Matches the addon's character name format (``roster.members[].character``). .. py:class:: GuildLogKind Bases: :py:obj:`enum.StrEnum` One kind of in-game guild event log entry (``QueryGuildEventLog``/``GetGuildEventInfo``). .. py:attribute:: INVITE :value: 'invite' .. py:attribute:: JOIN :value: 'join' .. py:attribute:: QUIT :value: 'quit' .. py:attribute:: REMOVE :value: 'remove' .. py:class:: DriveRecruitStatus Bases: :py:obj:`enum.StrEnum` Where one recruit is in a drive's 7-day qualification clock. .. py:attribute:: INVITED :value: 'invited' .. py:attribute:: COUNTING :value: 'counting' .. py:attribute:: QUALIFIED :value: 'qualified' .. py:attribute:: DISQUALIFIED :value: 'disqualified' .. py:class:: DriveRecruitReason Bases: :py:obj:`enum.StrEnum` Why a recruit is ``disqualified``. Only set alongside ``DriveRecruitStatus.DISQUALIFIED``. .. py:attribute:: RETURNING :value: 'returning' .. py:attribute:: OWN_ALT :value: 'own_alt' .. py:attribute:: LEFT :value: 'left' .. py:attribute:: LOW_LEVEL :value: 'low_level' .. py:attribute:: NEVER_JOINED :value: 'never_joined' .. py:class:: PaidVia Bases: :py:obj:`enum.StrEnum` How a recruit's payout was marked paid: the site's "Mark paid" button, or the addon's mail-send button. .. py:attribute:: SITE :value: 'site' .. py:attribute:: ADDON :value: 'addon' .. py:class:: ExportGuildLogEntry Bases: :py:obj:`pydantic.BaseModel` One ``SQX1:`` guild event log row (max ``MAX_GUILD_LOG_ENTRIES``). ``at`` is rounded down to the hour. ``actor`` is the inviter for ``invite``, the member for ``join``/``quit``, or the removing officer for ``remove``; ``target`` is the invitee for ``invite`` or the removed member for ``remove``, and omitted for ``join``/``quit``. ``promote``/``demote`` entries are never exported. .. py:attribute:: kind :type: GuildLogKind .. py:attribute:: actor :type: str .. py:attribute:: target :type: str | None .. py:attribute:: at :type: int .. py:class:: ExportRecruitPayoutPaid Bases: :py:obj:`pydantic.BaseModel` One ``SQX1:`` row for a payout the addon's mail button already sent (max ``MAX_RECRUIT_PAYOUTS_PAID``). .. py:attribute:: event_id :type: uuid.UUID .. py:attribute:: inviter :type: str .. py:attribute:: copper :type: int .. py:attribute:: at :type: int .. py:attribute:: officer :type: str .. py:class:: GuildLogImportCounts Bases: :py:obj:`pydantic.BaseModel` Counts for the ``guild_log`` section of one import. ``merged`` matches a stored row within the dedupe window. .. py:attribute:: new :type: int :value: 0 .. py:attribute:: merged :type: int :value: 0 .. py:class:: RecruitPayoutImportCounts Bases: :py:obj:`pydantic.BaseModel` Counts for the ``recruit_payouts_paid`` section of one import. ``already_paid`` is the idempotent no-op case. .. py:attribute:: new :type: int :value: 0 .. py:attribute:: already_paid :type: int :value: 0 .. py:class:: GameImportRecruitPayout Bases: :py:obj:`pydantic.BaseModel` One ``SQI1:`` officer payout row: a drive's winning inviter (most qualifying recruits, ties each win). .. py:attribute:: event_id :type: uuid.UUID .. py:attribute:: title :type: str .. py:attribute:: inviter :type: str .. py:attribute:: copper :type: int .. py:attribute:: recruits :type: list[str] .. py:attribute:: settles_at :type: int .. py:data:: MAX_IMPORT_DRIVE_RECRUITS :value: 50 Cap on ``GameImportDrive.recruits``, the most relevant recruit rows for the addon's Events tab. .. py:class:: GameImportDriveLeader Bases: :py:obj:`pydantic.BaseModel` One inviter on a drive's leaderboard in the ``SQI1:`` import. .. py:attribute:: inviter :type: str .. py:attribute:: invited :type: int .. py:attribute:: counting :type: int .. py:attribute:: qualified :type: int .. py:class:: GameImportDriveRecruit Bases: :py:obj:`pydantic.BaseModel` One recruit's state in the ``SQI1:`` import. .. py:attribute:: recruit :type: str .. py:attribute:: inviter :type: str .. py:attribute:: status :type: DriveRecruitStatus .. py:attribute:: reason :type: DriveRecruitReason | None :value: None .. py:attribute:: qualifies_at :type: int | None .. py:class:: GameImportDrive Bases: :py:obj:`pydantic.BaseModel` ``GameImportEvent.recruitment``: a drive's leaderboard and recruits for the addon's Events tab. ``recruits`` is ordered counting first (soonest ``qualifies_at`` first), then invited (newest invite first), then qualified (newest first), then disqualified (newest first), truncated to ``MAX_IMPORT_DRIVE_RECRUITS``. .. py:attribute:: leaders :type: list[GameImportDriveLeader] .. py:attribute:: recruits :type: list[GameImportDriveRecruit] .. py:class:: RecruitmentDriveTotals Bases: :py:obj:`pydantic.BaseModel` Headcounts across a drive's recruits, by ``DriveRecruitStatus`` plus how many are paid. .. py:attribute:: invited :type: int .. py:attribute:: joined :type: int .. py:attribute:: counting :type: int .. py:attribute:: qualified :type: int .. py:attribute:: disqualified :type: int .. py:attribute:: paid :type: int .. py:class:: RecruitLeader Bases: :py:obj:`pydantic.BaseModel` One inviter's standing in a drive's leaderboard. .. py:attribute:: inviter :type: str .. py:attribute:: member_name :type: str | None .. py:attribute:: discord_id :type: str | None .. py:attribute:: invited :type: int .. py:attribute:: joined :type: int .. py:attribute:: counting :type: int .. py:attribute:: qualified :type: int .. py:class:: DriveRecruit Bases: :py:obj:`pydantic.BaseModel` One recruit's row in a drive's detail, including their qualification clock and pay state. .. py:attribute:: recruit :type: str .. py:attribute:: inviter :type: str .. py:attribute:: invited_at :type: datetime.datetime .. py:attribute:: joined_at :type: datetime.datetime | None .. py:attribute:: qualifies_at :type: datetime.datetime | None .. py:attribute:: status :type: DriveRecruitStatus .. py:attribute:: reason :type: DriveRecruitReason | None .. py:attribute:: paid_at :type: datetime.datetime | None .. py:class:: RecruitmentDrive Bases: :py:obj:`pydantic.BaseModel` ``GET /api/events/{event_id}/recruitment``: one drive's full detail, leaderboard, and recruit rows. .. py:attribute:: event_id :type: uuid.UUID .. py:attribute:: title :type: str .. py:attribute:: starts_at :type: datetime.datetime .. py:attribute:: ends_at :type: datetime.datetime .. py:attribute:: settles_at :type: datetime.datetime .. py:attribute:: reward_copper :type: int .. py:attribute:: min_level :type: int .. py:attribute:: stay_days :type: int .. py:attribute:: totals :type: RecruitmentDriveTotals .. py:attribute:: leaders :type: list[RecruitLeader] .. py:attribute:: recruits :type: list[DriveRecruit] .. py:class:: RecruitPayout Bases: :py:obj:`pydantic.BaseModel` ``GET /api/recruitment/payouts``: one winning inviter's owed (or already-paid) prize for one settled drive. .. py:attribute:: event_id :type: uuid.UUID .. py:attribute:: title :type: str .. py:attribute:: settles_at :type: datetime.datetime .. py:attribute:: inviter :type: str .. py:attribute:: member_name :type: str | None .. py:attribute:: recruits :type: list[str] .. py:attribute:: copper :type: int .. py:attribute:: paid_at :type: datetime.datetime | None .. py:attribute:: paid_by :type: str | None .. py:attribute:: paid_via :type: PaidVia | None .. py:class:: RecruitPayoutMarkPaid Bases: :py:obj:`pydantic.BaseModel` Body for ``POST /api/recruitment/payouts/paid`` (officer). Idempotent. .. py:attribute:: event_id :type: uuid.UUID .. py:attribute:: inviter :type: str .. py:class:: RecruitmentTally Bases: :py:obj:`pydantic.BaseModel` ``DiscordEventPush.recruitment``: a drive's live leaderboard, for the forum starter post. .. py:attribute:: reward_copper :type: int .. py:attribute:: settles_at :type: datetime.datetime .. py:attribute:: invited :type: int .. py:attribute:: joined :type: int .. py:attribute:: qualified :type: int .. py:attribute:: leaders :type: list[RecruitLeader] .. py:class:: RecruitShoutout Bases: :py:obj:`pydantic.BaseModel` One qualified recruit's shout-out, queued to post as a comment on the drive's forum thread. .. py:attribute:: id :type: uuid.UUID .. py:attribute:: thread_id :type: int .. py:attribute:: event_id :type: uuid.UUID .. py:attribute:: inviter :type: str .. py:attribute:: inviter_discord_id :type: int | None .. py:attribute:: recruit :type: str .. py:attribute:: reward_copper :type: int .. py:class:: RecruitShoutoutAck Bases: :py:obj:`pydantic.BaseModel` ``POST /api/guilds/{guild_id}/event-sync/recruit-shoutouts/ack``: the bot posted these shout-outs. .. py:attribute:: ids :type: list[uuid.UUID]