<?php

/**
 * Plugin Name: MediaTasker
 * Plugin URI:  https://mediatasker.meixneralex.at/
 * Description: Media & task management hub for teams and clients.
 * Version:     1.0.1
 * Author:      mediaTasker
 * License:     GPL-2.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: mediatasker
 * Domain Path: /languages
 * Requires at least: 6.0
 * Requires PHP: 7.4
 *
 *
 * @package MediaTasker
 */
// Prevent direct file access.
if ( !defined( 'ABSPATH' ) ) {
    exit;
}
/*
|--------------------------------------------------------------------------
| Plugin Constants
|--------------------------------------------------------------------------
*/
define( 'MEDIAT_VERSION', '1.0.1' );
define( 'MEDIAT_PLUGIN_FILE', __FILE__ );
define( 'MEDIAT_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'MEDIAT_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'MEDIAT_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
/*
|--------------------------------------------------------------------------
| Freemius SDK Integration
|--------------------------------------------------------------------------
| Initialize the Freemius SDK before anything else.
| This provides licensing, updates, and account management.
*/
require_once MEDIAT_PLUGIN_DIR . 'includes/mediat_fs-init.php';
/*
|--------------------------------------------------------------------------
| Activation & Deactivation
|--------------------------------------------------------------------------
*/
/**
 * Runs on plugin activation.
 *
 * @return void
 */
function mediat_activate() {
    require_once MEDIAT_PLUGIN_DIR . 'includes/class-mediat_work-log.php';
    Mediat_Work_Log::create_table();
    // Flush rewrite rules so CPT permalinks work immediately.
    flush_rewrite_rules();
}

register_activation_hook( __FILE__, 'mediat_activate' );
/**
 * Runs on plugin deactivation.
 *
 * @return void
 */
function mediat_deactivate() {
    flush_rewrite_rules();
}

register_deactivation_hook( __FILE__, 'mediat_deactivate' );
/*
|--------------------------------------------------------------------------
| Bootstrap the Plugin
|--------------------------------------------------------------------------
*/
require_once MEDIAT_PLUGIN_DIR . 'includes/class-mediat_work-log.php';
require_once MEDIAT_PLUGIN_DIR . 'includes/class-media-tasker.php';
/**
 * Returns the singleton instance of the plugin.
 *
 * @return Mediat_Media_Tasker
 */
function mediat_plugin() {
    return Mediat_Media_Tasker::get_instance();
}

add_action( 'plugins_loaded', 'mediat_plugin' );