<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

$gcaptcha_data = SFTCY_Wordform::wordform_settings_page_grecaptcha_config();
// print_r( $gcaptcha_data );
?>
<div class="wrap sc-wordform-setting-page-gcaptcha-tab-table-wrapper">
    <h4>
    <i class="fa-solid fa-circle-info"></i>   
      If you do not have Google reCaptcha keys yet then you can <a href="https://www.google.com/recaptcha/admin/create" target="_blank">create free Google reCaptcha keys</a>. 
      You can also <a href="https://cloud.google.com/recaptcha-enterprise/docs/keys" target="_blank">check different key types</a>.  Please <strong>use correct reCaptcha type & version</strong> 
      with keys to work Google reCaptcha work properly with your created form.
    </h4>

<form id="scWordformSettingsgCaptchaTabForm" method="post">
	<table class="wordform-grecaptcha-settings-tbl">
		<tbody>		    		    				
            <tr>
                <td class="sc-wordform-settings-gcaptcha-tab-label-td">
                    <h4><?php esc_html_e( 'Google reCaptcha Type', 'wordform' ); ?></h4>   											
                </td>
                <td>
                    <select id="scWordformSelectreCaptchaKeysType" name="wordform-gcaptcha-type">
                        <option value="classic" <?php selected( $gcaptcha_data['gcaptcha-type'], 'classic' ); ?> ><?php esc_html_e( 'Classic', 'wordform' ); ?></option>
                        <option value="enterprise" <?php selected( $gcaptcha_data['gcaptcha-type'], 'enterprise' ); ?> ><?php esc_html_e( 'Enterprise', 'wordform' ); ?></option>                                        
                    </select>
                    <br/><small><?php esc_html_e( 'Choose Classic or Enterprise reCaptcha Type Keys you have generated.', 'wordform' ); ?></small>
                </td>
            </tr>

            <tr>
                <td class="sc-wordform-settings-gcaptcha-tab-label-td">
                    <h4>                                        
                        <?php esc_html_e( 'Google reCaptcha Version', 'wordform' ); ?>
                    </h4>   					
                </td>
                <td>
                    <br />
                    <label>                                   
                        <input type="radio" value="v2" name="wordform-gcaptcha-version" class="wordform-gcaptcha-version" <?php checked( 'v2', $gcaptcha_data['gcaptcha-version'], true ); ?> />
                        Challenge (V2) - Verify requests with a challenge				                                    
                    </label>
                    <br/><br/>
                    <label>
                        <input type="radio" value="v3" name="wordform-gcaptcha-version" class="wordform-gcaptcha-version" <?php checked( 'v3', $gcaptcha_data['gcaptcha-version'], true ); ?> />				
                        Score based (V3) - Verify requests with a score
                    </label>    
                    <br />
                </td>   				
            </tr>

            <tr>
                <td class="sc-wordform-settings-gcaptcha-tab-label-td">
                    <h4>
                        <i class="fa-solid fa-key"></i>
                        <?php esc_html_e( 'Site Key', 'wordform' ); ?>
                    </h4>   					
                </td>
                <td>   	
                    <input type="text" value="<?php echo esc_attr( $gcaptcha_data['gcaptcha-site-key'] ); ?>" name="wordform-gcaptcha-site-key" class="wordform-gcaptcha-site-key" placeholder="Site Key" />				
                </td>   				
            </tr>

            <tr>
                <td class="sc-wordform-settings-gcaptcha-tab-label-td">
                    <h4>
                        <i class="fa-solid fa-key"></i>
                        <?php esc_html_e( 'Secret Key', 'wordform' ); ?>
                    </h4>   					
                </td>
                <td>   	
                    <input type="text" value="<?php echo esc_attr( $gcaptcha_data['gcaptcha-secret-key'] ); ?>" name="wordform-gcaptcha-secret-key" class="wordform-gcaptcha-secret-key" placeholder="Secret Key" />				
                </td>   				
            </tr>


            <tr>
                <td class="sc-wordform-settings-gcaptcha-tab-label-td">
                    <h4>                                        
                        <?php esc_html_e( 'Google reCaptcha theme', 'wordform' ); ?>
                    </h4>   					
                </td>
                <td>
                    <br />
                    <label>                                   
                        <input type="radio" value="light" name="wordform-gcaptcha-theme" class="wordform-gcaptcha-theme" <?php checked( 'light', $gcaptcha_data['gcaptcha-theme'], true ); ?> />
                        <?php esc_html_e( 'Light', 'wordform' ); ?>
                    </label>
                    <br/><br/>
                    <label>
                        <input type="radio" value="dark" name="wordform-gcaptcha-theme" class="wordform-gcaptcha-theme" <?php checked( 'dark', $gcaptcha_data['gcaptcha-theme'], true ); ?> />				
                        <?php esc_html_e( 'Dark', 'wordform' ); ?>
                    </label>    
                    <br />
                </td>   				
            </tr>


            <tr>
                <td colspan="2">
                    <button type="submit" class="button button-primary button-large"><?php esc_html_e( 'Save', 'wordform' ); ?></button>
                    <span class="sc-wordform-gcaptcha-message-settings-info"></span>
                </td>
            </tr>
					   
		</tbody>
	</table>
</form>  

</div>
