defmodule Prymn.Messaging.ConnectionSupervisor do
  use Supervisor, restart: :permanent

  def start_link([]) do
    Supervisor.start_link(__MODULE__, [], name: __MODULE__)
  end

  @impl true
  def init(_init_arg) do
    children = [
      {DynamicSupervisor, name: Prymn.Messaging.SubscriptionSupervisor},
      {Registry, name: Prymn.Messaging.SubscriptionRegistry, keys: :unique},
      {Prymn.Messaging.Connection, :nats1}
    ]

    Supervisor.init(children, strategy: :one_for_one)
  end
end