"""Integration tests for schema introspection.

These tests require a running PostgreSQL instance with AGE.
"""

import pytest

pytestmark = pytest.mark.integration


def test_get_schema_returns_structure(fresh_graph):
    db = fresh_graph
    db.cypher("CREATE (:Person {name: 'Alice'})")
    db.cypher("CREATE (:Company {name: 'Acme'})")
    db.commit()

    db.cypher(
        "MATCH (a:Person), (b:Company) "
        "CREATE (a)-[:WORKS_AT]->(b)"
    )
    db.commit()

    schema = db.get_schema()
    assert "vertex_labels" in schema
    assert "edge_labels" in schema
    assert "vector_indexes" in schema
    assert schema["graph"] == db.graph

    vertex_names = [vl["name"] for vl in schema["vertex_labels"]]
    assert "Person" in vertex_names
    assert "Company" in vertex_names

    edge_names = [el["name"] for el in schema["edge_labels"]]
    assert "WORKS_AT" in edge_names
