<?php
/**
 * GGM Commerce Address Form Widget
 * A styleable address form for popups - follows DEFAULT-STYLING-SYSTEM.md
 */

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

require_once plugin_dir_path( __FILE__ ) . '../class-ggm-commerce-base-widget.php';
require_once plugin_dir_path( __FILE__ ) . 'widget-address-form/elementor-render.php';

class GGM_Commerce_Address_Form_Widget extends GGM_Commerce_Base_Widget {

    public function get_name() {
        return 'ggmc-address-form';
    }

    public function get_title() {
        return __( 'Address Form', 'ggm-commerce' );
    }

    public function get_icon() {
        return 'eicon-form-horizontal';
    }

    public function get_categories() {
        return [ 'ggm-commerce' ];
    }

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

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

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