defmodule Mix.Tasks.Weather.RebatchAsos do
  @shortdoc "Collapse pending single-station ASOS jobs into batched jobs"

  @moduledoc """
  Thin Mix-task wrapper over `Microwaveprop.Weather.RebatchAsos`.
  The real logic lives in the plain module so it's callable from a
  release shell too.

  Usage:

      mix weather.rebatch_asos                # rewrite
      mix weather.rebatch_asos --dry-run      # report only
  """

  use Mix.Task

  alias Microwaveprop.Weather.RebatchAsos

  @impl Mix.Task
  def run(args) do
    {opts, _, _} = OptionParser.parse(args, strict: [dry_run: :boolean])
    Mix.Task.run("app.start")
    _ = RebatchAsos.run(opts)
    :ok
  end
end
