from datetime import datetime

from pydantic import BaseModel, Field


class RequestOAuthRequest(BaseModel):
    open_type: int = Field(
        ...,
        description="开户方式（1=千川，2=广告，3=本地推，4=星图，5=快手代理商，6=巨量星图，7=巨量服务单，8=腾讯服务单，9=腾讯营销K2，10=腾讯营销K3）",
    )


class RequestOAuthResponse(BaseModel):
    auth_url: str = Field(..., description="第三方授权链接")


class UserOAuthOut(BaseModel):
    id: str = Field(..., description="主键")
    account_id: str = Field(..., description="授权账户id")
    account_name: str = Field(..., description="授权账户name")
    account_role: str | None = Field(None, description="授权账户角色")
    account_username: str | None = Field(None, description="授权账户登录账号")
    user_id: str = Field(..., description="用户id")
    open_type: int = Field(..., description="开户方式")
    port_type: int = Field(..., description="平台端口")
    appid: str | None = Field(None, description="授权应用id")
    material_auth_status: bool = Field(False, description="是否敏感物料授权")
    created_at: datetime = Field(..., description="创建时间")
    updated_at: datetime = Field(..., description="更新时间")