{%- from "introspection" import extend_list %}

namespace {{ name }} {
    {% include "introspection" %}
}

{{ jsdoc if jsdoc }}
interface {{ name }} {{ extend_list(extends) }} {
    readonly $signals: {{ name }}.SignalSignatures
    readonly $readableProperties: {{ name }}.ReadableProperties
    readonly $writableProperties: {{ name }}.WritableProperties
    readonly $constructOnlyProperties: {{ name }}.ConstructOnlyProperties

    {%- for property in properties %}
    {{ property.jsdoc|indent(4) }}
    {%- if property.readable %}
    get {{ property.name|camel_case }}(): {{ property.type }}
    {%- endif %}
    {%- if property.writable and not property.constuct_only %}
    set {{ property.name|camel_case }}(value: {{ property.type }})
    {%- endif %}
    {%- endfor %}

    {%- for method in methods %}
    {{ method|indent(4) }}
    {%- endfor %}

    {%- for method in virtual_methods %}
    {{ method|indent(4) }}
    {%- endfor %}
}

interface {{ name_class }}{% if parent_class %} extends Omit<{{ parent_class }}, "new">{% endif %} {
    readonly $gtype: GObject.GType<{{ name }}>
    readonly prototype: {{ name }}

    {%- if not is_abstract %}
    new (props?: Partial<GObject.ConstructorProps<{{ name }}>>): {{ name }}
    {%- endif %}

    {%- for ctor in constructors %}
    {{ ctor|indent(4) }}
    {%- endfor %}

    {%- for fn in functions %}
    {{ fn|indent(4) }}
    {%- endfor %}

    {%- for fn in class_functions %}
    {{ fn|indent(4) }}
    {%- endfor %}
}

const {{ name }}: {{ name_class }}
