// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

// THIS FILE WAS AUTO-GENERATED BY ./commandsv2/generate_hids.py. DO NOT MODIFY
{% macro capitalize_first(string) -%}
{{ string[0]|capitalize + string[1:] }}
{%- endmacro %}
#include "wpi/commands2/button/Command{{ ConsoleName }}Controller.hpp"

using namespace wpi::cmd;

Command{{ ConsoleName }}Controller::Command{{ ConsoleName }}Controller(int port)
    : CommandGenericHID(port), m_hid{wpi::{{ ConsoleName }}Controller(port)} {}

wpi::{{ ConsoleName }}Controller& Command{{ ConsoleName }}Controller::GetHID() {
  return m_hid;
}
{% for button in buttons %}
Trigger Command{{ ConsoleName }}Controller::{{ capitalize_first(button.name) }}(wpi::EventLoop* loop) const {
  return Button(wpi::{{ ConsoleName }}Controller::Button::k{{ capitalize_first(button.name) }}, loop);
}
{% endfor -%}
{% for trigger in triggers -%}
{% if trigger.UseThresholdMethods %}
Trigger Command{{ ConsoleName }}Controller::{{ capitalize_first(trigger.name) }}(double threshold,
                                           wpi::EventLoop* loop) const {
  return Trigger(loop, [this, threshold] {
    return m_hid.Get{{ capitalize_first(trigger.name) }}Axis() > threshold;
  });
}
{% endif -%}
{% endfor -%}
{% for stick in sticks %}
double Command{{ ConsoleName }}Controller::Get{{ stick.NameParts|map("capitalize")|join }}() const {
  return m_hid.Get{{ stick.NameParts|map("capitalize")|join }}();
}
{% endfor -%}
{% for trigger in triggers %}
double Command{{ ConsoleName }}Controller::Get{{ capitalize_first(trigger.name) }}Axis() const {
  return m_hid.Get{{ capitalize_first(trigger.name) }}Axis();
}
{% endfor -%}
