<?php

namespace Rtcl\Services\AIServices;

use Rtcl\Interfaces\AIServiceInterface;

/**
 * Class ClaudeAdapter
 *
 * This class adapts the Anthropic Claude client to the AIServiceInterface.
 */
class ClaudeAdapter implements AIServiceInterface {
	/**
	 * @var object The Claude client instance.
	 */
	private $claudeClient;

	/**
	 * ClaudeAdapter constructor.
	 *
	 * @param object $claudeClient An instance of the Claude client.
	 */
	public function __construct( $claudeClient ) {
		$this->claudeClient = $claudeClient;
	}

	/**
	 * Generates a response from the Claude client.
	 *
	 * @param string $input The input text for the AI to respond to.
	 * @param string $system_prompt The system prompt to guide the AI's response.
	 *
	 * @return string The AI-generated response.
	 */
	public function generateResponse( string $input, string $system_prompt ): string {
		return $this->claudeClient->ask( $input, $system_prompt );
	}

	/**
	 * Generates a keyword response from the Claude client.
	 *
	 * @param mixed $data The data containing the prompt for keyword generation.
	 *
	 * @return string The AI-generated keyword response.
	 */
	public function generateKeywordResponse( $data ) {
		return $this->claudeClient->askKeyword( $data );
	}

	/**
	 * Generates form field suggestions from the Claude client.
	 *
	 * @param mixed $data The data containing the prompt for form field generation.
	 *
	 * @return string The AI-generated form field suggestions.
	 */
	public function generateFormFieldsResponse( $data ) {
		return $this->claudeClient->askFormField( $data );
	}
}
