# `PhoenixKit.Modules.Maintenance`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L1)

Maintenance Mode module for PhoenixKit.

This module provides a system-wide maintenance mode that shows a
maintenance page to all non-admin users while allowing
admins and owners to access the site normally.

## Settings

The module uses the following settings stored in the database:
- `maintenance_module_enabled` - Boolean to enable/disable the module settings page (default: false)
- `maintenance_enabled` - Boolean to enable/disable maintenance mode (default: false)
- `maintenance_header` - Main heading text (default: "Maintenance Mode")
- `maintenance_subtext` - Descriptive subtext (default: "We'll be back soon")

## Usage

    # Check if module is enabled (settings page accessible)
    if PhoenixKit.Modules.Maintenance.module_enabled?() do
      # Show settings page
    end

    # Check if maintenance mode is enabled
    if PhoenixKit.Modules.Maintenance.enabled?() do
      # Show maintenance page to non-admin users
    end

    # Enable module (makes settings page accessible)
    PhoenixKit.Modules.Maintenance.enable_module()

    # Enable maintenance mode (shows maintenance page to users)
    PhoenixKit.Modules.Maintenance.enable_system()

    # Get module configuration
    config = PhoenixKit.Modules.Maintenance.get_config()
    # => %{module_enabled: true, enabled: true, header: "...", subtext: "..."}

# `disable_module`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L72)

Disables the Maintenance module (hides settings page).

Also automatically disables maintenance mode to prevent users from being locked out.

# `disable_system`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L109)

Disables the Maintenance mode.

When disabled, all users can access the site normally.

# `enable_module`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L63)

Enables the Maintenance module (makes settings page accessible).

# `enable_system`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L99)

Enables the Maintenance mode.

When enabled, all non-admin users will see the maintenance page.

# `enabled?`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L89)

Checks if Maintenance mode is enabled.

## Examples

    iex> PhoenixKit.Modules.Maintenance.enabled?()
    false

# `get_config`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L171)

Gets the configuration for the Maintenance module.

Returns a map with:
- `module_enabled` - Boolean indicating if module settings page is accessible
- `enabled` - Boolean indicating if maintenance mode is enabled
- `header` - Main heading text
- `subtext` - Descriptive subtext

## Examples

    iex> PhoenixKit.Modules.Maintenance.get_config()
    %{
      module_enabled: false,
      enabled: false,
      header: "Maintenance Mode",
      subtext: "We'll be back soon..."
    }

# `get_header`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L121)

Gets the header text for the maintenance page.

## Examples

    iex> PhoenixKit.Modules.Maintenance.get_header()
    "Maintenance Mode"

# `get_subtext`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L140)

Gets the subtext for the maintenance page.

## Examples

    iex> PhoenixKit.Modules.Maintenance.get_subtext()
    "We'll be back soon..."

# `module_enabled?`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L56)

Checks if the Maintenance module is enabled (settings page accessible).

## Examples

    iex> PhoenixKit.Modules.Maintenance.module_enabled?()
    false

# `update_header`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L128)

Updates the header text for the maintenance page.

# `update_subtext`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/maintenance/maintenance.ex#L147)

Updates the subtext for the maintenance page.

---

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