from typing import Any, List, Optional

from infrahub_sync.adapters.{{ adapter.name }} import {{ adapter.name.title() }}Model

# -------------------------------------------------------
# AUTO-GENERATED FILE, DO NOT MODIFY
#  This file has been generated with the command `infrahub-sync generate`
#  All modifications will be lost the next time you reexecute this command
# -------------------------------------------------------
{%- for nodekind, node in schema.items() -%}
{%-   if node | get_identifiers(config) and config | has_node(node.kind) %}

class {{ nodekind }}({{ adapter.name.title() }}Model):
    _modelname = "{{ node.kind }}"
    _identifiers = {{ node | get_identifiers(config) | list_to_set }}
    _attributes = {{ node | get_attributes(config) | list_to_set }}
{%- if node | has_children(config) %}
    _children: List[str] = {{ node | get_children(config) }}
{%- endif -%}

{%-    for attr in node.attributes -%}
{%-      if config | has_field(node.kind, attr.name) %}
    {{ attr.name }}: {{ attr | get_kind }}
{%-       endif -%}
{%-    endfor %}
{%-    for rel in node.relationships -%}
{%-      if config | has_field(node.kind, rel.name) %}
    {{ rel.name }}: {{ rel | get_kind }}
{%-       endif -%}
{%-    endfor %}
    local_id: Optional[str] = None
    local_data: Optional[Any] = None
{%-   endif -%}
{% endfor %}
