# Plugins pour PC Monitor
from .base import BasePlugin
from .librehardwaremonitor import LibreHardwareMonitorPlugin
from .hwinfo import HWiNFOPlugin
from .plexamp import PlexampPlugin

# Registry des plugins monitoring hardware
PLUGINS = {
    'librehardwaremonitor': LibreHardwareMonitorPlugin,
    'hwinfo': HWiNFOPlugin
}

# Registry des plugins média
MEDIA_PLUGINS = {
    'plexamp': PlexampPlugin
}

def get_plugin(name: str, config: dict) -> BasePlugin:
    """Retourne une instance du plugin demandé"""
    if name not in PLUGINS:
        raise ValueError(f"Plugin inconnu: {name}")
    return PLUGINS[name](config)

def get_media_plugin(name: str, config: dict):
    """Retourne une instance du plugin média demandé"""
    if name not in MEDIA_PLUGINS:
        raise ValueError(f"Plugin média inconnu: {name}")
    return MEDIA_PLUGINS[name](config)

def get_available_plugins() -> list:
    """Retourne la liste des plugins disponibles"""
    return [
        {
            'id': 'librehardwaremonitor',
            'name': 'LibreHardwareMonitor',
            'description': 'Open source, API REST intégrée',
            'default_port': 8085,
            'website': 'https://github.com/LibreHardwareMonitor/LibreHardwareMonitor'
        },
        {
            'id': 'hwinfo',
            'name': 'HWiNFO + RemoteHWInfo',
            'description': 'HWiNFO avec RemoteHWInfo (github.com/Demion/remotehwinfo)',
            'default_port': 60000,
            'website': 'https://github.com/Demion/remotehwinfo'
        }
    ]

def get_available_media_plugins() -> list:
    """Retourne la liste des plugins média disponibles"""
    return [
        {
            'id': 'plexamp',
            'name': 'Plexamp',
            'description': 'Lecteur Plex (via serveur Plex distant)',
            'default_port': 32400,
            'website': 'https://plexamp.com'
        }
    ]
