{
  config,
  lib,
  namespace,
  ...
}:
with lib;
let
  name = "wyoming";
  cfg = config.${namespace}.services.${name};

  wyomingConfig = lib.${namespace}.mkModule {
    inherit config name;
    serviceName = "${name}-faster-whisper-hass-whisper";
    description = "wyoming protocol";
    options = { };
    moduleConfig = {
      # Open firewall for protonmail bridge if enabled
      networking.firewall = mkIf cfg.openFirewall {
        allowedTCPPorts = [
          10200
          10300
        ];
        allowedUDPPorts = [
          10200
          10300
        ];
      };
      services.wyoming = {
        faster-whisper.servers.hass-whisper = {
          enable = true;
          useTransformers = false;
          device = lib.mkForce "auto";
          language = "en";
          model = "distil-large-v3";
          uri = "tcp://0.0.0.0:10300";
        };

        piper = {
          servers.hass-piper = {
            enable = true;
            voice = "en-us-ryan-high";
            uri = "tcp://0.0.0.0:10200";
          };
        };
      };
    };
  };
in
{
  imports = [ wyomingConfig ];
}
