File size: 2,822 Bytes
fe40b87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
from datetime import datetime
from typing import Literal
from uuid import UUID

from app.common.schemas import Page, RequestModel, ResponseModel


class Cards(ResponseModel):
    g: int
    y: int
    r: int


class CoachActivity(ResponseModel):
    id: UUID
    name: str
    coaches: str
    reviews: int


class EarningsBar(ResponseModel):
    month: str
    amount_minor: int


class Dashboard(ResponseModel):
    month: str
    currency: str | None = None
    earnings_minor: int | None = None
    paying_players: int | None = None
    per_player_minor: int | None = None
    active_players: int
    new_this_month: int
    improving_pct: int | None
    analyses_this_week: int
    avg_review_hours: float | None
    cards: Cards
    coaches: list[CoachActivity]
    pending_requests: int
    not_filmed_7d: int
    earnings_bars: list[EarningsBar] = []
    unavailable_reason: str | None = None
    as_of: datetime


class DashboardResponse(ResponseModel):
    dashboard: Dashboard


class Payout(ResponseModel):
    id: UUID
    scheduled_for: str
    amount_minor: int | None
    status: Literal["scheduled", "paid", "failed", "cancelled"]
    paid_at: datetime | None


class Earnings(ResponseModel):
    month: str
    currency: str | None = None
    month_minor: int | None = None
    players: int | None = None
    per_player_minor: int | None = None
    ytd_minor: int | None = None
    projected_minor: int | None = None
    as_of: datetime
    payouts: list[Payout] = []
    next_cursor: str | None = None
    unavailable_reason: str | None = None


class EarningsResponse(ResponseModel):
    earnings: Earnings


class CorpKpis(ResponseModel):
    locations_live: int
    active_players: int
    analyses: int
    improving_pct: int | None


class CorpLocation(ResponseModel):
    id: UUID
    name: str
    active_players: int
    improving_pct: int | None


class CorpFix(ResponseModel):
    metric_id: str
    label: str
    mode: Literal["h", "p"]
    affected_pct: int | None


class Corporate(ResponseModel):
    month: str
    as_of: datetime
    kpis: CorpKpis
    locations: list[CorpLocation]
    fixes: list[CorpFix]


class CorporateResponse(ResponseModel):
    corporate: Corporate


class ConsentItem(ResponseModel):
    player_id: UUID
    name: str
    group: str
    group_ids: list[UUID]
    note: str
    version: str | None
    accepted_at: datetime | None
    withdrawn_at: datetime | None
    help_improve_ai: bool


class ConsentPage(Page[ConsentItem]):
    accepted: int
    ai_opt_in: int


class ConsentExportRequest(RequestModel):
    format: Literal["csv"] = "csv"
    group_id: UUID | None = None


class ExportOut(ResponseModel):
    id: UUID
    status: str
    url: str
    expires_at: datetime
    filename: str


class ExportResponse(ResponseModel):
    export: ExportOut