{ lib, config, ... }:
with lib;
let
  cfg = config.modules.gaming.steam;
in
{
  options.modules.gaming.steam = {
    enable = mkEnableOption "Enable Steam Platform";

    gamescope = mkOption {
      type = types.bool;
      default = false;
      description = "enable gamescope session (default false)";
    };
    gamemode = mkOption {
      type = types.bool;
      default = false;
      description = "enable Feral Gamemode (default false)";
    };
  };
  config = mkIf cfg.enable {
    programs.gamemode = {
      enable = cfg.gamemode;
    };
    programs.gamescope = {
      enable = cfg.gamescope;
      capSysNice = true;
    };
    programs.steam = {
      enable = true;
      gamescopeSession = {
        enable = cfg.gamescope;
        args = [
        "-O HDMI-A-2"
        "-F fsr"
        ];
      };
    };
  };
}
