<?php
/**
 * LLM Base Class.
 *
 * Abstract base class for all language model implementations.
 *
 * @package   Agenistrator
 * @since     1.0.0
 * @author    Alex Ruban <alex@maximum.guru>
 * @author    Maximum Software Inc <contact@maximum.software>
 * @license   GPL-3.0-only
 * @link      https://maximum.software/
 *
 * SPDX-FileCopyrightText: 2025-2026 Alex Ruban <alex@maximum.guru>
 * SPDX-FileCopyrightText: 2025-2026 Maximum Software Inc <contact@maximum.software>
 * SPDX-License-Identifier: GPL-3.0-only
 */

namespace Agenistrator;

// Direct access prevention
if ( ! defined( 'ABSPATH' ) ) {
	return;
}

/**
 * LLM class.
 */
abstract class LLM {
	/**
	 * The model ID to use
	 * @var        string
	 * @since     1.0.0
	 */
	protected $model_id;

	/**
	 * The provider instance
	 * @var        Provider_Type
	 * @since     1.0.0
	 */
	protected $provider;

	/**
	 * Initialize the LLM model
	 *
	 * @param      string $model_id The model ID to use
	 * @param      Provider_Type $provider The provider instance
	 * @since     1.0.0
	 */
	public function __construct( $model_id, $provider ) {
		$this->model_id = $model_id;
		$this->provider = $provider;
	}

	/**
	 * Get the model ID
	 * @return     string Model ID
	 * @since     1.0.0
	 */
	public function get_model_id() {
		return $this->model_id;
	}

	/**
	 * Set the model ID
	 * @param      string $model_id The model ID
	 * @since     1.0.0
	 */
	public function set_model_id( $model_id ) {
		$this->model_id = $model_id;
	}

	/**
	 * Get the provider instance
	 * @return     Provider_Type The provider instance
	 * @since     1.0.0
	 */
	public function get_provider() {
		return $this->provider;
	}

	/**
	 * Get a parameter from the provider
	 * @param      string $param_name The parameter name
	 * @param      mixed $default_value Default value if parameter doesn't exist
	 * @return     mixed Parameter value or default
	 * @since     1.0.0
	 */
	protected function get_param( $param_name, $default_value = '' ) {
		return $this->provider->get_param( $param_name, $default_value );
	}
}
