defmodule WhoNeedHelp.Workers.LocalBurstProbe do
  @moduledoc """
  A side-effect-free worker for the isolated local Oban burst measurement.

  No application flow enqueues this worker. The measurement script requires an
  explicit confirmation value, tags every job with a unique run id, and removes
  only those exact rows after collecting evidence.
  """

  use Oban.Worker, queue: :maintenance, max_attempts: 1, tags: ["local-burst-probe"]

  @confirmation "isolated-local-oban-burst-probe"

  @impl Oban.Worker
  def perform(%Oban.Job{
        args: %{
          "confirmation" => @confirmation,
          "run_id" => run_id,
          "sequence" => sequence
        }
      })
      when is_binary(run_id) and run_id != "" and is_integer(sequence) and sequence > 0 do
    :ok
  end

  def perform(_job), do: {:cancel, :invalid_local_burst_probe}
end
