{%- import 'common.j2' as c %}

{%- set my_file_name  = ctx.root_namespace | pascal_case ~ "Attributes.cs" -%}
{%- set my_class_name = ctx.root_namespace | pascal_case ~ "Attributes" -%}
{{- template.set_file_name(my_file_name) -}}

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// <auto-generated>This file has been auto generated from 'src\OpenTelemetry.SemanticConventions\scripts\templates\registry\SemanticConventionsAttributes.cs.j2' </auto-generated>

#nullable enable

#pragma warning disable CS1570 // XML comment has badly formed XML

namespace OpenTelemetry.SemanticConventions;

/// <summary>
/// Constants for semantic attribute names outlined by the OpenTelemetry specifications.
/// </summary>
public static class {{my_class_name}}
{
{% for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) %}
{% set attr_name = c.attribute_name(attribute) %}
{% if not loop.first %}{{"\n"}}{% endif %}
    {{ attribute.brief | comment(indent=4) }}
{% if attribute.note %}
    {{ attribute.note | comment(header="/// <remarks>", footer="/// </remarks>", indent=4) }}
{% endif %}
{% if attribute.deprecated %}
    [Obsolete("{{ attribute.deprecated | replace("\"", "") | comment(header="", footer="", prefix="", indent=0) }}")]
{% endif %}
    public const string Attribute{{attr_name}} = "{{attribute.name}}";
{% endfor %}
{% for attribute in ctx.attributes %}{% if attribute.type is mapping %}
{% set enum_class_name = attribute.name | pascal_case ~ "Values" %}
{% set attribute_resolved_type = attribute.type | instantiated_type %}

    {{ attribute.brief | comment(indent=4) }}
    public static class {{enum_class_name}}
    {
        {% for member in attribute.type.members %}
        {{ [member.brief or (member.id ~ '.')] | comment(indent=8) }}
        {% if attribute.deprecated %}
        [Obsolete("{{ attribute.deprecated | replace("\"", "") | comment(header="", footer="", prefix="", indent=0) }}")]
        {% endif %}
        public const {{ attribute_resolved_type | map_text("csharp_type") }} {{ member.id | pascal_case }} = {{ member.value | print_member_value }};
        {% if not loop.last %}{{"\n"}}{% endif %}
        {% endfor %}
    }
{% endif %}{% endfor %}
}
