<?php

namespace Limb_Chatbot\Includes\Factories;

use Limb_Chatbot\Includes\Data_Objects\Chat;
use Limb_Chatbot\Includes\Repositories\Message_Repository;
use Limb_Chatbot\Includes\Services\Message_Service;


/**
 * Factory to create appropriate Message_Service instances based on chat and chatbot type.
 *
 * @since 1.0.0
 */
class Message_Service_Factory {

	/**
	 * Create and return a Message_Service instance.
	 *
	 * @param  Chat  $chat  The chat data object.
	 * @param  string|null  $role
	 *
	 * @return Message_Service
	 *
	 * @since 1.0.0
	 */
	public function make( Chat $chat, ?string $role = 'user' ) {
		$repository = new Message_Repository();

		return new Message_Service( $chat, $repository );
	}
}