{
    ">>": "wheel_merge",
    "wheel_merge": {
        "type": "Merge2",
        "inputs": ["<<", "wheel_channel_create"],
        "attr": {{ attrs["merge"]["under_all"] | tojson }}
    },
    "wheel_channel_create": {
        "type": "Copy",
        "inputs": ["wheel_switch", "wheel_channel_create_dot"],
        "attr": {{ attrs["copy"]["wheel"] | tojson }}
    },
    "wheel_channel_create_dot": {
        "type": "Dot",
        "inputs": [],
        "attr": {{ attrs["dot"]["terminator"] | tojson }}
    },
    "wheel_switch": {
        "type": "Switch",
        "inputs": [
            {% set seperate = joiner(",") %}
            {% for option in api_data | filter_sort('type', 'wheel', 'switch') %}
                {{ seperate() }}
                {% if option['color'] %}
                    "{{ option['name'] + "_color_switch" }}"
                {% else %}
                    "{{ option['name'] }}"
                {% endif %}
            {% endfor %}
        ],
        "attr": {}
    },

    {% set seperate = joiner(",") %}
    {% for option in api_data | filter_sort('type', 'wheel', 'switch') %}
        {{ seperate() }}
        {% if option['color'] %}
            "{{ option['name'] + "_color_switch" }}": {
                "type": "Switch",
                "inputs": [
                    {% set seperate_inner = joiner(",") %}
                    {% for color in api_data | filter_sort('type', 'color', 'switch') %}
                        {{ seperate_inner() }}
                        "{{ option['name'] + "_" + color['name'] }}"
                    {% endfor %}
                ],
                "attr": {}
            }
        {% else %}
            "{{ option['name'] }}": {
                "type": "NoOp",
                "inputs": [],
                "attr": {}
            }
        {% endif %}
    {% endfor %}

    {% if api_data | filter_sort('type', 'wheel', 'switch') | any('color') %}
    ,
    {% endif %}

    {% set seperate = joiner(",") %}
    {% for option in api_data | filter_sort('type', 'wheel', 'switch') %}
        {% if option['color'] %}
            {% for color in api_data | filter_sort('type', 'color', 'switch') %}
                {{ seperate() }}
                "{{ option['name'] + "_" + color['name'] }}": {
                    "type": "NoOp",
                    "inputs": [],
                    "attr": {}
                    }
            {% endfor %}
        {% endif %}
    {% endfor %}
}
