# `Accrue.Events.Event`
[🔗](https://github.com/szTheory/accrue/blob/accrue-v0.3.0/lib/accrue/events/event.ex#L1)

Ecto schema for a row in the append-only `accrue_events` table.

This module exposes a `changeset/1` for **inserts** and typed reads
via the schema reflection. It deliberately does NOT expose update or
delete helpers (D-12): the Postgres trigger would reject such a call
anyway, and keeping the helpers absent from the API prevents callers
from writing code that looks like it could work and then blows up in
production.

# `t`

```elixir
@type t() :: %Accrue.Events.Event{
  __meta__: term(),
  actor_id: String.t() | nil,
  actor_type: String.t() | nil,
  caused_by_event_id: integer() | nil,
  caused_by_webhook_event_id: Ecto.UUID.t() | nil,
  data: map(),
  id: integer() | nil,
  idempotency_key: String.t() | nil,
  inserted_at: DateTime.t() | nil,
  schema_version: integer() | nil,
  subject_id: String.t() | nil,
  subject_type: String.t() | nil,
  trace_id: String.t() | nil,
  type: String.t() | nil
}
```

# `changeset`

```elixir
@spec changeset(map()) :: Ecto.Changeset.t()
```

Builds an insert changeset from a plain attrs map.

Validates required fields and the `actor_type` enum (belt-and-suspenders
with the Postgres CHECK constraint — fails loud at the Ecto layer so
tests don't have to hit the database for actor-type typos).

---

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