"""Pydantic models for GA4GH VA-Spec (Variant Annotation Specification).

VA-Spec provides a framework for representing variant annotations,
evidence, and interpretations. It defines structures for clinical
assertions about variants.
"""

from __future__ import annotations

from enum import Enum

from ai4gh.core.types import GA4GHBase


class Direction(str, Enum):
    """Direction of evidence support."""

    SUPPORTS = "supports"
    DISPUTES = "disputes"
    UNCERTAIN = "uncertain"


class Classification(str, Enum):
    """Variant classification categories (ACMG/AMP)."""

    PATHOGENIC = "pathogenic"
    LIKELY_PATHOGENIC = "likely_pathogenic"
    UNCERTAIN_SIGNIFICANCE = "uncertain_significance"
    LIKELY_BENIGN = "likely_benign"
    BENIGN = "benign"


class EvidenceLevel(str, Enum):
    """Strength of evidence."""

    VERY_STRONG = "very_strong"
    STRONG = "strong"
    MODERATE = "moderate"
    SUPPORTING = "supporting"
    STANDALONE = "standalone"


class Agent(GA4GHBase):
    """An agent (person, organization, or software) making contributions."""

    id: str | None = None
    type: str = "Agent"
    label: str | None = None
    description: str | None = None


class Contribution(GA4GHBase):
    """A contribution by an agent to an annotation."""

    type: str = "Contribution"
    contributor: Agent | None = None
    date: str | None = None
    activity: str | None = None


class Method(GA4GHBase):
    """A method used to generate evidence or interpretations."""

    id: str | None = None
    type: str = "Method"
    label: str | None = None
    url: str | None = None
    version: str | None = None


class Document(GA4GHBase):
    """A reference document (publication, guideline, etc.)."""

    id: str | None = None
    type: str = "Document"
    label: str | None = None
    url: str | None = None
    pmid: str | None = None
    doi: str | None = None


class EvidenceLine(GA4GHBase):
    """A line of evidence supporting or disputing an assertion."""

    id: str | None = None
    type: str = "EvidenceLine"
    direction: Direction | None = None
    strength: EvidenceLevel | None = None
    description: str | None = None
    evidence_items: list[Document] | None = None
    contributions: list[Contribution] | None = None


class Statement(GA4GHBase):
    """A statement (assertion) about a variant.

    This is the core unit of variant annotation: a claim
    about a variant's clinical significance, supported by
    evidence lines.
    """

    id: str | None = None
    type: str = "Statement"
    subject: str | None = None
    predicate: str | None = None
    object_descriptor: str | None = None
    classification: Classification | None = None
    direction: Direction | None = None
    description: str | None = None
    evidence_lines: list[EvidenceLine] | None = None
    method: Method | None = None
    contributions: list[Contribution] | None = None
    specified_by: Method | None = None
