{#-
 # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 # Copyright (C) 2021  UAVCAN Development Team  <uavcan.org>
 # This software is distributed under the terms of the MIT License.
-#}
{{ composite_type | definition_begin }}
{
    // +----------------------------------------------------------------------+
    // | PORT IDENTIFIERS
    // +----------------------------------------------------------------------+
{%- if T.has_fixed_port_id %}
    static constexpr bool HasFixedPortID = true;
    static constexpr {{ typename_unsigned_port }} FixedPortId = {{ T.fixed_port_id }}U;
{%- else %}
    /// This type does not have a fixed port-ID. See https://forum.uavcan.org/t/choosing-message-and-service-ids/889
    static constexpr bool HasFixedPortID = false;
{% endif -%}
{%- for constant in composite_type.constants %}
    {% if loop.first %}
    // +----------------------------------------------------------------------+
    // | CONSTANTS
    // +----------------------------------------------------------------------+
    {% endif -%}
    static constexpr {{ constant.data_type | declaration }} {{ constant.name | id }} = {{ constant | constant_value }};
{%- endfor -%}
{%- if composite_type is UnionType -%}
{% include '_fields_as_union.j2' %}
{%- else -%}
{% include '_fields.j2' %}
{%- endif -%}
{%- if not nunavut.support.omit %}
    {{ typename_unsigned_length }} serialize(std::size_t todo_ser = 0)
    {
        // TODO: implement this routine
        (void)todo_ser;
        return 0;
    }
{%- endif %}

}{{ composite_type | definition_end }}{#- -#}
