# `MishkaGervaz.Table.Web.Events.BulkActionResult`
[🔗](https://github.com/mishka-group/mishka_gervaz/blob/v0.0.1-alpha.3/lib/mishka_gervaz/table/web/events/bulk_action_result.ex#L1)

Structured summary of a bulk action's outcome.

Passed as the first argument to bulk lifecycle hooks
(`:after_bulk_action`, `:on_bulk_action_success`, `:on_bulk_action_error`)
so authors can read counts, records, and errors directly without parsing
`Ash.BulkResult`. The raw bulk result is still available as `:ash_result`
for power use.

## Fields

  * `:action_name` — the action name (atom, e.g. `:master_unarchive`).
  * `:action_type` — the action kind (`:destroy`, `:update`, `:unarchive`,
    `:soft_delete`, `:permanent_destroy`).
  * `:status` — overall outcome (`:success`, `:partial_success`, `:error`).
  * `:succeeded_count` — records that completed successfully.
  * `:failed_count` — records that errored during the bulk.
  * `:skipped_count` — records skipped **before** the bulk ran (currently
    only set by the unarchive conflict-skip path).
  * `:requested_count` — records originally selected; `nil` if the selection
    was `:all` and the total wasn't computed.
  * `:succeeded_records` — records returned by the bulk (may be `[]` if the
    action wasn't configured to return them).
  * `:failed_errors` — list of error structs from the bulk.
  * `:skipped_record_ids` — IDs of records skipped pre-execution.
  * `:ash_result` — the underlying `Ash.BulkResult` (escape hatch).

## Customization

Like the sibling handlers in `events/`, the builder is overridable:

    defmodule MyApp.BulkActionResult do
      use MishkaGervaz.Table.Web.Events.BulkActionResult

      def build(action_name, action_type, result, opts) do
        summary = super(action_name, action_type, result, opts)
        %{summary | ash_result: nil}  # strip raw result for telemetry/logging
      end
    end

See `MishkaGervaz.Table.Web.Events.BulkActionHooks` for the hook-author
helpers; `MishkaGervaz.Table.Web.Events.BulkActionHandler` for the
consumer.

# `status`

```elixir
@type status() :: :success | :partial_success | :error
```

# `t`

```elixir
@type t() :: %MishkaGervaz.Table.Web.Events.BulkActionResult{
  action_name: atom() | nil,
  action_type: atom() | nil,
  ash_result: Ash.BulkResult.t() | nil,
  failed_count: non_neg_integer(),
  failed_errors: list(),
  requested_count: non_neg_integer() | nil,
  skipped_count: non_neg_integer(),
  skipped_record_ids: list(),
  status: status() | nil,
  succeeded_count: non_neg_integer(),
  succeeded_records: list()
}
```

# `build`

```elixir
@callback build(
  action_name :: atom(),
  action_type :: atom(),
  result :: Ash.BulkResult.t(),
  opts :: keyword()
) :: t()
```

Builds a summary from the raw `Ash.BulkResult`.

Supported opts:

  * `:skipped_record_ids` — IDs filtered out before the bulk ran.
  * `:requested_count` — original selection size.

# `build`

```elixir
@spec build(atom(), atom(), Ash.BulkResult.t()) :: t()
```

Convenience entry point delegating to `__MODULE__.Default.build/4`.

Direct callers (the handler, tests, ad-hoc helpers) use this; resources
that need a custom builder swap the whole module via the DSL by
`use MishkaGervaz.Table.Web.Events.BulkActionResult` and overriding
`build/4`.

# `build`

```elixir
@spec build(atom(), atom(), Ash.BulkResult.t(), keyword()) :: t()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
