<?php
/**
 * Yandex AI Models
 *
 * Constants and utilities for YandexGPT and YandexART models
 *
 * @package SmartyPress_AI_Engine
 * @since 1.1.0
 */

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

/**
 * Yandex Models class
 */
class SmartyPress_AI_Yandex_Models {

	/**
	 * Text models
	 */
	const GPT_LITE = 'yandexgpt-lite';
	const GPT_PRO  = 'yandexgpt';

	/**
	 * Image model
	 */
	const ART_LATEST = 'yandex-art/latest';

	/**
	 * Get model URI for text generation
	 *
	 * @param string $model    Model name.
	 * @param string $folder_id Yandex Cloud folder ID.
	 * @return string Model URI.
	 */
	public static function get_model_uri( $model, $folder_id ) {
		return "gpt://{$folder_id}/{$model}";
	}

	/**
	 * Get model URI for image generation
	 *
	 * @param string $folder_id Yandex Cloud folder ID.
	 * @return string Model URI.
	 */
	public static function get_art_model_uri( $folder_id ) {
		return "art://{$folder_id}/" . self::ART_LATEST;
	}

	/**
	 * Check if model is valid
	 *
	 * @param string $model Model name.
	 * @return bool True if valid.
	 */
	public static function is_valid_model( $model ) {
		return in_array( $model, self::get_all_models(), true );
	}

	/**
	 * Get all text model identifiers
	 *
	 * @return array Model identifiers.
	 */
	public static function get_all_models() {
		return array( self::GPT_LITE, self::GPT_PRO );
	}

	/**
	 * Get text model descriptions with metadata
	 *
	 * @return array Models with name and metadata.
	 */
	public static function get_model_descriptions() {
		return array(
			self::GPT_LITE => array(
				'name'      => 'YandexGPT Lite',
				'expensive' => false,
				'reasoning' => false,
			),
			self::GPT_PRO  => array(
				'name'      => 'YandexGPT Pro',
				'expensive' => false,
				'reasoning' => false,
			),
		);
	}

	/**
	 * Get available image models with resolutions
	 *
	 * @return array Image models.
	 */
	public static function get_image_models() {
		return array(
			'yandex-art' => array(
				'name'        => 'YandexART',
				'resolutions' => array( '1024x1024' ),
			),
		);
	}
}
