<?php

function absolute_2026_register_contact_form_pattern(): void {
	if ( ! function_exists( 'absolute_contact_register_block' ) ) {
		return;
	}

	ob_start();
	require get_theme_file_path( 'inc/patterns/contact-form-section.php' );
	$content = (string) ob_get_clean();

	register_block_pattern(
		'absolute-2026/contact-form-section',
		[
			'title'         => esc_html__( 'Contact Form Section', 'absolute-2026' ),
			'description'   => esc_html__( 'A two-column contact section with lead text and a working form. Requires Absolute Contact for Absolute 2026 and a configured WordPress mail service such as WP Mail SMTP. Send a test message before publishing.', 'absolute-2026' ),
			'categories'    => [ 'absolute-2026/sections', 'absolute-2026/calls-to-action' ],
			'keywords'      => [ 'contact', 'email', 'form' ],
			'viewportWidth' => 1280,
			'content'       => $content,
		]
	);

	ob_start();
	require get_theme_file_path( 'inc/patterns/page-contact.php' );
	$content = (string) ob_get_clean();

	register_block_pattern(
		'absolute-2026/page-contact',
		[
			'title'         => esc_html__( 'Contact', 'absolute-2026' ),
			'description'   => esc_html__( 'A complete contact page with a hero and working contact form section. Requires Absolute Contact for Absolute 2026 and a configured WordPress mail service such as WP Mail SMTP.', 'absolute-2026' ),
			'categories'    => [ 'absolute-2026/pages' ],
			'keywords'      => [ 'contact', 'email', 'form', 'starter page' ],
			'viewportWidth' => 1280,
			'content'       => $content,
		]
	);
}

add_action( 'init', 'absolute_2026_register_contact_form_pattern', 30 );
