<?php

namespace Limb_Chatbot\Includes\Factories;

use Limb_Chatbot\Includes\Widgets\Data\Availability_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Chats_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Form_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Generic_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Greeting_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Header_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Links_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Messages_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Privacy_Policy_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Prompts_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Start_Chat_Button_Widget_Config;
use Limb_Chatbot\Includes\Widgets\Data\Widget_Config_Interface;

/**
 * Factory for per-widget-type data classes.
 *
 * @since 2.0.0
 */
class Widget_Config_Factory {

	public const SUPPORTED_TYPES = [
		'abandoned_cart',
		'form',
		'prompts',
		'messages',
		'privacy_policy',
		'chats',
		'availability',
		'start_chat_button',
		'greeting',
		'header',
		'links',
		'recommended_products',
		'featured_content',
		'banner',
	];

	public function make( string $type ): Widget_Config_Interface {
		$type = sanitize_key( $type );
		switch ( $type ) {
			case 'header':
				return new Header_Widget_Config();
			case 'greeting':
				return new Greeting_Widget_Config();
			case 'start_chat_button':
				return new Start_Chat_Button_Widget_Config();
			case 'availability':
				return new Availability_Widget_Config();
			case 'chats':
				return new Chats_Widget_Config();
			case 'prompts':
				return new Prompts_Widget_Config();
			case 'messages':
				return new Messages_Widget_Config();
			case 'privacy_policy':
				return new Privacy_Policy_Widget_Config();
			case 'form':
				return new Form_Widget_Config();
			case 'links':
				return new Links_Widget_Config();
			default:
				return new Generic_Widget_Config();
		}
	}
}
