<?php
/**
 * Product Details Link Widget
 *
 * Displays a link to the current product's details page.
 * Useful in Quick View popups and other contexts where users need to navigate to full product page.
 */

// If this file is called directly, abort.
if (! defined('ABSPATH')) {
    exit;
}

require_once __DIR__ . '/widget-product-details-link/elementor-render.php';

class GGM_Commerce_Widget_Product_Details_Link extends \GGM_Commerce_Base_Widget
{
    public function get_name()
    {
        return 'ggmc-product-details-link';
    }

    public function get_title()
    {
        return 'Product Details Link';
    }

    public function get_icon()
    {
        return 'eicon-editor-external-link';
    }

    public function get_keywords()
    {
        return ['product', 'link', 'details', 'view', 'more', 'ggm'];
    }

    protected function register_controls()
    {
        require __DIR__ . '/widget-product-details-link/elementor-controls.php';
        require __DIR__ . '/widget-product-details-link/elementor-controls-style.php';
    }

    protected function render()
    {
        ggmc_product_details_link_render( $this );
    }

    /**
     * Get default styles for this widget
     */
    public static function get_static_default_styles() {
        // Check if defaults have been cleared globally
        if (get_option('ggm_commerce_defaults_cleared', false)) {
            return [];
        }

        return [
            'link_color' => '#2563eb',
            'link_hover_color' => '#1d4ed8',
            'link_typography_typography' => 'custom',
            'link_typography_font_family' => "'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
            'link_typography_font_size' => ['size' => '14', 'unit' => 'px'],
            'link_typography_font_weight' => '500',
        ];
    }
}
