<?php
if (!defined('ABSPATH')) {
    exit;
}

/**
 * Vector Database Factory
 *
 * @package    Kitsune_AI_Platform
 * @subpackage Kitsune_AI_Platform/includes/vector-db
 */

class Kitsune_AI_Platform_Vector_DB_Factory {

    /**
     * Build a vector database client from identifier and config.
     *
     * @param string $database_id Database identifier.
     * @param array  $config Connection/config options.
     * @return Kitsune_AI_Platform_Vector_DB_Interface|WP_Error
     */
    public static function create($database_id, $config = array()) {
        $database_id = sanitize_key($database_id);

        switch ($database_id) {
            case 'chroma':
                return new Kitsune_AI_Platform_Vector_DB_Chroma($config);
            default:
                return new WP_Error(
                    'unsupported_vector_db',
                    sprintf(__('Unsupported vector database: %s', 'kitsune-ai-platform'), $database_id)
                );
        }
    }
}
