<?php
# Silence is golden.

use Miladmodaresi\Taamito\Admin\Dashboard;
use Miladmodaresi\Taamito\Admin\SyncDataController;
use Miladmodaresi\Taamito\Admin\WizardController;
use Miladmodaresi\Taamito\Api\CronJobs;
use Miladmodaresi\Taamito\Api\Routes;
use Miladmodaresi\Taamito\Base\InitialTaam;

add_action('admin_menu', [new Dashboard, 'admin_page']);
add_action('admin_init', [new Dashboard, 'admin_ajax_init']);
add_action('admin_init', [new WizardController, 'admin_ajax_init']);
// add_action('admin_init', function () {
//     (new CronJobs())->crons();
// });

if (defined('TAAMITO_API'))
    add_action('rest_api_init', [new Routes, 'routes']);

// add_filter('cron_schedules', [new CronJobs, 'init']);
add_action( 'init',  [new CronJobs, 'use']);
add_action('taamito_sync_data', [new CronJobs, 'crons']);
add_action('woocommerce_order_status_processing', [new SyncDataController, 'createOrder'], 10, 1);
register_activation_hook(TAAMITO_PLUGIN_FILE, [new InitialTaam, 'dbInitialize']);
add_filter('plugin_action_links_' . plugin_basename(TAAMITO_PLUGIN_FILE), [new InitialTaam, 'plugin_action_links']);

add_action('init', 'taamito_load_plugin_textdomain');
function taamito_load_plugin_textdomain()
{
    $data = load_plugin_textdomain('taamito', FALSE, basename(dirname(__FILE__)) . '/languages');
}
