from dataclasses import dataclass, field
from typing import Any, Literal, Optional


GlossaryTermSource = Literal["MANUAL", "EXTRACTED"]
BindingTargetType = Literal["ENTITY_CLASS", "ATTRIBUTE", "METRIC", "FILTER"]


@dataclass
class GlossaryBinding:
    """A DSS glossary binding between a term and a schema element."""

    termId: str
    targetEntityClass: str
    targetType: BindingTargetType
    targetName: Optional[str] = None
    created: Optional[dict[str, Any]] = None


@dataclass
class GlossaryTerm:
    """A DSS glossary term (version-level, no mappings - mappings are via bindings)."""

    id: str
    term: str
    description: Optional[str] = None
    source: GlossaryTermSource = "MANUAL"
    userModified: bool = False
    synonyms: list[str] = field(default_factory=list)
    created: Optional[dict[str, Any]] = None
    modified: Optional[dict[str, Any]] = None
    privateEditorData: dict[str, Any] = field(default_factory=dict)
