{
  lib,
  config,
  ...
}: let
  inherit (lib) mkEnableOption mkIf;
  cfg = config.horseman.hardware.fans;
in {
  options = {
    horseman.hardware.fans = {
      enable = mkEnableOption "Fan control for framework laptop";
    };
  };

  config = mkIf cfg.enable {
    hardware.fw-fanctrl = {
      enable = true;
      config = {
        defaultStrategy = "school";
        strategies = {
          "school" = {
            movingAverageInterval = 10;
            speedCurve = [
              {
                temp = 40;
                speed = 0;
              }
              {
                temp = 50;
                speed = 30;
              }
              {
                temp = 65;
                speed = 60;
              }
              {
                temp = 75;
                speed = 100;
              }
            ];
          };
          "full".speedCurve = [
            {
              temp = 0;
              speed = 100;
            }
            {
              temp = 100;
              speed = 100;
            }
          ];
        };
      };
    };
  };
}
