
{{ vars.search_options.imports|generate_import }}
from flask_babelex import lazy_gettext as _
from . import facets


class {{ vars.search_options| class_header }}:
    """{{ vars.record.class|base_name }} search options."""

    facet_groups ={
        {% for group in facet_groups %}
            '{{ group }}': {
                {% for dict in facet_groups[group].keys() %}
                    '{{ dict}}' : {{ facet_groups[group][dict] }},

                {%  endfor %}
            {% for base_class in vars.search_options.base_classes %}
                **getattr(({{ base_class|base_name }}, 'facet_groups', {}).get('{{group }}', {}))
            {% endfor %}
            },
        {%  endfor %}
    }

    facets = {
{% for dict in default_group %}
{% for key, value in dict.items()%}
    '{{ key }}': {{ value }},
{% endfor %}
{% endfor %}
{% for base_class in vars.search_options.base_classes %}
    **getattr({{ base_class|base_name }}, 'facets', {})
{% endfor %}
    }
    sort_options = {
        {% if vars.search_options.base_classes %}
            {% for base_class in vars.search_options.base_classes %}
                **{{ base_class|base_name }}.sort_options,
            {% endfor %}
{#        **{{ vars.search_options_bases[0]|base_name }}.sort_options,#}
        {% else %}
        **InvenioSearchOptions.sort_options,
        {% endif %}
{% for dict in sort_definition %}
{% for key, value in dict.items()%}
    '{{ key }}': {{ value }},
{% endfor %}
{% endfor %}
    }

{{ vars.search_options.extra_code }}