{# =============================================================================
   TYPESCRIPT INTERFACES TEMPLATE - Generates type definitions
   Uses sparql_results array with ?-prefixed keys
   ============================================================================= #}
/**
 * Generated TypeScript interfaces from RDF ontology
 * DO NOT EDIT - auto-generated by ggen sync
 */

{%- set current_entity = "" -%}
{%- for row in sparql_results -%}
{%- set entityName = row["?entityName"] | default(value="") -%}
{%- set entityDescription = row["?entityDescription"] | default(value="") -%}
{%- set propertyName = row["?propertyName"] | default(value="") -%}
{%- set propertyType = row["?propertyType"] | default(value="string") -%}
{%- set required = row["?required"] | default(value="false") -%}
{%- set isArray = row["?isArray"] | default(value="false") -%}
{%- set refEntity = row["?refEntity"] | default(value="") -%}

{%- if entityName != current_entity -%}
{%- if current_entity != "" %}
}

{% endif -%}
{%- set_global current_entity = entityName %}
/**
 * {{ entityName }}{% if entityDescription != "" %} - {{ entityDescription }}{% endif %}

 */
export interface {{ entityName }} {
{%- endif %}
  {{ propertyName }}{% if required != "true" %}?{% endif %}: {% if propertyType == "string" %}string{% elif propertyType == "integer" %}number{% elif propertyType == "number" %}number{% elif propertyType == "boolean" %}boolean{% elif propertyType == "datetime" %}string{% elif propertyType == "date" %}string{% elif propertyType == "reference" %}{{ refEntity }}[]{% else %}string{% endif %};
{%- endfor %}
}
