# `GoodJob.Job.State`
[🔗](https://github.com/amkisko/good_job.ex/blob/v1.0.0/lib/good_job/job/state.ex#L1)

Job state calculation logic.

Calculates job state from timestamp fields.

# `calculate`

```elixir
@spec calculate(GoodJob.Job.t(), DateTime.t() | nil) :: atom()
```

Calculates the job state from timestamp fields.
Returns :available, :running, :succeeded, :discarded, :scheduled, or :retried

Optimized version that accepts optional current_time to avoid repeated DateTime.utc_now() calls.

---

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