from __future__ import annotations
from datetime import datetime
from typing import ClassVar, Literal
from uuid import UUID

from pydantic import BaseModel, ConfigDict, Field


class UserBasicInfo(BaseModel):
    id: str
    username: str
    avatar_url: str | None = None


class FriendRequestCreate(BaseModel):
    model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")

    target_user_id: UUID
    content: str | None = Field(None, max_length=200)


class FriendRequestResponse(BaseModel):
    id: UUID
    sender: UserBasicInfo
    recipient: UserBasicInfo
    content: str | None
    status: Literal["pending", "accepted", "rejected", "canceled"]
    created_at: datetime


class FriendResponse(BaseModel):
    id: UUID
    friend: UserBasicInfo
    status: Literal["active"]
    created_at: datetime
    accepted_at: datetime | None


class FriendRequestAction(BaseModel):
    model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")

    pass
