from dataclasses import dataclass
from datetime import datetime


@dataclass(frozen=True, slots=True)
class KnowledgeDocument:
    id: str
    title: str
    document_type: str
    source_name: str
    product_code: str | None
    content: str
    status: str
    version_no: int
    chunk_count: int
    created_by: str
    created_at: datetime
    updated_at: datetime
    indexed_at: datetime | None = None
    published_at: datetime | None = None


@dataclass(frozen=True, slots=True)
class KnowledgeChunk:
    id: str
    document_id: str
    document_version: int
    ordinal: int
    title: str
    content: str
    document_type: str
    source_name: str
    product_code: str | None


@dataclass(frozen=True, slots=True)
class KnowledgeSearchHit:
    chunk_id: str
    document_id: str
    document_version: int
    ordinal: int
    title: str
    content: str
    document_type: str
    source_name: str
    product_code: str | None
    score: float


@dataclass(frozen=True, slots=True)
class KnowledgeSearchTest:
    id: str
    document_id: str
    query: str
    hit_count: int
    top_score: float | None
    passed: bool
    tested_by: str
    created_at: datetime
