{ config, lib, inputs, outputs, pkgs, timeZone, system, ... }:
let
  supportedDesktops = [ "sway" "hyprland" ];
  supportedDesktopsStr = lib.strings.concatStringsSep ", " supportedDesktops;
  deskCfg = config.deskCfg;
in
{
  options.deskCfg = {
      de = lib.mkOption {
          default = "sway";
          type = lib.types.str;
          description = "Desktop Environment";
      };
      userName = lib.mkOption {
          type = lib.types.str;
          description = "Main username for system";
      };
      hostName = lib.mkOption {
          type = lib.types.str;
          description = "Hostname for system";
      };
      installGaming = lib.mkOption {
          type = lib.types.bool;
          default = true;
          description = "Whether to install gaming software or not";
      };
  };

    imports = [
      modules/user/main_user.nix
      modules/sway/sway_conf.nix
      modules/hypr/hyprland.nix
      ../shared/modules/system/power_manager.nix
      # inputs.nur.hmModules.nur
    ];

   config = {
    assertions = [
      {
        assertion = builtins.elem deskCfg.de supportedDesktops;
        message = "Unsupported desktop environment: ${deskCfg.de}\nSupported DE's: ${supportedDesktopsStr}";
      }
    ];
  
    nixpkgs.overlays = [
      inputs.nur.overlays.default
    ];
  
 
    # Enable flakes feature
    nix.settings.experimental-features = [
      "nix-command" "flakes"
    ];
  
    # Use the systemd-boot EFI boot loader.
    boot.loader.systemd-boot.enable = true;
    boot.loader.efi.canTouchEfiVariables = true;
    # boot.plymouth.enable = true;
  
    networking.hostName = deskCfg.hostName; # Define your hostname.
    networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.
  
    time.timeZone = timeZone;

    hardware.sane = {
      enable = true;
      brscan5.enable = true;
    };

    power_manager = {
      enable = true;
    };

    main_user = {
      enable = true;
      userName = deskCfg.userName;
      isDesktopUser = true;
    };
    
    swaywm = {
        enable = false;
        useNonFree = true;
        installGaming = deskCfg.installGaming;
        systemPackages = with pkgs; [
          libreoffice
        ];
    };

    hypr = {
      enable = true;
      user = deskCfg.userName;
      systemPackages = with pkgs; [
        libreoffice
      ];
    };
   
    system.stateVersion = "23.11"; # Did you read the comment?
  };
}

