from pydantic import BaseModel, Field
from datetime import datetime
from typing import Optional, List, Dict, Any


class BossTokenCreate(BaseModel):
    wt2: str = Field(..., description="Boss直聘wt2")
    mpt: str = Field(..., description="Boss直聘mpt")
    is_active: bool = Field(True, description="是否可用")


class BossTokenUpdate(BaseModel):
    wt2: Optional[str] = Field(None, description="Boss直聘wt2")
    mpt: Optional[str] = Field(None, description="Boss直聘mpt")
    is_active: Optional[bool] = Field(None, description="是否可用")
    failed_count: Optional[int] = Field(None, description="失败次数")
    last_used_time: Optional[datetime] = Field(None, description="最后使用时间")


class BossTokenResponse(BaseModel):
    id: int
    wt2: Optional[str]
    mpt: Optional[str]
    is_active: bool
    failed_count: int
    last_used_time: Optional[datetime]
    created_at: datetime
    updated_at: datetime

    class Config:
        from_attributes = True


class BossTokenList(BaseModel):
    total: int
    items: List[BossTokenResponse]