#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
海报生成相关接口定义
"""

from abc import ABC, abstractmethod
from typing import Dict, List, Any, Optional, Union
from dataclasses import dataclass
from pathlib import Path


@dataclass
class PosterRequest:
    """海报生成请求"""
    content: str
    template_name: str = "vibrant"
    size: str = "1080x1080"
    style_params: Optional[Dict[str, Any]] = None


@dataclass
class PosterResult:
    """海报生成结果"""
    image_path: str
    thumbnail_path: Optional[str] = None
    metadata: Dict[str, Any] = None
    success: bool = True
    error_message: Optional[str] = None


class IPosterGenerator(ABC):
    """海报生成器接口"""
    
    @abstractmethod
    async def generate_poster(self, request: PosterRequest) -> PosterResult:
        """生成海报"""
        pass
    
    @abstractmethod
    def get_available_templates(self) -> List[str]:
        """获取可用模板列表"""
        pass


class ITextGenerator(ABC):
    """海报文案生成器接口"""
    
    @abstractmethod
    async def generate_poster_text(self, content: str, style: str = "default") -> str:
        """为海报生成文案"""
        pass


class IPosterService(ABC):
    """海报服务接口 - 应用服务层"""
    
    @abstractmethod
    async def create_poster_with_content(
        self,
        content: str,
        template_name: str = "vibrant",
        generate_text: bool = True
    ) -> PosterResult:
        """根据内容创建海报（可选生成专用文案）"""
        pass
    
    @abstractmethod
    async def batch_generate_posters(
        self,
        contents: List[str],
        template_name: str = "vibrant"
    ) -> List[PosterResult]:
        """批量生成海报"""
        pass 