{ lib, config, ... }:
with lib;
let
  cfg = config.modules.video.mpv;
in
{
  options.modules.video.mpv = {
    enable = mkEnableOption "enable MPV video player";
  };
  config = mkIf cfg.enable {
    programs.mpv = {
      enable = true;
      config = {
        hwdec = "auto-safe";
        vo = "gpu";
        profile = "gpu-hq";
        gpu-context = "wayland";
      };
    };
    xdg.mimeApps.defaultApplications = {
      "video/*" = "mpv.desktop";
    };
  };
}
