73 lines
2.0 KiB
Python
73 lines
2.0 KiB
Python
"""Account Settings API schemas."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
AccountLanguage = Literal["zh-CN", "en-US"]
|
|
AccountAnswerDepth = Literal["concise", "balanced", "deep"]
|
|
AccountEvidenceDisplay = Literal["summary", "inline", "full"]
|
|
AccountNotificationKey = Literal[
|
|
"pendingConfirmation",
|
|
"executionWriteback",
|
|
"releaseGate",
|
|
"failureAlert",
|
|
]
|
|
AccountSettingsSaveScope = Literal["local", "account"]
|
|
|
|
|
|
class AccountProfileSettings(BaseModel):
|
|
displayName: str = Field(min_length=1, max_length=100)
|
|
roleTitle: str = Field(min_length=1, max_length=100)
|
|
email: str = Field(default="", max_length=255)
|
|
defaultLanguage: AccountLanguage = "zh-CN"
|
|
|
|
|
|
class AccountAiPreferenceSettings(BaseModel):
|
|
answerDepth: AccountAnswerDepth = "balanced"
|
|
evidenceDisplay: AccountEvidenceDisplay = "inline"
|
|
|
|
|
|
class AccountNotificationPreference(BaseModel):
|
|
enabled: bool = True
|
|
desktop: bool = True
|
|
emailDigest: bool = False
|
|
|
|
|
|
class AccountNotificationSettings(BaseModel):
|
|
pendingConfirmation: AccountNotificationPreference
|
|
executionWriteback: AccountNotificationPreference
|
|
releaseGate: AccountNotificationPreference
|
|
failureAlert: AccountNotificationPreference
|
|
|
|
|
|
class AccountSettingsUpdateRequest(BaseModel):
|
|
profile: AccountProfileSettings
|
|
aiPreferences: AccountAiPreferenceSettings
|
|
notifications: AccountNotificationSettings
|
|
|
|
|
|
class AccountSettingsResponse(AccountSettingsUpdateRequest):
|
|
model_config = ConfigDict(populate_by_name=True)
|
|
|
|
saveScope: AccountSettingsSaveScope = "account"
|
|
updatedAt: str
|
|
|
|
|
|
__all__ = [
|
|
"AccountAiPreferenceSettings",
|
|
"AccountAnswerDepth",
|
|
"AccountEvidenceDisplay",
|
|
"AccountLanguage",
|
|
"AccountNotificationKey",
|
|
"AccountNotificationPreference",
|
|
"AccountNotificationSettings",
|
|
"AccountProfileSettings",
|
|
"AccountSettingsResponse",
|
|
"AccountSettingsSaveScope",
|
|
"AccountSettingsUpdateRequest",
|
|
]
|