<?php
/**
 * Core plugin orchestrator.
 *
 * @package PrimeLink
 */

namespace PrimeLink\Core;

use PrimeLink\Core\Admin\Admin;
use PrimeLink\Core\Rest\ImportRest;
use PrimeLink\Core\Rest\ExportRest;
use PrimeLink\Core\Rest\LiveFeedRest;
use PrimeLink\Core\Updater;

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

final class Plugin {

    /**
     * Boot plugin components.
     *
     * @return void
     */
    public static function init() {
        // Register REST routes globally (front + admin).
        ImportRest::register();
        ExportRest::register();
        LiveFeedRest::register();

        // Admin-only components.
        Admin::init();

        // Register Live Feed cron intervals and hooks
        add_action( 'init', array( 'PrimeLink\Modules\LiveFeed\LiveFeedSyncService', 'register_cron_intervals' ) );
        add_action( 'mt_primelink_live_feed_sync', array( 'PrimeLink\Modules\LiveFeed\LiveFeedSyncService', 'sync_feed' ) );

        // Initialize license verification system
        Updater::init();

        do_action( 'mt_primelink_loaded' );
    }
}