#
# This file is autogenerated, do not edit manually. Instead,
# edit {{ config.data }}
#

import typing

from hal_impl.data import hal_data, NotifyDict

from .sim_enums import *

{% for header in headers %}
{% for cls in header.classes if 'ignore' not in cls.data %}

class {{ cls.name }}{% if '__bases__' in cls.data %}({{ cls.data['__bases__'] }}){% endif %}:
  {% for fn in cls.methods.public %}
  {% if 'simfn' in fn.data %}
    {{ fn.data.simfn  | indent(width=4) }}
  {% elif 'overload' in fn.data %}
    @typing.overload
    def {{ fn.x_name }}(self{% if fn.x_in_params %}, {{ fn.x_in_params | join(', ', attribute='x_pyann') }}{% endif %}) -> {{ fn.x_pyann_ret }}:
        ...

  {% elif 'ignore' not in fn.data %}
    def {{ fn.x_name }}(self{% if fn.x_in_params %}, {{ fn.x_in_params | join(', ', attribute='x_pyann') }}{% endif %}) -> {{ fn.x_pyann_ret }}:
    {% if fn.doc is defined %}
        """{{ fn.doc | indent(width=8) }}
        {% if not fn.hascode %}

        .. note:: This function works on a real robot, but has not yet
                  been implemented in simulation mode. See :ref:`api_support`
                  for more details.

        {% endif %}
        """
    {% endif %}
    {% if fn.x_param_checks %}
        {{ fn.x_param_checks | join('\n') | indent(width=8) }}
    {% endif %}
    {% if 'code' in fn.data %}
        {{ fn.data['code'] | trim | indent(width=8) }}
    {% elif 'get' in fn.data %}
        retval = self._hal_data['{{ fn.data['get'] }}']
    {% elif 'set' in fn.data %}
        self._hal_data['{{ fn.data['set'] }}'] = {{ fn.parameters[0]['name'] }}
    {% endif %}
    {% if not fn.hascode %}
        raise NotImplementedError("{{ fn.x_name }} not implemented in simulation (file a bug on github if you need it)")
    {% else %}
    {% if fn.x_return_checks %}
        {{ fn.x_return_checks | join('\n') | indent(width=8) }}
    {% endif %}
    {% if fn.x_rets %}
        return retval
    {% endif %}
    {% endif %}

  {% endif %}
  {% endfor %}
{% if cls.data.sim_class_extra is defined %}
    {{ cls.data.sim_class_extra | indent(width=4) }}
{% endif %}
{% endfor %}
{% endfor %}
