{ config, lib, pkgs, helpers, base, ... }:
lib.recursiveUpdate
{
  options.clicks = {
    nginx = {
      services = lib.mkOption {
        type = with lib.types;
          listOf (submodule {
            options = {
              host = lib.mkOption { type = str; };
              extraHosts = lib.mkOption { type = listOf str; };
              secure = lib.mkOption { type = bool; };
              service = lib.mkOption {
                type = let
                  validServiceTypes = {
                    "redirect" = {
                      to = ["string" str];
                      permanent = ["bool" bool];
                    };
                    "reverseproxy" = {
                      to = ["string" str];
                    };
                    "php" = {
                      root = ["string" str];
                      socket = ["string" str];
                    };
                    "directory" = {
                      private = ["bool" bool];
                      root = ["string" str];
                    };
                    "file" = {
                      path = ["string" str];
                    };
                    "path" = {
                      path = ["string" str];
                      service = ["set" serviceType];
                    };
                    "compose" = {
                      services = ["list" (listOf serviceType)];
                    };
                    "status" = {
                      statusCode = ["int" int];
                    };
                  };

                  serviceType = mkOptionType {
                    name = "Service";

                    description = "clicks Nginx service";
                    descriptionClass = "noun";

                    check = (x:
                      if (builtins.typeOf x) != "set"
                      then lib.warn "clicks nginx services must be sets but ${x} is not a set" false
                      else if !(builtins.hasAttr "type" x)
                      then lib.warn "clicks nginx services must have a type attribute but ${x} does not" false
                      else if !(builtins.hasAttr x.type validServiceTypes)
                      then lib.warn "clicks nginx services must have a valid type, but ${x.type} is not one" false
                      else (let
                        optionTypes =
                          (builtins.mapAttrs (n: o: builtins.elemAt o 0) validServiceTypes.${x.type})
                          // { type = "string"; };
                      in (lib.pipe x [
                        (builtins.mapAttrs (n: o: (builtins.hasAttr n optionTypes) && optionTypes.${n} == (builtins.typeOf o)))
                        lib.attrValues
                        (builtins.all (x: x))
                      ]) && (lib.pipe optionTypes [
                        (builtins.mapAttrs (n: _: builtins.hasAttr n x))
                        lib.attrValues
                        (builtins.all (x: x))
                      ] )));
                  };
                in serviceType;
              };
              type = lib.mkOption { type = strMatching "hosts"; };
            };
          });
        example = lib.literalExpression ''
          with helpers.nginx; [
            (Host "example.clicks.codes" (ReverseProxy "generic:1001"))
          ]'';
        description = lib.mdDoc ''
          Connects hostnames to services for your nginx server. We recommend using the Clicks helper to generate these
        '';
        default = [ ];
      };
      serviceAliases = lib.mkOption {
        type = with lib.types;
          listOf (submodule {
            options = {
              host = lib.mkOption {
                type = str;
                example = "example.clicks.codes";
                description = ''
                  The ServerName of the server. If you override this in the nginx server block, you still need to put in the name of the attribute
                '';
              };
              aliases = lib.mkOption {
                type = listOf str;
                example = [ "example2.clicks.codes" "example.coded.codes" ];
                description = ''
                  A list of servers to add as aliases
                '';
              };
              type = lib.mkOption { type = strMatching "aliases"; };
            };
          });
        example = lib.literalExpression ''
          with helpers.nginx; [
            (Host "example.clicks.codes" (ReverseProxy "generic:1001"))
          ]'';
        description = lib.mdDoc ''
          Adds additional host names to your nginx server. If you're using `clicks.nginx.services`
          you should generally use a Hosts block instead
        '';
        default = [ ];
      };
      streams = lib.mkOption {
        type = with lib.types; listOf (submodule {
          options = {
            internal = lib.mkOption { type = str; };
            external = lib.mkOption { type = port; };
            protocol = lib.mkOption { type = strMatching "^(tcp|udp)$"; };
          };
        });
        example = lib.literalExpression ''
          with helpers.nginx; [
            (Stream 1001 "generic:1002" "tcp")
          ]'';
        description = lib.mdDoc ''
          A list of servers to be placed in the nginx streams block. We recommend using the Clicks helper to generate these
        '';
        default = [ ];
      };
    };
  };
  config = {
    services.nginx = {
      enable = true;
      enableReload = true;

      virtualHosts = lib.recursiveUpdate (helpers.nginx.Merge
        config.clicks.nginx.services) # clicks.nginx.services
        (lib.pipe config.clicks.nginx.serviceAliases [
          (map (alias: {
            name = alias.host;
            value.serverAliases = alias.aliases;
          }))
          builtins.listToAttrs
        ]); # clicks.nginx.serviceAliases

      streamConfig = builtins.concatStringsSep "\n" (map (stream: ''
        server {
            listen ${builtins.toString stream.external}${lib.optionalString (stream.protocol == "udp") " udp"};
            proxy_pass ${builtins.toString stream.internal};
        }
      '') config.clicks.nginx.streams);
    };

    networking.firewall.allowedTCPPorts = lib.pipe config.clicks.nginx.streams [
      (builtins.filter (stream: stream.protocol == "tcp"))
      (map (stream: stream.external))
    ];
    networking.firewall.allowedUDPPorts = lib.pipe config.clicks.nginx.streams [
      (builtins.filter (stream: stream.protocol == "udp"))
      (map (stream: stream.external))
    ];

    security.acme.defaults = {
      email = "admin@clicks.codes";
      credentialsFile = config.sops.secrets.cloudflare_cert__api_token.path;
    };
    security.acme.acceptTerms = true;

    sops.secrets.cloudflare_cert__api_token = {
      mode = "0660";
      owner = config.users.users.nginx.name;
      group = config.users.users.acme.group;
      sopsFile = ../secrets/cloudflare-cert.env.bin;
      format = "binary";
    };
  };
} (
  if base != null
  then {
    config.security.acme.certs = builtins.mapAttrs (_: v: { webroot = null; dnsProvider = "cloudflare"; }) base.config.security.acme.certs;
  } else {})
