"""Tests for refget models."""

from __future__ import annotations

from ai4gh.specs.refget.models import RefgetAlias, RefgetMetadata


class TestRefgetAlias:
    def test_basic(self) -> None:
        alias = RefgetAlias(alias="chr1", naming_authority="UCSC")
        assert alias.alias == "chr1"
        assert alias.naming_authority == "UCSC"


class TestRefgetMetadata:
    def test_minimal(self) -> None:
        m = RefgetMetadata(id="seq-1", length=1000)
        assert m.id == "seq-1"
        assert m.length == 1000
        assert m.md5 is None
        assert m.aliases is None

    def test_full(self) -> None:
        m = RefgetMetadata(
            id="seq-1",
            length=248956422,
            md5="6aef897c3d6ff0c78aff06ac189178dd",
            trunc512="f7f5e8da3ec02a5f7c3e2f3fcf53f8a2",
            ga4gh="SQ.abc123",
            aliases=[
                RefgetAlias(alias="chr1", naming_authority="UCSC"),
                RefgetAlias(alias="1", naming_authority="ensembl"),
            ],
        )
        assert m.md5 is not None
        assert m.ga4gh == "SQ.abc123"
        assert m.aliases is not None
        assert len(m.aliases) == 2
        assert m.aliases[0].alias == "chr1"
