"""Keyword Models"""
from pydantic import BaseModel, Field
from typing import List
from datetime import datetime


class KeywordExtractRequest(BaseModel):
    """주요 키워드 추출 요청"""
    meeting_id: str = Field(..., description="회의 ID")
    transcript_text: str = Field(..., description="전체 회의록 텍스트")
    max_keywords: int = Field(default=10, ge=1, le=20, description="최대 키워드 개수")

    class Config:
        json_schema_extra = {
            "example": {
                "meeting_id": "550e8400-e29b-41d4-a716-446655440000",
                "transcript_text": "안건 1: 신제품 기획...\n타겟 고객을 20-30대로 설정...",
                "max_keywords": 10
            }
        }


class ExtractedKeyword(BaseModel):
    """추출된 키워드"""
    keyword: str = Field(..., description="키워드")
    relevance_score: float = Field(..., ge=0.0, le=1.0, description="관련성 점수")
    frequency: int = Field(..., description="출현 빈도")
    category: str = Field(..., description="카테고리 (예: 기술, 전략, 일정 등)")

    class Config:
        json_schema_extra = {
            "example": {
                "keyword": "신제품기획",
                "relevance_score": 0.95,
                "frequency": 15,
                "category": "전략"
            }
        }


class KeywordExtractResponse(BaseModel):
    """주요 키워드 추출 응답"""
    meeting_id: str = Field(..., description="회의 ID")
    keywords: List[ExtractedKeyword] = Field(..., description="추출된 키워드 목록")
    total_count: int = Field(..., description="전체 키워드 개수")
    extracted_at: datetime = Field(default_factory=datetime.utcnow, description="추출 시각")

    class Config:
        json_schema_extra = {
            "example": {
                "meeting_id": "550e8400-e29b-41d4-a716-446655440000",
                "keywords": [
                    {
                        "keyword": "신제품기획",
                        "relevance_score": 0.95,
                        "frequency": 15,
                        "category": "전략"
                    },
                    {
                        "keyword": "예산편성",
                        "relevance_score": 0.88,
                        "frequency": 12,
                        "category": "재무"
                    }
                ],
                "total_count": 10,
                "extracted_at": "2025-01-23T10:30:00Z"
            }
        }
