<?php
/**
 * One-click section presets for the visual editor.
 *
 * @package EasySite_Pro
 */

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

/**
 * Get section preset blocks keyed by slug.
 *
 * @return array
 */
function easysite_get_section_presets() {
	$presets = array(
		'pricing-3col' => array(
			'label'       => __( 'Pricing — 3 columns', 'easysite-pro' ),
			'description' => __( 'Three-tier pricing table', 'easysite-pro' ),
			'icon'        => 'dashicons-tag',
			'block'       => array(
				'type'   => 'pricing',
				'fields' => array(
					'title'          => __( 'Our Plans', 'easysite-pro' ),
					'plan1_name'     => __( 'Starter', 'easysite-pro' ),
					'plan1_price'    => '£25/mo',
					'plan1_features' => __( "Core features\nEmail support\n1 user", 'easysite-pro' ),
					'plan2_name'     => __( 'Growth', 'easysite-pro' ),
					'plan2_price'    => '£49/mo',
					'plan2_features' => __( "Everything in Starter\nPriority support\n5 users", 'easysite-pro' ),
					'plan3_name'     => __( 'Pro', 'easysite-pro' ),
					'plan3_price'    => '£79/mo',
					'plan3_features' => __( "Everything in Growth\nDedicated manager\nUnlimited users", 'easysite-pro' ),
				),
			),
		),
		'team-grid' => array(
			'label'       => __( 'Team — 3 members', 'easysite-pro' ),
			'description' => __( 'Team grid with photos', 'easysite-pro' ),
			'icon'        => 'dashicons-groups',
			'block'       => array(
				'type'   => 'team',
				'fields' => array(
					'title'      => __( 'Meet the Team', 'easysite-pro' ),
					'member1_name' => __( 'Alex Rivera', 'easysite-pro' ),
					'member1_role' => __( 'Founder', 'easysite-pro' ),
					'member2_name' => __( 'Jordan Lee', 'easysite-pro' ),
					'member2_role' => __( 'Operations', 'easysite-pro' ),
					'member3_name' => __( 'Sam Patel', 'easysite-pro' ),
					'member3_role' => __( 'Customer Success', 'easysite-pro' ),
				),
			),
		),
		'faq-accordion' => array(
			'label'       => __( 'FAQ — 4 questions', 'easysite-pro' ),
			'description' => __( 'Frequently asked questions', 'easysite-pro' ),
			'icon'        => 'dashicons-editor-help',
			'block'       => array(
				'type'   => 'faq',
				'fields' => array(
					'title' => __( 'Frequently Asked Questions', 'easysite-pro' ),
					'q1'    => __( 'How do I get started?', 'easysite-pro' ),
					'a1'    => __( 'Contact us for a free consultation and we will walk you through the process.', 'easysite-pro' ),
					'q2'    => __( 'What are your hours?', 'easysite-pro' ),
					'a2'    => __( 'Monday–Friday, 9am–5pm. Weekend appointments available by request.', 'easysite-pro' ),
					'q3'    => __( 'Do you offer refunds?', 'easysite-pro' ),
					'a3'    => __( 'Yes — satisfaction guaranteed within 30 days.', 'easysite-pro' ),
					'q4'    => __( 'Where are you located?', 'easysite-pro' ),
					'a4'    => __( 'We serve clients locally and remotely worldwide.', 'easysite-pro' ),
				),
			),
		),
		'testimonials-3' => array(
			'label'       => __( 'Testimonials — 3 quotes', 'easysite-pro' ),
			'description' => __( 'Social proof section', 'easysite-pro' ),
			'icon'        => 'dashicons-format-quote',
			'block'       => array(
				'type'   => 'testimonials',
				'fields' => array(
					'title' => __( 'What Our Clients Say', 'easysite-pro' ),
					'q1'    => __( 'Outstanding service from start to finish. Highly recommend!', 'easysite-pro' ),
					'a1'    => __( 'Maria K.', 'easysite-pro' ),
					'q2'    => __( 'Professional, friendly, and delivered exactly what we needed.', 'easysite-pro' ),
					'a2'    => __( 'James T.', 'easysite-pro' ),
					'q3'    => __( 'The best decision we made for our business this year.', 'easysite-pro' ),
					'a3'    => __( 'Lisa W.', 'easysite-pro' ),
				),
			),
		),
		'cta-gradient' => array(
			'label'       => __( 'CTA — gradient banner', 'easysite-pro' ),
			'description' => __( 'Call-to-action with gradient', 'easysite-pro' ),
			'icon'        => 'dashicons-megaphone',
			'block'       => array(
				'type'   => 'cta',
				'fields' => array(
					'title'       => __( 'Ready to get started?', 'easysite-pro' ),
					'subtitle'    => __( 'Book a free consultation today — no obligation.', 'easysite-pro' ),
					'button_text' => __( 'Contact Us', 'easysite-pro' ),
					'button_url'  => '/contact',
					'style'       => 'gradient',
					'gradient'    => 'brand',
				),
			),
		),
		'contact-form' => array(
			'label'       => __( 'Contact form', 'easysite-pro' ),
			'description' => __( 'Contact section with form', 'easysite-pro' ),
			'icon'        => 'dashicons-email',
			'block'       => array(
				'type'   => 'contact',
				'fields' => array(
					'title'   => __( 'Get in Touch', 'easysite-pro' ),
					'subtitle'=> __( 'We would love to hear from you. Send us a message and we will reply within one business day.', 'easysite-pro' ),
				),
			),
		),
	);

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

/**
 * Presets for JS (block data only).
 *
 * @return array
 */
function easysite_section_presets_for_js() {
	$out = array();
	foreach ( easysite_get_section_presets() as $key => $preset ) {
		$out[ $key ] = array(
			'label'       => $preset['label'],
			'description' => $preset['description'],
			'icon'        => $preset['icon'],
			'block'       => $preset['block'],
		);
	}
	return $out;
}
