# `DripDrop.Enrollments`
[🔗](https://github.com/agoodway/dripdrop/blob/v0.1.0/lib/dripdrop/enrollments.ex#L1)

Enrollment lifecycle context.

# `enroll`

```elixir
@spec enroll(map()) :: {:ok, Ecto.Schema.t()} | {:error, term()}
```

Enrolls a subscriber into the active sequence version and schedules the first step.

# `get_enrollment`

```elixir
@spec get_enrollment(Ecto.UUID.t(), binary(), binary()) :: no_return()
```

Deprecated unscoped lookup. Use `get_enrollment/4` with an explicit tenant key.

# `get_enrollment`

```elixir
@spec get_enrollment(Ecto.UUID.t(), binary(), binary(), binary() | nil) ::
  Ecto.Schema.t() | nil
```

Finds one enrollment by sequence, subscriber identity, and explicit tenant scope.

# `list_active_enrollments`

```elixir
@spec list_active_enrollments(map()) :: [Ecto.Schema.t()]
```

Lists active enrollments with an explicit tenant scope and optional sequence filter.

# `pause_enrollment`

```elixir
@spec pause_enrollment(Ecto.UUID.t()) :: no_return()
```

Deprecated unscoped pause. Use `pause_enrollment/2` with an explicit tenant key.

# `pause_enrollment`

```elixir
@spec pause_enrollment(Ecto.UUID.t(), binary() | nil) ::
  {:ok, Ecto.Schema.t()} | {:error, term()}
```

Pauses an enrollment scoped by tenant and cancels any pending scheduled executions.

# `repin_enrollment`

```elixir
@spec repin_enrollment(Ecto.UUID.t(), Ecto.UUID.t(), keyword() | map()) ::
  {:ok, Ecto.Schema.t()} | {:error, term()}
```

Reassigns an outbound enrollment to a different adapter without changing in-flight executions.

Requires an explicit `:tenant_key` in `opts` and validates that `new_adapter_id`
belongs to the same tenant, is active, and is in a usable health state.

# `resume_enrollment`

```elixir
@spec resume_enrollment(Ecto.UUID.t()) :: no_return()
```

Deprecated unscoped resume. Use `resume_enrollment/2` with an explicit tenant key.

# `resume_enrollment`

```elixir
@spec resume_enrollment(Ecto.UUID.t(), binary() | nil) ::
  {:ok, Ecto.Schema.t()} | {:error, term()}
```

Resumes a paused enrollment scoped by tenant and schedules the next unsent step.

# `track_event`

```elixir
@spec track_event(Ecto.UUID.t() | map(), binary(), map()) ::
  {:ok, Ecto.Schema.t() | map()} | {:error, Ecto.Changeset.t()} | no_return()
```

Deprecated unscoped event tracking by enrollment id. Use `track_event/4`.

# `track_event`

```elixir
@spec track_event(Ecto.UUID.t(), binary(), map(), binary() | nil) ::
  {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
```

Records a subscriber event for a tenant-scoped enrollment and schedules
matching event-triggered steps. Raises if the enrollment is not in the
given tenant scope.

# `unenroll`

```elixir
@spec unenroll(Ecto.UUID.t()) :: no_return()
```

Deprecated unscoped cancel. Use `unenroll/2` with an explicit tenant key.

# `unenroll`

```elixir
@spec unenroll(Ecto.UUID.t(), binary() | nil) ::
  {:ok, Ecto.Schema.t()} | {:error, term()}
```

Cancels an enrollment scoped by tenant and any pending scheduled executions.

---

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