{#
    This is a custom template derived from:
    https://github.com/openapi-generators/openapi-python-client/blob/v.0.10.7/openapi_python_client/templates/property_templates/property_macros.py.jinja
#}
{% macro construct_template(construct_function, property, source, initial_value=None) %}
_{{ property.python_name }} = {{ source }}
{{ property.python_name }}: {{ property.get_type_string() }}
    {% if property.nullable %}
if _{{ property.python_name }} is None:
    {{ property.python_name }} = {% if initial_value != None %}{{ initial_value }}{% else %}None{% endif %}

    {% endif %}
{% if property.nullable %}elif{% else %}if{% endif %} isinstance(_{{ property.python_name }},  Unset):
    {{ property.python_name }} = {% if initial_value != None %}{{ initial_value }}{% else %}UNSET{% endif %}

else:
    {{ property.python_name }} = {{ construct_function(property, "_" + property.python_name) }}
{% endmacro %}
