<?php
/**
 * In-plugin usage policy (free with credit / paid removal).
 *
 * @package AuraBuilder
 */

declare(strict_types=1);

namespace AuraBuilder\Admin;

use AuraBuilder\Licensing\License;

final class PolicyPage {

	public function hooks(): void {
		add_action( 'admin_menu', array( $this, 'menu' ), 20 );
	}

	public function menu(): void {
		add_submenu_page(
			'aura-builder-pages',
			__( 'Política de uso', 'auranet-page-theme-builder' ),
			__( 'Política de uso', 'auranet-page-theme-builder' ),
			'manage_options',
			'aura-builder-policy',
			array( $this, 'render' )
		);
	}

	public function render(): void {
		if ( ! current_user_can( 'manage_options' ) ) {
			wp_die( esc_html__( 'Sem permissão.', 'auranet-page-theme-builder' ) );
		}
		$price   = License::PRICE_BRL;
		$buy     = License::BUY_URL;
		$plugin  = License::PLUGIN_URL;
		$policy  = License::POLICY_URL;
		?>
		<div class="wrap" style="max-width:780px">
			<h1><?php esc_html_e( 'Política de uso — Aura Builder (Editor Auranet)', 'auranet-page-theme-builder' ); ?></h1>
			<p style="color:#646970;font-size:14px">
				<?php esc_html_e( 'Leia com atenção. Esta é a condição única do plano gratuito.', 'auranet-page-theme-builder' ); ?>
			</p>

			<div style="background:#fff;border:1px solid #c3c4c7;border-radius:8px;padding:24px 28px;line-height:1.65;color:#1d2327">
				<h2 style="margin-top:0;font-size:17px"><?php esc_html_e( '1. Free and fully functional', 'auranet-page-theme-builder' ); ?></h2>
				<p>
					<?php esc_html_e( 'All features of Auranet Page and Theme Builder included in this plugin are free for personal and commercial use. No license key is required to unlock any built-in feature.', 'auranet-page-theme-builder' ); ?>
				</p>

				<h2 style="font-size:17px"><?php esc_html_e( '2. Optional footer credit', 'auranet-page-theme-builder' ); ?></h2>
				<p>
					<?php esc_html_e( 'You may optionally display “Powered by Auranet Builder” in the public footer (Settings). It is off by default and can be turned on or off at any time without payment.', 'auranet-page-theme-builder' ); ?>
				</p>

				<h2 style="font-size:17px"><?php esc_html_e( '3. Donations / support', 'auranet-page-theme-builder' ); ?></h2>
				<p>
					<?php esc_html_e( 'Optional support for Auranet is available on our website. Donations never unlock or lock plugin features hosted on WordPress.org.', 'auranet-page-theme-builder' ); ?>
				</p>
				<p>
					<a class="button" href="<?php echo esc_url( $plugin ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Plugin page', 'auranet-page-theme-builder' ); ?></a>
				</p>

				<h2 style="font-size:17px"><?php esc_html_e( '4. Software license (code)', 'auranet-page-theme-builder' ); ?></h2>
				<p>
					<?php esc_html_e( 'This plugin is distributed under the GPL (GNU General Public License) v2 or later.', 'auranet-page-theme-builder' ); ?>
				</p>

				<h2 style="font-size:17px"><?php esc_html_e( '5. Brand', 'auranet-page-theme-builder' ); ?></h2>
				<p>
					<?php esc_html_e( '“Auranet” and “Auranet Page and Theme Builder” identify Auranet. Do not present modified versions as the official product.', 'auranet-page-theme-builder' ); ?>
				</p>

				<h2 style="font-size:17px"><?php esc_html_e( '6. Acceptance', 'auranet-page-theme-builder' ); ?></h2>
				<p>
					<?php esc_html_e( 'By installing this plugin you acknowledge this policy. Contact Auranet via the official website if you have questions.', 'auranet-page-theme-builder' ); ?>
				</p>

				<p style="margin-bottom:0;color:#646970;font-size:13px">
					<a href="<?php echo esc_url( $policy ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Versão online da política', 'auranet-page-theme-builder' ); ?></a>
					·
					<a href="<?php echo esc_url( $plugin ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Página do plugin', 'auranet-page-theme-builder' ); ?></a>
					·
					<?php echo esc_html( 'Auranet · ' . gmdate( 'Y' ) ); ?>
				</p>
			</div>
		</div>
		<?php
	}
}
