<?php
/**
 * Service Section
 *
 * @package electrical_services
 */

 $wp_customize->add_section(
	'electrical_services_services_section',
	array(
		'panel'    => 'electrical_services_front_page_options',
		'title'    => esc_html__( 'Services Section', 'electrical-services' ),
		'priority' => 10,
	)
);

//Service Section - Enable Section.
$wp_customize->add_setting(
	'electrical_services_enable_services_section',
	array(
		'default'           => false,
		'sanitize_callback' => 'electrical_services_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Electrical_Services_Toggle_Switch_Custom_Control(
		$wp_customize,
		'electrical_services_enable_services_section',
		array(
			'label'    => esc_html__( 'Enable Services Section', 'electrical-services' ),
			'section'  => 'electrical_services_services_section',
			'settings' => 'electrical_services_enable_services_section'
		)
	)
);

// Partial Refresh
if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial(
		'electrical_services_enable_services_section',
		array(
			'selector' => '#electrical_services_services_section .section-link',
			'settings' => 'electrical_services_enable_services_section',
		)
	);
}

// ── New custom-cards settings ─────────────────────────────────────────────────

// Background decorative heading text.
$wp_customize->add_setting(
	'electrical_services_services_bg_heading',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'electrical_services_services_bg_heading',
	array(
		'label'           => esc_html__( 'Section Sub-Title', 'electrical-services' ),
		'section'         => 'electrical_services_services_section',
		'type'            => 'text',
		'active_callback' => 'electrical_services_is_services_section_enabled',
	)
);

// Section title (new standalone setting; falls back to trending_post_content if empty).
$wp_customize->add_setting(
	'electrical_services_services_section_title',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'electrical_services_services_section_title',
	array(
		'label'           => esc_html__( 'Section Title (Heading)', 'electrical-services' ),
		'section'         => 'electrical_services_services_section',
		'type'            => 'text',
		'active_callback' => 'electrical_services_is_services_section_enabled',
	)
);

// Select category for services posts.
$wp_customize->add_setting(
	'electrical_services_services_category',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	new Electrical_Services_Customize_Category_Dropdown_Control(
		$wp_customize,
		'electrical_services_services_category',
		array(
			'label'           => esc_html__( 'Select Category', 'electrical-services' ),
			'section'         => 'electrical_services_services_section',
			'settings'        => 'electrical_services_services_category',
			'active_callback' => 'electrical_services_is_services_section_enabled',
		)
	)
);