from datetime import datetime
from typing import List, Optional

from pydantic import BaseModel, Field


class UserOAuthAccountOut(BaseModel):
    id: str = Field(..., description="主键")
    oauth_id: str = Field(..., description="授权表中的id")
    advertiser_id: Optional[str] = Field(None, description="广告主账户id")
    advertiser_name: Optional[str] = Field(None, description="广告账户名")
    advertiser_role: Optional[str] = Field(None, description="广告账户类型")
    created_at: datetime = Field(..., description="创建时间")
    updated_at: datetime = Field(..., description="更新时间")


class PaginationInfo(BaseModel):
    page: int = Field(..., description="当前页码")
    page_size: int = Field(..., description="每页数量")
    total: int = Field(..., description="总记录数")
    total_pages: int = Field(..., description="总页数")


class OAuthAccountListResponse(BaseModel):
    code: int = Field(0, description="返回码，0表示成功")
    message: str = Field("查询成功", description="返回消息")
    data: List[UserOAuthAccountOut] = Field(..., description="授权账户列表数据")
    pagination: PaginationInfo = Field(..., description="分页信息")


class DeleteOAuthAccountRequest(BaseModel):
    id: str = Field(..., description="授权账户表id")
