<?php
/**
 * Load admin view for WooCommerceCheckOutForm.
 *
 * @package miniorange-sms-order-notification-otp-verification/controllers/forms/
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}
use WCSMSOTP\Handler\Forms\WooCommerceCheckOutForm;
use WCSMSOTP\Handler\Forms\WooCommerceCheckoutNew;
use WCSMSOTP\Helper\MoUtility;

$mowc_handler                   = mowc_is_block_based_checkout() ? WooCommerceCheckoutNew::instance() : WooCommerceCheckOutForm::instance();
$mowc_wc_checkout               = $mowc_handler->is_form_enabled() ? 'checked' : '';
$mowc_wc_checkout_hidden        = 'checked' === $mowc_wc_checkout ? '' : 'hidden';
$mowc_wc_checkout_enable_type   = $mowc_handler->get_otp_type_enabled();
$mowc_guest_checkout            = method_exists( $mowc_handler, 'isGuestCheckoutOnlyEnabled' ) && $mowc_handler->isGuestCheckoutOnlyEnabled() ? 'checked' : '';
$mowc_checkout_button           = method_exists( $mowc_handler, 'showButtonInstead' ) && $mowc_handler->showButtonInstead() ? 'checked' : '';
$mowc_checkout_payment_plans    = method_exists( $mowc_handler, 'getPaymentMethods' ) ? $mowc_handler->getPaymentMethods() : array();
$mowc_checkout_selection        = method_exists( $mowc_handler, 'isSelectivePaymentEnabled' ) && $mowc_handler->isSelectivePaymentEnabled() ? 'checked' : '';
$mowc_checkout_selection_hidden = 'checked' === $mowc_checkout_selection ? '' : 'hidden';
$mowc_wc_type_phone             = $mowc_handler->get_phone_html_tag();
$mowc_wc_type_email             = $mowc_handler->get_email_html_tag();
$mowc_button_text               = method_exists( $mowc_handler, 'get_button_text' ) ? $mowc_handler->get_button_text() : '';
$mowc_form_name                 = $mowc_handler->get_form_name();
$mowc_disable_autologin         = method_exists( $mowc_handler, 'isAutoLoginDisabled' ) && $mowc_handler->isAutoLoginDisabled() ? 'checked' : '';
$mowc_restrict_duplicates       = method_exists( $mowc_handler, 'restrict_duplicates' ) && $mowc_handler->restrict_duplicates() ? 'checked' : '';

$mowc_checkout_form_file = MOV_WC_DIR . 'views/forms/mowoocommercecheckoutform.php';
if ( ! MoUtility::mo_require_file( $mowc_checkout_form_file, MOV_WC_DIR ) ) {
	return;
}
require $mowc_checkout_form_file;
