#pragma once

#include "ec/pid.hpp"
#include "fan.hpp"
#include "pidcontroller.hpp"

#include <memory>
#include <string>
#include <vector>

namespace pid_control
{

/*
 * A FanController is a PID controller that reads a number of fans and given
 * the output then tries to set them to the goal values set by the thermal
 * controllers.
 */
class FanController : public PIDController
{
  public:
    static std::unique_ptr<PIDController> createFanPid(
        ZoneInterface* owner, const std::string& id,
        const std::vector<std::string>& inputs, const ec::pidinfo& initial);

    FanController(const std::string& id, const std::vector<std::string>& inputs,
                  ZoneInterface* owner) :
        PIDController(id, owner), _inputs(inputs),
        _direction(FanSpeedDirection::NEUTRAL)
    {}
    ~FanController();
    double inputProc(void) override;
    double setptProc(void) override;
    void outputProc(double value) override;

    FanSpeedDirection getFanDirection(void) const
    {
        return _direction;
    }

    void setFanDirection(FanSpeedDirection direction)
    {
        _direction = direction;
    };

  private:
    std::vector<std::string> _inputs;
    FanSpeedDirection _direction;

    // Cosmetic only, to reduce frequency of repetitive messages
    bool failsafeTransition = true;
    bool failsafePrevState = false;
};

} // namespace pid_control
