from typing import ClassVar
{%- set default = get_enum_default(model) %}

class {{ name }}(ModelSimple):
    """
    {{ model.description|indent(8) }}

    :param value: {%- if default != None %} If omitted defaults to {{ default|format_value }}.{%- endif %} Must be one of [{%- for value in model.enum %}{{ value|format_value }}{% if not loop.last %}, {% endif %}{%- endfor %}].
    :type value: {{ get_enum_type(model) }}
    """

    allowed_values = {
{%- for index, value in enumerate(model.enum) %}
        {{ value|format_value(quotes='"') }},
{%- endfor %}
    }

{%- for index, value in enumerate(model.enum) %}
    {{ model["x-enum-varnames"][index] or value.upper() }}: ClassVar["{{ name }}"]
{%- endfor %}

{% if model.nullable %}
    _nullable = True
{%- endif %}

    @cached_property
    def openapi_types(_):
        return {
            "value": ({{ get_enum_type(model) }},),
        }


{%- for index, value in enumerate(model.enum) %}
{{ name }}.{{ model["x-enum-varnames"][index] or value.upper() }} = {{ name }}({{ value|format_value(quotes='"') }})
{%- endfor %}
