{ config, lib, inputs, pkgs, ... }:

with lib;

let
  cfg = config.settings.theming.stylix;
in {
  options = {
    settings.theming.stylix.enable = lib.mkOption {
      type = lib.types.bool;
      description = ''
        Enable stylix configuration
      '';
    };

    settings.theming.stylix.wallpaper = lib.mkOption {
      type = lib.types.enum ["wallpaper-2.png" "kiiwy.png"];
      description = ''
        Choose wallpaper
      '';
    };

    settings.theming.stylix.theme = lib.mkOption {
      type = lib.types.str;
      description = ''
        Choose theme name. Use "theme" to use them based on wallpaper generation
      '';
    };
  };

  imports = [
    inputs.stylix.homeManagerModules.stylix
  ];

  config = mkIf cfg.enable {
    stylix.enable = true;

    stylix.image = ../../../assets/${cfg.wallpaper};

    stylix.polarity = "dark";

    stylix.base16Scheme = lib.mkIf (cfg.theme != "theme") "${pkgs.base16-schemes}/share/themes/${cfg.theme}.yaml";

    stylix.autoEnable = true;

    stylix.cursor = {
      package = pkgs.phinger-cursors;
      name = "phinger-cursors-dark";
      size = 24;
    };

    stylix.fonts.sizes.applications = 10;
  };
}
