<?php
/**
 * Connect Channels View Class
 *
 * @package MOMCS_Sync
 * @since 1.0.0
 */

declare( strict_types=1 );

namespace MOMCS_Sync\Views\Src\Common\Pages\Supplier;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

use MOMCS_Sync\Views\Src\Common\Components\Header_View;

/**
 * Render the connect channels view.
 */
class Connect_Channels_View {
	/**
	 * Render the connect channels view.
	 *
	 * @return void
	 */
	public function render(): void {
		// Get connection stats.
		$connection_stats = \MOMCS_Sync\Includes\Common\Utils\Connection_Limits::get_connection_stats();
		$limit_check      = \MOMCS_Sync\Includes\Common\Utils\Connection_Limits::can_add_amazon_connection();
		?>
		<div class="wrap">
			<?php ( new Header_View( 'connect' ) )->render(); ?>
			
			<div class="momcs-connect-container">
				<p><?php esc_html_e( 'Accelerate your sales by connecting to different marketplaces.', 'multi-channel-for-woocommerce' ); ?></p>
				
				<div class="momcs-channels-wrapper-new">
					<!-- Amazon Channel -->
					<div class="momcs-channel-rect-container">
						<div class="momcs-channel-rect-content">
							<div class="momcs-channel-rect-name">
								<?php esc_html_e( 'Amazon', 'multi-channel-for-woocommerce' ); ?>
							</div>
							<?php if ( $limit_check['can_add'] ) : ?>
								<a href="<?php echo esc_url( admin_url( 'admin.php?page=momcs-sync-dashboard&tab=connect&marketplace=amazon&step=1' ) ); ?>" 
								   class="momcs-channel-rect-connect">
									<?php esc_html_e( 'Connect', 'multi-channel-for-woocommerce' ); ?>
								</a>
							<?php else : ?>
								<span class="momcs-channel-rect-connect disabled" 
									  title="<?php echo esc_attr( $limit_check['message'] ); ?>">
									<?php esc_html_e( 'Limit Reached', 'multi-channel-for-woocommerce' ); ?>
								</span>
							<?php endif; ?>
						</div>
					</div>
					
					<!-- eBay Channel -->
					<div class="momcs-channel-rect-container">
						<div class="momcs-channel-rect-content">
							<div class="momcs-channel-rect-name">
								<?php esc_html_e( 'ebay', 'multi-channel-for-woocommerce' ); ?>
							</div>
							<a class="momcs-channel-rect-connect disabled">
								<?php esc_html_e( 'Coming Soon', 'multi-channel-for-woocommerce' ); ?>
							</a>
						</div>
					</div>
					
					<!-- Walmart Channel -->
					<div class="momcs-channel-rect-container">
						<div class="momcs-channel-rect-content">
							<div class="momcs-channel-rect-name">
								<?php esc_html_e( 'Walmart', 'multi-channel-for-woocommerce' ); ?>
							</div>
							<a class="momcs-channel-rect-connect disabled">
								<?php esc_html_e( 'Coming Soon', 'multi-channel-for-woocommerce' ); ?>
							</a>
						</div>
					</div>
				</div>
			</div>
		</div>
		<?php
	}
}
