<?php

namespace WKO\Controllers\Woocommerce;

use Automattic\WooCommerce\Blocks\Integrations\IntegrationInterface;
use WKO\Helpers\Config;

class CheckoutBanner implements IntegrationInterface
{
    public function get_name()
    {
        return 'wc-koin-checkout-banner';
    }

    public function initialize()
    {
        $scriptUrl = Config::__dist("blocks/checkout-banner/index.js");
        $assetPath = Config::__dist("blocks/checkout-banner/index.asset.php");

        $scriptAsset = file_exists($assetPath)
            ? require_once $assetPath
            : [
                'dependencies' => [],
                'version' => Config::__version(),
            ];


        wp_register_script(
            'wc-koin-checkout-banner',
            $scriptUrl,
            $scriptAsset['dependencies'],
            $scriptAsset['version'],
            true
        );

        wp_register_script(
            'koin-checkout-banner-external',
            'https://banner-checkout.koin.com.br/index.js',
            [],
            null,
            true
        );
    }

    public function get_script_handles()
    {
        return ['wc-koin-checkout-banner', 'koin-checkout-banner-external'];
    }

    public function get_editor_script_handles()
    {
        return [];
    }

    public function get_script_data()
    {
        return [];
    }

    public function get_stylesheet_handles()
    {
        return [];
    }
}
