<?php
/*
Plugin Name: Bible Daily Reading Plan
Version: 1.5.3
Description: Displays a daily Bible reading schedule.
Author: Esaia Gaprindashvili and Daniel Abulashvili
Text Domain: bible-reading-plan
License: GPL2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

if (!defined('ABSPATH')) {
    exit;
}

define('BIBLDARE_BASE_URL', 'https://holybible.ge/service.php?');
define('BIBLDARE_PLUGIN_PATH', __FILE__);

define('DEFAULT_LANG', 'eng');
define('DEFAULT_VERSION', 'NASB New American Standard Bible');


require_once plugin_dir_path(BIBLDARE_PLUGIN_PATH) . 'includes/helpers.php';
require_once plugin_dir_path(BIBLDARE_PLUGIN_PATH) . 'includes/init.php';
require_once plugin_dir_path(BIBLDARE_PLUGIN_PATH) . 'includes/shortcode.php';
require_once plugin_dir_path(BIBLDARE_PLUGIN_PATH) . 'includes/adminpanel.php';

add_action('init', function () {
    load_plugin_textdomain(
        'bible-reading-plan',
        false,
        dirname(plugin_basename(BIBLDARE_PLUGIN_PATH)) . '/languages'
    );
});

// Activation hook
register_activation_hook(__FILE__, 'bibldare_plugin_activate');

function bibldare_plugin_activate()
{
    // Initialize default schedule data on activation
    if (get_option('bibldare_schedule_data') === false) {
        $default_data = bibldare_get_default_schedule_data();
        add_option('bibldare_schedule_data', $default_data);
    }

    // Set default options
    if (get_option('bibldare_bible_cache_enabled') === false) {
        add_option('bibldare_bible_cache_enabled', 1);
    }
    if (get_option('bibldare_bible_language') === false) {
        add_option('bibldare_bible_language', 'eng');
    }
    if (get_option('bibldare_bible_version') === false) {
        add_option('bibldare_bible_version', 'NASB New American Standard Bible');
    }
}

// Deactivation hook (optional - clean up if needed)
register_deactivation_hook(__FILE__, 'bibldare_plugin_deactivate');

function bibldare_plugin_deactivate()
{
    // Optionally clear transients on deactivation
    bibldare_clear_bible_schedule_cache();
}
