"""Metadata introspection for the NLTK text plugin used by cjm-ctl to generate the registration manifest."""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/meta.ipynb.

# %% auto #0
__all__ = ['get_plugin_metadata']

# %% ../nbs/meta.ipynb #3508402d
import os
import sys
from typing import Any, Dict

from . import __version__

# %% ../nbs/meta.ipynb #791d750b
def get_plugin_metadata() -> Dict[str, Any]:  # Plugin metadata for manifest generation
    """Return metadata required to register this plugin with the PluginManager."""
    # Fallback base path (current behavior for backward compatibility)
    base_path = os.path.dirname(os.path.dirname(sys.executable))
    
    # Use CJM config if available, else fallback to env-relative paths
    cjm_data_dir = os.environ.get("CJM_DATA_DIR")
    
    # Plugin data directory
    plugin_name = "cjm-text-plugin-nltk"
    if cjm_data_dir:
        data_dir = os.path.join(cjm_data_dir, plugin_name)
    else:
        data_dir = os.path.join(base_path, "data")
    
    db_path = os.path.join(data_dir, "nltk_text_processing.db")
    
    # Ensure data directory exists
    os.makedirs(data_dir, exist_ok=True)
    
    # NLTK data directory
    nltk_data_path = os.path.join(data_dir, "nltk_data")
    os.makedirs(nltk_data_path, exist_ok=True)

    return {
        "name": plugin_name,
        "version": __version__,
        "type": "text-processing",
        "category": "text-processing",
        "interface": "cjm_text_plugin_system.plugin_interface.TextProcessingPlugin",
        
        "module": "cjm_text_plugin_nltk.plugin",
        "class": "NLTKPlugin",
        
        # Critical: The absolute path to THIS environment's python
        "python_path": sys.executable,
        
        "db_path": db_path,
        
        # NLTK is lightweight - no GPU required
        "resources": {
            "requires_gpu": False,
            "min_system_ram_mb": 512
        },
        
        "env_vars": {
            "NLTK_DATA": nltk_data_path
        }
    }
