<?php
/**
 * @author 1902 Software
 * @copyright Copyright © 2023 1902 Software (https://1902software.com/magento/)
 * @package WriteTextAI_WriteTextAI
 */
?>

<?php
    use WriteTextAI\WriteTextAI\ViewModel\Premium;
?>

<?php
    /** @var Premium $premium */
    $premium = $block->getPremium();
    $getUnlockedEnterprise = $premium->getUnlockedEnterprise();
    $hasProAccess = $premium->getHasProAccess();
    $membershipType = $premium->getMembershipType();
    $showByApi = $getUnlockedEnterprise && $hasProAccess && $membershipType === Premium::MEMBERSHIP_TYPE_ENTERPRISE;

    $showPopup = $showByApi;
?>

<div class="wtai-welcome-enterprise-popup-modal" data-bind="scope: 'wtaiWelcomeEnterprisePopup'" style="display: none;">
    <div class="wtai-popup-content">
        <div class="wtai-popup-image">
            <img src="<?= /* @noEscape */ $block->getViewFileUrl(
                'WriteTextAI_WriteTextAI/images/welcome_banner.png'
            ) ?>" alt="Welcome to Enterprise">
        </div>
        <div class="wtai-popup-text">
            <div class="wtai-popup-title">
                <?= /* @noEscape */ __("You’re now on Enterprise!") ?>
            </div>
            <div>
                <p>
                    <?= /* @noEscape */ __("Unlock the highest level of WriteText.ai with advanced tools"
                        . " and dedicated support to power your content at scale.") ?>
                </p>
                <p class="wtai-check-item">
                    <span class="wtai-check-icon"></span>
                    <span>
                        <?= /* @noEscape */ __("Dedicated onboarding and priority support") ?>
                    </span>
                </p>
                <p class="wtai-check-item">
                    <span class="wtai-check-icon"></span>
                    <span>
                        <?= /* @noEscape */ __("Advanced template and workflow customization") ?>
                    </span>
                </p>
                <p class="wtai-check-item">
                    <span class="wtai-check-icon"></span>
                    <span>
                        <?= /* @noEscape */ __("Deploy WriteText.ai to your own private cloud (optional)") ?>
                    </span>
                </p>
                <p class="wtai-check-item">
                    <span class="wtai-check-icon"></span>
                    <span>
                        <?= /* @noEscape */ __("Get a licensed copy of the source code (optional)") ?>
                    </span>
                </p>
            </div>
            <div class="wtai-popup-buttons">
                <button type="button" class="action-primary primary" data-bind="click: closeEnterprisePopup">
                    <?= $escaper->escapeHtml(__('Got it')) ?>
                </button>
            </div>
        </div>
    </div>
</div>
<script type="text/x-magento-init">
    {
        "*": {
            "Magento_Ui/js/core/app": {
                "components": {
                    "wtaiWelcomeEnterprisePopup": {
                        "component": "WriteTextAI_WriteTextAI/js/popups/welcome-enterprise",
                        "saveUrl": "<?= $escaper->escapeJs($block->getUrl('wtai/settings/popups')) ?>",
                        "showPopupOnLoad": <?= /* @noEscape */ $showPopup ? 'true' : 'false' ?>
                    }
                }
            }
        }
    }
</script>