defmodule Oban.Pro.Application do
  @moduledoc false

  use Application

  @handlers [
    Oban.Pro.Batch,
    Oban.Pro.Engines.Smart,
    Oban.Pro.Migration,
    Oban.Pro.Partition,
    Oban.Pro.Relay,
    Oban.Pro.Worker,
    Oban.Pro.Workflow
  ]

  @impl Application
  def start(_type, _args) do
    for handler <- @handlers, do: handler.on_start()

    children = [Oban.Pro.Diagnostics, Oban.Pro.Refresher]

    Supervisor.start_link(children, strategy: :one_for_one, name: __MODULE__)
  end

  @impl Application
  def stop(_state) do
    for handler <- @handlers, do: handler.on_stop()
  end
end
