# -*- coding: utf-8 -*-

"""Generate the Resilient customizations required for {{package}}"""

from __future__ import print_function
from resilient_circuits.util import *


def customization_data(client=None):
    """Produce any customization definitions (types, fields, message destinations, etc)
       that should be installed by `resilient-circuits customize`
    """

    # This import data contains:
{%if incident_fields|length > 0 %}    #   Incident fields:
    #     {{incident_fields.values()|map(attribute="name")|sort|join("\n    #     ")}}
{%endif%}{%if action_fields|length > 0 %}    #   Action fields:
    #     {{action_fields.values()|map(attribute="name")|sort|join("\n    #     ")}}
{%endif%}{%if function_params|length > 0 %}    #   Function inputs:
    #     {{function_params.values()|map(attribute="name")|sort|join("\n    #     ")}}
{%endif%}{%if datatables.keys()%}    #   DataTables:
    #     {{datatables.keys()|sort|join("\n    #     ")}}
{%endif%}{%if message_destinations.keys()%}    #   Message Destinations:
    #     {{message_destinations.keys()|sort|join("\n    #     ")}}
{%endif%}{%if functions.keys()%}    #   Functions:
    #     {{functions.keys()|sort|join("\n    #     ")}}
{%endif%}{%if phases.keys()%}    #   Phases:
    #     {{phases.keys()|sort|join("\n    #     ")}}
{%endif%}{%if automatic_tasks.keys()%}    #   Tasks:
    #     {{automatic_tasks.keys()|sort|join("\n    #     ")}}
{%endif%}{%if scripts.keys()%}    #   Scripts:
    #     {{scripts.keys()|sort|join("\n    #     ")}}
{%endif%}{%if workflows.keys()%}    #   Workflows:
    #     {{workflows.keys()|sort|join("\n    #     ")}}
{%endif%}{%if actions.keys()%}    #   Rules:
    #     {{actions.keys()|sort|join("\n    #     ")}}
{%endif%}

    yield ImportDefinition(u"""
{{export_data|base64}}"""
    )

