<?php
/**
 * AVIF Upload module settings.
 *
 * @package AvifUpload
 */

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

if ( ! \WP_PowerSuite\Core\NetworkScope::canManagePlugin() ) {
	return;
}

$module_id = $module_id ?? 'avif-upload';

require_once __DIR__ . '/module.php';
$avif_upload_module = new \AvifUpload\Module();
$supported          = $avif_upload_module->serverSupportsAvif();
$cap_message        = $avif_upload_module->getCapabilityMessage();
?>

<div class="wp-powersuite-module-settings" data-module-id="<?php echo esc_attr( $module_id ); ?>">
	<form class="wp-powersuite-module-settings-form" data-module-id="<?php echo esc_attr( $module_id ); ?>">
		<?php wp_nonce_field( 'wp_powersuite_save_module_settings_' . $module_id, 'wp_powersuite_nonce' ); ?>

		<div class="wpps-avif-upload-capability" style="margin-bottom: 16px; padding: 10px 12px; border-left: 4px solid <?php echo $supported ? '#00a32a' : '#d63638'; ?>; background: <?php echo $supported ? '#edfaef' : '#fcf0f1'; ?>;">
			<strong><?php echo $supported ? esc_html__( 'Status: Ready', 'wp-powersuite' ) : esc_html__( 'Status: Not ready', 'wp-powersuite' ); ?></strong>
			<span> — <?php echo esc_html( $cap_message ); ?></span>
		</div>

		<p class="description">
			<?php esc_html_e( 'When enabled, authors with upload permission can add AVIF files in the Media Library and block editor. Uploaded files are checked for a valid AVIF header. No extra settings are required.', 'wp-powersuite' ); ?>
		</p>
	</form>
</div>
