<?php
/**
 * Custom Fields Module Bootstrap
 *
 * @package AmbassadorHub\CustomFields
 */

namespace AmbassadorHub\Fields;

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

/**
 * Fields Module - Handles custom field functionality.
 */
final class FieldsModule {

	/**
	 * Initialize the Fields module.
	 *
	 * @return void
	 */
	public static function init(): void {

		add_action( 'init', array( self::class, 'register_fields' ) );
		add_filter( 'ambh_get_field_types', array( FieldFactory::class, 'filter_type_labels' ) );
	}

	public static function register_fields() {

		FieldFactory::register( 'text', Fields\TextField::class, esc_html__( 'Text Field', 'ambassadorhub' ) );
		FieldFactory::register( 'number', Fields\NumberField::class, esc_html__( 'Number Field', 'ambassadorhub' ) );
		FieldFactory::register( 'checkbox', Fields\CheckboxField::class, esc_html__( 'Checkbox', 'ambassadorhub' ) );
		FieldFactory::register( 'radio', Fields\RadioField::class, esc_html__( 'Radio Buttons', 'ambassadorhub' ) );
		FieldFactory::register( 'dropdown', Fields\DropdownField::class, esc_html__( 'Dropdown', 'ambassadorhub' ) );
		FieldFactory::register( 'address', Fields\AddressField::class, esc_html__( 'Address', 'ambassadorhub' ) );
		FieldFactory::register( 'textarea', Fields\TextArea::class, esc_html__( 'Text Area', 'ambassadorhub' ) );
	}

	public static function get_registered_fields(): array {
		// This method would return all custom fields.
		return apply_filters( 'ambh_get_field_types', array() );
	}
}
