<?php
/**
 * Plugin Name: ComptaFlow UK by MeeTempo
 * Plugin URI: https://comptaflow-uk.meetempo.com
 * Description: UK accounting assistant for freelancers, sole traders & small businesses. Guided bookkeeping, VAT tracking, MTD-ready. Does not replace a certified accountant.
 * Version: 1.1.0
 * Author: MeeTempo
 * License: GPLv2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: comptaflow-uk-by-meetempo
 * Requires at least: 6.0
 * Requires PHP: 8.0
 */

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

define('COMPTAFLOW_UK_PLUGIN_FILE', __FILE__);
define('COMPTAFLOW_UK_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('COMPTAFLOW_UK_PLUGIN_URL', plugin_dir_url(__FILE__));

spl_autoload_register(function ($class) {
    if (strpos($class, 'ComptaFlowUK\\') !== 0) {
        return;
    }
    
    $relative_class = substr($class, strlen('ComptaFlowUK\\'));
    $file = COMPTAFLOW_UK_PLUGIN_DIR . 'src/' . str_replace('\\', '/', $relative_class) . '.php';
    
    if (file_exists($file)) {
        require_once $file;
    }
});

// Boot action controllers
ComptaFlowUK\Admin\Actions\PaymentsActions::boot();
ComptaFlowUK\Admin\Actions\BackupActions::boot();

// Initialize the plugin
require_once COMPTAFLOW_UK_PLUGIN_DIR . 'src/Bootstrap.php';
ComptaFlowUK\Bootstrap::init();
