import datetime

from pydantic import BaseModel


class NewsItemResponse(BaseModel):
    id: int
    headline: str
    summary: str
    source_url: str | None = None
    image_url: str | None = None
    image_credit: str | None = None
    tldr_points: list[str] | None = None
    summary_body: str | None = None
    source_citation: str | None = None
    summary_image_url: str | None = None
    summary_image_credit: str | None = None
    published_at: datetime.datetime
    created_at: datetime.datetime
    language: str

    model_config = {"from_attributes": True}


class PaginatedNewsResponse(BaseModel):
    items: list[NewsItemResponse]
    next_cursor: int | None = None
    has_more: bool = False


class NewsTranslationResponse(BaseModel):
    id: int
    news_item_id: int
    language: str
    headline: str
    summary: str
    tldr_points: list[str] | None = None
    summary_body: str | None = None
    source_citation: str | None = None
    created_at: datetime.datetime

    model_config = {"from_attributes": True}


class HealthResponse(BaseModel):
    status: str
    version: str
    news_count: int
