// this file is @generated
#![warn(unreachable_pub)]

pub(crate) mod client;

pub use self::client::{Svix, SvixOptions};

{% macro resource_mods(resource) -%}
mod {{ resource.name | to_snake_case }};
{%- for _, sub in resource.subresources | items -%}
    {{- resource_mods(sub) -}}
{%- endfor -%}
{% endmacro -%}

{% for res in api.resources -%}
    {{ resource_mods(res) -}}
{% endfor %}

{% macro resource_reexports(resource) -%}
    {% set resource_type_name = resource.name | to_upper_camel_case -%}
    {{ resource.name | to_snake_case }}::{
        {{ resource_type_name }},
        {% for op in resource.operations -%}
            {% if op | has_query_or_header_params -%}
                {{ resource_type_name }}{{ op.name | to_upper_camel_case }}Options,
            {% endif -%}
        {% endfor -%}
    },
    {% for _, sub in resource.subresources | items -%}
        {{ resource_reexports(sub) -}}
    {% endfor -%}
{% endmacro -%}

#[cfg(feature = "svix_beta")]
pub use self::message::{V1MessageEventsParams, V1MessageEventsSubscriptionParams};
pub use self::{
    {% for res in api.resources -%}
        {{ resource_reexports(res) }}
    {% endfor -%}
};

impl Svix {
    {% for resource in api.resources -%}
        {% set resource_type_name = resource.name | to_upper_camel_case -%}
        pub fn {{ resource.name | to_snake_case }}(&self) -> {{ resource_type_name }}<'_> {
            {{ resource_type_name }}::new(&self.cfg)
        }
    {% endfor -%}
}
