from abc import ABC, abstractmethod
from typing import Optional

from pydantic import BaseModel


class PublishResult(BaseModel):
    success: bool
    platform: str
    article_id: Optional[str] = None
    article_url: Optional[str] = None
    error: Optional[str] = None
    raw_response: dict = {}


class ContentPublisher(ABC):
    platform: str = ""

    @abstractmethod
    async def publish(self, title: str, content: str, **kwargs) -> PublishResult:
        pass

    @abstractmethod
    async def verify_credentials(self) -> bool:
        pass

    @abstractmethod
    async def get_article_status(self, article_id: str) -> dict:
        pass
