<?php
/**
 * Product Image Grid Widget
 * Displays all product images in configurable grid layouts
 *
 * @package GGM_Commerce
 */

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

// Include required files.
require_once plugin_dir_path( __FILE__ ) . '../data/class-product-gallery-data-handler.php';
require_once plugin_dir_path( __FILE__ ) . 'widget-product-image-grid/elementor-render.php';

class GGM_Commerce_Widget_Product_Image_Grid extends \GGM_Commerce_Base_Widget {

	/**
	 * Widget name.
	 *
	 * @return string
	 */
	public function get_name() {
		return 'ggmc-product-image-grid';
	}

	/**
	 * Widget title.
	 *
	 * @return string
	 */
	public function get_title() {
		return esc_html__( 'Product Image Grid', 'ggm-commerce' );
	}

	/**
	 * Widget icon.
	 *
	 * @return string
	 */
	public function get_icon() {
		return 'eicon-gallery-grid';
	}

	/**
	 * Widget categories.
	 *
	 * @return array
	 */
	public function get_categories() {
		return [ 'ggmc-widgets' ];
	}

	/**
	 * Widget keywords.
	 *
	 * @return array
	 */
	public function get_keywords() {
		return [ 'ggm-commerce', 'product', 'image', 'grid', 'gallery', 'masonry' ];
	}

	/**
	 * Script dependencies.
	 *
	 * @return array
	 */
	public function get_script_depends() {
		return [ 'ggmc-image-grid' ];
	}

	/**
	 * Register controls.
	 */
	protected function register_controls() {
		require plugin_dir_path( __FILE__ ) . 'widget-product-image-grid/elementor-controls.php';
		require plugin_dir_path( __FILE__ ) . 'widget-product-image-grid/elementor-controls-style.php';
	}

	/**
	 * Render widget output.
	 */
	protected function render() {
		ggmc_product_image_grid_render( $this );
	}

	/**
	 * Get default styles from centralized configuration.
	 *
	 * @return array
	 */
	public static function get_static_default_styles() {
		return self::get_defaults_from_config();
	}
}
