# `PhoenixKit.ScheduledJobs.ScheduledJob`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.165/lib/phoenix_kit/scheduled_jobs/scheduled_job.ex#L1)

Schema for scheduled jobs.

Represents a job scheduled to run at a specific time. Jobs are polymorphic and can
reference any type of resource (posts, emails, notifications, etc.).

## Fields

- `job_type` - Type identifier (e.g., "publish_post", "send_email")
- `handler_module` - Module that implements `PhoenixKit.ScheduledJobs.Handler`
- `resource_type` - Type of resource (e.g., "post", "email")
- `resource_uuid` - UUID of the target resource
- `scheduled_at` - When the job should execute
- `executed_at` - When the job actually executed (nil if pending)
- `status` - Current status: "pending", "executed", "failed", "cancelled"
- `attempts` - Number of execution attempts
- `max_attempts` - Maximum retry attempts (default: 3)
- `last_error` - Error message from last failed attempt
- `args` - Additional arguments passed to the handler
- `priority` - Execution priority (higher = more urgent)
- `created_by_uuid` - Optional user who created the job

# `cancel_changeset`

Changeset for cancelling a job.

# `create_changeset`

Changeset for creating a new scheduled job.

# `execute_changeset`

Changeset for marking a job as executed.

# `fail_changeset`

Changeset for marking a job as failed.

# `reschedule_changeset`

Changeset for rescheduling a job.

---

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