<?php

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

/**
 * MINIORANGE OAuth client apps
 *
 * @package    Admin\Guides
 */

/**
 * Admin Attribute Mapping
 */
class MoCognito_Admin_Attribute_Mapping {
	/**
	 * Attributes
	 *
	 * @var Attributes $attributes for attributes
	 */
	protected static $attributes;

	/**
	 * Initialize Vars
	 */
	protected static function initialize_vars() {
		self::$attributes = get_option( 'mo_oauth_attr_name_list' );
	}

	/**
	 * Emit CSS
	 */
	private static function emit_css() {
		?>
		<style>.attr-list-div .mo-side-table{border-collapse:collapse;width:100%;max-width:560px;table-layout:fixed;}.mo-side-table-th {background-color: #eee; text-align: center; padding: 8px; border-width:1px; border-style:solid; border-color:#212121;}.mo-side-table-th:nth-child(1){width:30%;}.mo-side-table-th:nth-child(2){width:70%;}.mo-side-table-tr:nth-child(odd) {background-color: #f2f2f2;} .mo-side-table-td{padding:8px;border-width:1px; border-style:solid; border-color:#212121;vertical-align:top;word-break:break-word;overflow-wrap:anywhere;}.mo-side-table-td:nth-child(1){width:30%;}.mo-side-table-td:nth-child(2){width:70%;}.attr-list-div{padding: 10px 0px;max-width:560px;box-sizing:border-box;}</style>
		<?php
	}

	/**
	 * Emit Attributes Table
	 */
	public static function emit_attribute_table() {
		self::initialize_vars();
		if ( false === self::$attributes || ! is_array( self::$attributes ) ) {
			return;
		}
		self::emit_css();
		?>
		<div class="attr-list-div">
			<div id="mo_support_layout" class="mo_support_layout">
				<div class="attr-list-div">
					<h2>Test Configuration</h2>
					<table class="mo-side-table">
						<tr class="mo-side-table-tr">
							<th class="mo-side-table-th">Attribute Name</th>
							<th class="mo-side-table-th">Attribute Value</th>
						</tr>
						<?php mocognito_testattrmappingconfig( '', self::$attributes, 'mo-side-table-' ); ?>
					</table>
				</div>
			</div>
		</div>
		<?php
	}
}
