1"""Models for the Guild API.
2
3Forever guilds have no realm: a guild's address is its slug alone, such as ``/data/wow/guild/sidequest``. The guild's
4activity and achievements documents answer, but hold nothing beyond a link back to the guild yet.
5"""
6
7from wow.models._common import Document, IdRef, Link, Model, Ref, TypedName
8
9__all__ = ["FactionType", "Guild", "GuildMember", "GuildRef", "GuildRoster", "GuildRosterCharacter"]
10
11
[docs]
12class GuildRef(Model):
13 """A link to a guild, as characters and rosters carry it."""
14
15 key: Link
16 id: int
17 name: str
18 slug: str
19 faction: TypedName
20
21
[docs]
22class Guild(Document):
23 """A guild: its faction, ruleset, size and links to its roster.
24
25 Attributes:
26 name_search: The name as Battle.net indexes it for lookups.
27 created_timestamp: When the guild was founded, in Unix milliseconds.
28 """
29
30 id: int
31 name: str
32 slug: str
33 name_search: str
34 faction: TypedName
35 ruleset: Ref
36 achievement_points: int
37 member_count: int
38 created_timestamp: int
39 roster: Link
40 achievements: Link
41 activity: Link
42
43
[docs]
44class FactionType(Model):
45 """A faction constant with no label, such as ``{"type": "ALLIANCE"}``, as roster entries carry it."""
46
47 type: str
48
49
[docs]
50class GuildRosterCharacter(Model):
51 """A character as a guild roster lists it. Class and race carry only their ids."""
52
53 key: Link
54 id: int
55 name: str
56 surname: str
57 slug: str
58 level: int
59 playable_class: IdRef
60 playable_race: IdRef
61 faction: FactionType
62
63
[docs]
64class GuildMember(Model):
65 """One roster entry. ``rank`` 0 is the Guild Master; each higher number is a lower rank."""
66
67 character: GuildRosterCharacter
68 rank: int
69
70
[docs]
71class GuildRoster(Document):
72 """Every member of a guild."""
73
74 guild: GuildRef
75 members: tuple[GuildMember, ...] = ()