<?php
defined('ABSPATH') || exit;

final class Fortis_WP_Settings {
    private const OPTION = 'fortisrestore_settings';

    public static function get(): array {
        $saved = get_option(self::OPTION, []);
        $backup = is_array($saved) && isset($saved['backup']) && is_array($saved['backup']) ? $saved['backup'] : [];
        return ['backup' => array_replace(['exclude_cache' => true, 'exclude_upgrade' => true, 'exclusions' => []], $backup)];
    }

    public static function section(string $name, array $value): void {
        if ($name !== 'backup') return;
        update_option(self::OPTION, ['backup' => $value], false);
    }
}
