<?php
/**
 * BookiFlex
 *
 * @package   BookiFlex
 * @author    BookiFlex
 * @copyright Copyright (c) 2025 BookiFlex
 * @license   GPL-2.0-or-later
 *
 * @link      https://bookiflex.com
 */

declare(strict_types=1);

namespace BookiFlex\Plugin\UI\Blocks;

use BookiFlex\Core\Admin\Block\AbstractBlock;

defined('ABSPATH') || exit;

class BookingButtonVariation extends AbstractBlock
{
    protected function blockDir(): string
    {
        return $this->plugin->getPluginDir() . 'assets/blocks/booking-button';
    }

    public function register(): void
    {
        $dir = $this->blockDir();
        $assetFile = $dir . '/index.asset.php';
        $asset = file_exists($assetFile)
            ? require $assetFile
            : ['dependencies' => [], 'version' => ''];

        wp_register_script(
            'bookiflex-booking-button-variation',
            $this->plugin->getPluginUrl() . '/assets/blocks/booking-button/index.js',
            $asset['dependencies'],
            $asset['version']
        );

        add_action('enqueue_block_editor_assets', static function () {
            wp_enqueue_script('bookiflex-booking-button-variation');
        });
    }

    public function render(array $attributes, string $content, ?\WP_Block $block = null): string
    {
        return '';
    }
}
