# `PhoenixKit.Jobs`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.87/lib/phoenix_kit/jobs.ex#L1)

Jobs module for PhoenixKit.

This module provides functions for managing the Jobs admin interface.
When enabled, it shows a view-only dashboard of job status and history.

## Core Functions

### System Control

- `enabled?/0` - Check if Jobs module is enabled
- `enable_system/0` - Enable Jobs module
- `disable_system/0` - Disable Jobs module

## Settings Keys

All configuration is stored in the Settings system:

- `jobs_enabled` - Enable/disable Jobs admin interface (boolean)

## Usage Examples

    # Check if Jobs module is enabled
    if PhoenixKit.Jobs.enabled?() do
      # Show jobs dashboard
    end

    # Enable/disable the module
    PhoenixKit.Jobs.enable_system()
    PhoenixKit.Jobs.disable_system()

# `disable_system`

```elixir
@spec disable_system() :: {:ok, any()} | {:error, any()}
```

Disables the Jobs module.

## Examples

    iex> PhoenixKit.Jobs.disable_system()
    {:ok, %PhoenixKit.Settings.Setting{}}

# `enable_system`

```elixir
@spec enable_system() :: {:ok, any()} | {:error, any()}
```

Enables the Jobs module.

## Examples

    iex> PhoenixKit.Jobs.enable_system()
    {:ok, %PhoenixKit.Settings.Setting{}}

# `enabled?`

```elixir
@spec enabled?() :: boolean()
```

Returns true when the Jobs module is enabled.

## Examples

    iex> PhoenixKit.Jobs.enabled?()
    false

    iex> PhoenixKit.Jobs.enable_system()
    iex> PhoenixKit.Jobs.enabled?()
    true

# `get_config`

```elixir
@spec get_config() :: map()
```

Returns the current Jobs module configuration as a map.

## Examples

    iex> PhoenixKit.Jobs.get_config()
    %{
      enabled: true,
      stats: %{
        available: 0,
        scheduled: 0,
        executing: 0,
        completed: 0,
        retryable: 0,
        discarded: 0,
        cancelled: 0
      }
    }

# `get_job_stats`

```elixir
@spec get_job_stats() :: map()
```

Returns job statistics from the Oban jobs table.

## Examples

    iex> PhoenixKit.Jobs.get_job_stats()
    %{available: 5, scheduled: 2, executing: 1, completed: 100, ...}

---

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