# `Zizq.Job`
[🔗](https://github.com/zizq-labs/zizq-elixir/blob/v0.8.0/lib/zizq/job.ex#L4)

A job record from the server.

Returned by `Zizq.enqueue/2`, yielded by the take stream, and listed
by the query API. Which fields are populated depends on the job's
lifecycle state — `:dequeued_at` is only set once a worker has taken
it, `:completed_at` only once it has finished — so treat anything
optional as possibly `nil`.

Timestamps are `t:DateTime.t/0` in UTC.

# `status`

```elixir
@type status() :: :scheduled | :ready | :in_flight | :completed | :dead
```

Lifecycle state.

  * `:scheduled` — stored, but scheduled for a future date/time and
    not eligible until `:ready_at` is reached — also used for
    retries when `:attempts` is non-zero
  * `:ready` — queued and waiting for a worker when it reaches the
    too of the queue
  * `:in_flight` — delivered to a worker, awaiting acknowledgement
  * `:completed` — finished successfully
  * `:dead` — failed and exhausted its retry limit

# `t`

```elixir
@type t() :: %Zizq.Job{
  attempts: non_neg_integer(),
  backoff: Zizq.Backoff.t() | nil,
  batch: Zizq.BatchConfig.t() | nil,
  budgets: [Zizq.BudgetBinding.t()],
  completed_at: DateTime.t() | nil,
  dequeued_at: DateTime.t() | nil,
  duplicate: boolean() | nil,
  failed_at: DateTime.t() | nil,
  folded: boolean() | nil,
  id: String.t(),
  payload: term(),
  priority: non_neg_integer(),
  purge_at: DateTime.t() | nil,
  queue: String.t(),
  ready_at: DateTime.t() | nil,
  retention: Zizq.Retention.t() | nil,
  retry_limit: non_neg_integer() | nil,
  status: status(),
  type: String.t(),
  unique_key: String.t() | nil,
  unique_while: String.t() | nil
}
```

---

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