<?php
/**
 * Add to Cart Widget
 *
 * Elementor widget that renders an add-to-cart button with optional quantity
 * selector and price display. Supports simple and variable products.
 *
 * @package GGM_Commerce
 */

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

require_once __DIR__ . '/widget-add-to-cart/elementor-render.php';

class GGM_Commerce_Widget_Add_To_Cart extends \GGM_Commerce_Base_Widget
{
    public function get_name()
    {
        return 'ggmc-add-to-cart';
    }

    public function get_title()
    {
        return 'Add to Cart';
    }

    public function get_icon()
    {
        return 'eicon-cart-medium';
    }

    public function get_script_depends()
    {
        return ['ggmc-cart'];
    }

    protected function register_controls()
    {
        require __DIR__ . '/widget-add-to-cart/elementor-controls.php';
        require __DIR__ . '/widget-add-to-cart/elementor-controls-style.php';
    }

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

    /**
     * Get default styles for this widget.
     * Uses centralized configuration from default-widget-styles.php.
     */
    public static function get_static_default_styles() {
        // Use the centralized config via base widget helper
        return self::get_defaults_from_config();
    }
}
