# `Threadline.Semantics.AuditAction`
[🔗](https://github.com/szTheory/threadline/blob/v1.2.0/lib/threadline/semantics/audit_action.ex#L1)

An `AuditAction` is an application-level event that records who did what and why.

An `AuditAction` represents a semantic application-level event — who did
what and why. It is distinct from `AuditTransaction` (which groups DB-level
row changes produced by triggers) and may be linked to one or more
transactions via `audit_transactions.action_id`.

## Name convention

Action names use the `"<category>.<verb>"` pattern, for example:

- `"member.role_changed"`
- `"order.placed"`
- `"account.deactivated"`
- `"document.archived"`

The `:category` and `:verb` fields store the components separately so you
can filter by either dimension in queries.

## Stable 1.x fields

The stable struct fields for 1.x are `id`, `name`, `actor_ref`, `status`,
`reason`, `correlation_id`, and `inserted_at`. The `t()` type may gain fields;
this list does not make every current schema field a promise. An
`AuditAction` remains a semantic application event, distinct from the
database-transaction grouping in `AuditTransaction`.

## Usage

Create actions via `Threadline.record_action/2`, which inserts the semantic
row using the provided `:repo`. Linking captured transactions to an action is
handled separately when you associate `audit_transactions.action_id`.

# `t`

```elixir
@type t() :: %Threadline.Semantics.AuditAction{
  __meta__: Ecto.Schema.Metadata.t(),
  actor_ref: Threadline.Semantics.ActorRef.t(),
  category: String.t() | nil,
  comment: String.t() | nil,
  correlation_id: String.t() | nil,
  id: Ecto.UUID.t() | nil,
  inserted_at: DateTime.t() | nil,
  job_id: String.t() | nil,
  name: String.t(),
  reason: String.t() | nil,
  request_id: String.t() | nil,
  status: :ok | :error,
  verb: String.t() | nil
}
```

A persisted semantic action linked to one or more captured database transactions.

---

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