#ifndef FANCONTROLLER_H
#define FANCONTROLLER_H

#include <string>
#include <vector>
#include "curveeditor.h"
#include "thermalcontroller.h"

/**
 * @brief PWM风扇
 */
struct PwmFan
{
    /**
     * @brief 风扇名称
     */
    const std::string fanName;

    /**
     * @brief PWM路径
     */
    const std::string pwmPath;

    /**
     * @brief 风扇速度路径
     */
    const std::string fanSpeedPath;


    

    PwmFan(const std::string& fanName, const std::string& pwmPath, const std::string& fanSpeedPath) :  
        fanName(fanName), pwmPath(pwmPath), fanSpeedPath(fanSpeedPath) {}
    
};


/**
 * @brief 风扇控制器
 */
class FanController : QObject
{
private:
    /**
     * @brief 温度控制器
     */
    ThermalController* thermalController;
    
    /**
     * @brief 风扇列表
     */
    std::vector<PwmFan> fans;

    /**
     * @brief 目标风扇曲线
     */
    std::map<std::string, QVector<CurvePoint>> targetFanCurves;

    /**
     * @brief 设置风扇速度
     */
    void setFanSpeed(PwmFan& fan, int speed);
public:
    FanController();

    /**
     * @brief 获取风扇路径
     */
    void findFanPaths();

    /**
     * @brief 获取风扇列表
     */
    std::vector<PwmFan> getFans();

    /**
     * @brief 设置风扇曲线
     */
    void setFanCurve(PwmFan& fan, QVector<CurvePoint> curvePoints);

};

#endif // FANCONTROLLER_H