"""Nautilus models package."""

from __future__ import annotations

{%- for module_name in model_modules %}
from . import {{ module_name }} as _{{ module_name }}
from .{{ module_name }} import *
{%- endfor %}

# Resolve forward references for models with cross-model relations.
# Pydantic v2 requires model_rebuild() to be called after all referenced
# model classes are available in the current scope.
{%- for class_name in model_classes %}
{{ class_name }}.model_rebuild()
{%- endfor %}

__all__ = []
for _module in (
{%- for module_name in model_modules %}
    _{{ module_name }},
{%- endfor %}
):
    __all__.extend(getattr(_module, "__all__", ()))

{%- if model_modules | length > 0 %}
del _module
{%- for module_name in model_modules %}
del _{{ module_name }}
{%- endfor %}
{%- endif %}
