<?php

namespace Macymed\MacymedLinkTracker\Admin\Pages;

use Macymed\MacymedLinkTracker\Utils\Utils;

if (! defined('ABSPATH')) {
    exit; // Sécurité
}

abstract class Page
{
    abstract public static function init();
    abstract public static function render();
    public static function get_menu_structure(){
        return [];
    }


    public static function renderTitle($subtitle = null)
    {
        ?>
		
		<div class="macymed_link_tracker-title">
			<table>
				<tr>
					<td>
						<a href="https://extensions.macymed.fr" target="_blank">
							<div class="link-tracker-image"></div>
							
						</a>
					</td>
					<?php
                    if ($subtitle) {
                        ?>
						<td class="subtitle">
							<i> : <?php echo esc_html($subtitle); ?> </i>
						</td>
						<?php
                    }
        ?>
				</tr>
			</table>


		</div>
		<?php
    }
    public static function renderButton($label, $help, $icon, $inputName = null)
    {
        ?>
		<div style="border: 1px solid #ddd; padding: 20px; width: 200px; text-align: center; border-radius: 5px; display: flex; flex-direction: column; justify-content: space-between; height: 300px;">
			<div>
				<div style="font-size: 30px; color: #0073aa; margin-bottom: 10px;">
					<span class="dashicons <?php echo esc_html($icon); ?>"></span>
				</div>
				<label style="height:30px; display:block"><strong><?php echo esc_html($label); ?></strong></label>
				<p style="height:90px; display:block"><?php echo esc_html($help); ?></p>
			</div>
			<?php if ($inputName !== null) { ?>
				<input type="text" required name="<?php echo esc_html($inputName); ?>" value="" style="width: 100%; margin-bottom: 10px;">
			<?php } ?>
			<button class="button button-primary">Exécuter</button>
		</div>
		<?php
    }
    public static function renderNotice($message, $type)
    {
        echo '<div class="notice notice-' . esc_html($type) . ' is-dismissible">';
        echo '<p>' . esc_html($message) . '</p>';
        echo '</div>';
    }
}
