"""Tech Tools plugin.

A section for small technician utilities. Every tool here runs entirely in the
browser: no API, no tables, no state. That is deliberate - these are the things
someone reaches for at a bench with no network guarantee, and an air-gapped
site gets them for free.

The plugin exists so the section can carry a nav entry and be included in or
left out of a per-site build (ADR-013). The tools themselves are frontend-only,
which is why get_blueprint and get_models are both empty.
"""

import logging
from typing import List, Optional, Type

from flask import Blueprint, Flask

from shopdb.plugins.base import BasePlugin, PluginMeta

logger = logging.getLogger(__name__)


class ToolsPlugin(BasePlugin):
    """Registers the Tech Tools section. All tools are client-side."""

    @property
    def meta(self) -> PluginMeta:
        return PluginMeta(
            name='tools',
            version='1.0.0',
            description='Tech Tools: browser-side technician utilities',
            author='ShopDB Team',
            dependencies=[],
            core_version='>=0.16.0,<1.0.0',
        )

    def get_blueprint(self) -> Optional[Blueprint]:
        # No API surface. The tools never leave the browser.
        return None

    def get_models(self) -> List[Type]:
        # No tables. Nothing here is persisted.
        return []

    def get_navigation_items(self) -> List[dict]:
        return [
            {
                'name': 'Tech Tools',
                'icon': 'wrench',
                'route': '/tools',
                'position': 47,
            },
        ]

    def on_install(self, app: Flask) -> None:
        logger.info('Tools plugin installed')
