#ifndef POWER_SUPPLY_LAPTOP_H_
#define POWER_SUPPLY_LAPTOP_H_

#include <INA226.h>

#include "DigiPot.h"
#include "PwrSupply.h"

class C_PwrSupply_Laptop : public C_PwrSupply {
   public:
    C_PwrSupply_Laptop() {
    }

    void Init() override;
    void SetEnable(bool value) override;
    void ToggleEnable() override;
    bool IsEnabled() override;

    void CheckFuse() override;
    void Tasks() override;

    void RequestVoltage(float voltage);

    static constexpr float LAPTOP_MIN_V = 16;
    static constexpr float LAPTOP_MAX_V = 24.8;

   private:
    C_DigiPot Pot;
    INA226 ina;

    const int COUNTDOWN_VALUE = 3;
    int correction = 0;
    int regCountdown;
    float setVoltage;

    static const uint8_t MY_INA226_ADDRESS = 0x45;
    static constexpr float MY_INA226_SHUNT = 0.01f;
    static constexpr float MY_INA226_MAX_EXP_CURRENT = 10.0f;

    static constexpr float FUSE_POWER_LAPTOP = 120.0f;
};

#endif
