<?php
/**
 * Taxonomy Header Widget
 * Displays category/tag name, image, description, and product count on archive pages.
 */

if (!defined('ABSPATH')) {
    exit;
}

require_once __DIR__ . '/widget-taxonomy-header/elementor-render.php';

class GGM_Commerce_Widget_Taxonomy_Header extends \GGM_Commerce_Base_Widget {

    public function get_name() {
        return 'ggmc-taxonomy-header';
    }

    public function get_title() {
        return 'Taxonomy Header';
    }

    public function get_icon() {
        return 'eicon-archive-title';
    }

    public function get_keywords() {
        return ['taxonomy', 'category', 'tag', 'header', 'archive', 'title', 'ggm-commerce'];
    }

    protected function register_controls() {
        require __DIR__ . '/widget-taxonomy-header/elementor-controls.php';
        require __DIR__ . '/widget-taxonomy-header/elementor-controls-style.php';
    }

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

    public static function get_static_default_styles() {
        if (get_option('ggm_commerce_defaults_cleared', false)) {
            return [];
        }

        return [
            'taxonomy_type'        => 'auto',
            'show_image'           => 'yes',
            'show_title'           => 'yes',
            'title_tag'            => 'h1',
            'show_description'     => 'yes',
            'show_product_count'   => 'yes',
            'product_count_format' => '{count} products',
            'alignment'            => 'center',
            'title_color'          => '#1F2937',
            'description_color'    => '#6B7280',
            'count_color'          => '#9CA3AF',
        ];
    }
}
