{ lib, namespace, ... }:
with lib;
{
  options.${namespace}.services.code-server = {
    enable = mkEnableOption "code-server with enhanced configuration";

    port = mkOption {
      type = types.port;
      default = 4444;
      description = "Port for code-server";
    };

    openFirewall = mkOption {
      type = types.bool;
      default = true;
      description = "Whether to open firewall for code-server";
    };

    user = mkOption {
      type = types.str;
      default = "admin";
      description = "User to run code-server as";
    };

    group = mkOption {
      type = types.str;
      default = "users";
      description = "Group to run code-server as";
    };

    host = mkOption {
      type = types.str;
      default = "0.0.0.0";
      description = "Host to bind code-server to";
    };

    auth = mkOption {
      type = types.enum [
        "none"
        "password"
      ];
      default = "none";
      description = "Authentication method for code-server";
    };

    hashedPassword = mkOption {
      type = types.nullOr types.str;
      default = null;
      description = "Hashed password for code-server authentication";
    };

    extraEnvironment = mkOption {
      type = types.attrsOf types.str;
      default = { };
      description = "Extra environment variables for code-server";
    };

    disableTelemetry = mkOption {
      type = types.bool;
      default = true;
      description = "Whether to disable telemetry";
    };

    disableUpdateCheck = mkOption {
      type = types.bool;
      default = true;
      description = "Whether to disable update checks";
    };
  };
}
