File size: 2,232 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
"""N01 to N05 bodies."""

from datetime import datetime
from typing import Annotated, Literal
from uuid import UUID

from pydantic import AfterValidator, Field

from app.common.schemas import RequestModel, ResponseModel
from app.modules.auth.schemas import normalize_email

Email = Annotated[str, Field(max_length=254), AfterValidator(normalize_email)]


class SettingsOut(ResponseModel):
    coach_can_see_sessions: bool
    share_with_parent: bool
    parent_email: str | None
    auto_monthly_report: bool
    private_links: bool
    clips_as_examples: bool
    help_improve_ai: bool
    notify_results: bool
    notify_coach: bool
    notify_drills: bool
    notify_weekly: bool
    consented_at: datetime | None
    consent_version: str | None
    skip_filming_guide: bool
    version: int


class SettingsEnvelope(ResponseModel):
    settings: SettingsOut


class SettingsPatch(RequestModel):
    coach_can_see_sessions: bool | None = Field(None, strict=True)
    share_with_parent: bool | None = Field(None, strict=True)
    parent_email: Email | None = None
    auto_monthly_report: bool | None = Field(None, strict=True)
    private_links: bool | None = Field(None, strict=True)
    clips_as_examples: bool | None = Field(None, strict=True)
    help_improve_ai: bool | None = Field(None, strict=True)
    notify_results: bool | None = Field(None, strict=True)
    notify_coach: bool | None = Field(None, strict=True)
    notify_drills: bool | None = Field(None, strict=True)
    notify_weekly: bool | None = Field(None, strict=True)
    skip_filming_guide: bool | None = Field(None, strict=True)
    expected_version: int | None = Field(None, ge=1)


class ConsentIn(RequestModel):
    version: str = Field(min_length=1, max_length=16)
    accepted: Literal[True]


class ConsentOut(ResponseModel):
    version: str | None
    accepted_at: datetime
    withdrawn_at: datetime | None = None


class ConsentEnvelope(ResponseModel):
    consent: ConsentOut


class ExportIn(RequestModel):
    scope: Literal["videos"]


class ExportOut(ResponseModel):
    id: UUID
    status: str
    requested_at: datetime
    delivery: Literal["account_email"] = "account_email"


class ExportEnvelope(ResponseModel):
    export: ExportOut