{ lib, config, ... }:
let
  inherit (lib.options) mkOption;
  inherit (lib.lists) optionals;
  inherit (lib.types) enum listOf str;
in
{
  config.warnings = optionals (config.garden.system.users == [ ]) [
    ''
      You have not added any users to be supported by your system. You may end up with an unbootable system!

      Consider setting {option}`config.garden.system.users` in your configuration
    ''
  ];

  options.garden.system = {
    mainUser = mkOption {
      type = enum config.garden.system.users;
      description = "The username of the main user for your system";
      default = builtins.elemAt config.garden.system.users 0;
    };

    users = mkOption {
      type = listOf str;
      default = [ "comfy" ];
      description = ''
        A list of users that you wish to declare as your non-system users. The first username
        in the list will be treated as your main user unless {option}`garden.system.mainUser` is set.
      '';
    };
  };
}
