<?php
/**
 * Style presets for the button builder.
 *
 * @package Rsmspark_Content_Widgets
 */

defined( 'ABSPATH' ) || exit;

/**
 * Rsmspark_Buttons_Presets
 */
class Rsmspark_Buttons_Presets {

	/**
	 * @return array<string, array{label: string, config: array<string, mixed>, pro?: bool}>
	 */
	public static function all() {
		$presets = array(
			'primary-cta' => array(
				'label'  => __( 'Primary CTA', 'rsm-content-widgets' ),
				'config' => array(
					'shape'          => 'rounded',
					'bg_color'       => '#2563eb',
					'bg_hover_color' => '#1d4ed8',
					'text_color'     => '#ffffff',
					'shadow'         => 'soft',
					'hover_effect'   => 'lift',
				),
			),
			'outline' => array(
				'label'  => __( 'Outline', 'rsm-content-widgets' ),
				'config' => array(
					'bg_color'       => '#ffffff',
					'bg_hover_color' => '#f8fafc',
					'text_color'     => '#1e293b',
					'border_color'   => '#cbd5e1',
					'border_width'   => 2,
					'shadow'         => 'none',
					'hover_effect'   => 'none',
				),
			),
			'ghost' => array(
				'label'  => __( 'Ghost', 'rsm-content-widgets' ),
				'config' => array(
					'bg_color'       => 'transparent',
					'bg_hover_color' => '#f1f5f9',
					'text_color'     => '#334155',
					'border_color'   => 'transparent',
					'shadow'         => 'none',
					'hover_effect'   => 'scale',
				),
			),
			'dark-pill' => array(
				'label'  => __( 'Dark Pill', 'rsm-content-widgets' ),
				'config' => array(
					'shape'          => 'pill',
					'bg_color'       => '#0f172a',
					'bg_hover_color' => '#334155',
					'text_color'     => '#ffffff',
					'hover_effect'   => 'scale',
					'icon'           => 'cart',
				),
			),
			'danger' => array(
				'label'  => __( 'Danger', 'rsm-content-widgets' ),
				'config' => array(
					'shape'          => 'rectangle',
					'border_radius'  => 4,
					'bg_color'       => '#dc2626',
					'bg_hover_color' => '#b91c1c',
					'text_color'     => '#ffffff',
					'hover_effect'   => 'glow',
				),
			),
		);

		return apply_filters( 'rsmspark_buttons_style_presets', $presets );
	}

	/**
	 * @param string $slug Preset slug.
	 * @return array<string, mixed>|null
	 */
	public static function get( $slug ) {
		$slug    = sanitize_key( (string) $slug );
		$presets = self::all();

		if ( ! isset( $presets[ $slug ] ) ) {
			return null;
		}

		$preset = $presets[ $slug ];

		return is_array( $preset['config'] ?? null ) ? $preset['config'] : null;
	}
}
