<?php
if (!defined('ABSPATH')) {
    exit;
}
/* @var UpVimeo_Api_Helper $upvimeo_vimeo_helper */

$upvimeo_vimeo_helper = isset($args['upvimeo_helper']) ? $args['upvimeo_helper'] : (isset($upvimeo_vimeo_helper) ? $upvimeo_vimeo_helper : null);
$upvimeo_db_helper = isset($args['db_helper']) ? $args['db_helper'] : (isset($upvimeo_db_helper) ? $upvimeo_db_helper : null);
$upvimeo_settings_helper = isset($args['settings_helper']) ? $args['settings_helper'] : (isset($upvimeo_settings_helper) ? $upvimeo_settings_helper : null);

/* @var UpVimeo_Db_Helper $upvimeo_db_helper */
/* @var UpVimeo_Settings_Helper $upvimeo_settings_helper */
?>

<h2><?php esc_html_e('Upload to Vimeo', 'upvimeo-direct-uploads'); ?></h2>
<div class="wvv-box">
    <h3><?php esc_html_e('Oh, snap!', 'upvimeo-direct-uploads'); ?></h3>
    <p>
        <?php esc_html_e('Sorry. Looks like you are not allowed to upload videos to vimeo.', 'upvimeo-direct-uploads'); ?>
    </p>
    <?php if (is_array($upvimeo_vimeo_helper->scopes) && count($upvimeo_vimeo_helper->scopes) > 0): ?>
        <ul>
            <li><strong><?php esc_html_e('Current scopes', 'upvimeo-direct-uploads'); ?></strong>:
                <?php echo esc_html(implode(', ', $upvimeo_vimeo_helper->scopes)); ?>
            </li>
            <?php if (!empty($upvimeo_vimeo_helper->scopes_missing)): ?>
                <li><strong><?php esc_html_e('Missing scopes', 'upvimeo-direct-uploads'); ?></strong>:
                    <?php echo esc_html(implode(', ', $upvimeo_vimeo_helper->scopes_missing)); ?>
                </li>
            <?php endif; ?>
        </ul>
    <?php endif; ?>
    <p>
        <?php echo wp_kses_post(sprintf(
            /* translators: %s: link to Vimeo developer portal */
            __('Please go to the %s and re-generate your access token with all the required scopes. If you need help check the link bellow.', 'upvimeo-direct-uploads'),
            '<a target="_blank" href="https://developer.vimeo.com/">Vimeo developer portal</a>'
        )); ?>
    </p>
    <hr />
    <p>
        <a target="_blank" href="<?php echo esc_url(upvimeo_get_guide_url()); ?>"
            class="button-primary"><?php esc_html_e('Documentation', 'upvimeo-direct-uploads'); ?></a>
    </p>
</div>