"""Checkers package - all code quality checkers."""

from __future__ import annotations

from stablestack.checkers.base import BaseChecker

# Security checkers (free tier)
from stablestack.checkers.security import (
    EvalUsageChecker,
    HardcodedSecretsChecker,
    InnerHtmlXssChecker,
    InsecureRandomChecker,
    NodeEnvSecurityGateChecker,
    SqlInjectionChecker,
    WebhookSecurityBypassChecker,
)

# Session checkers (free tier)
from stablestack.checkers.session import ThreadSessionSafetyChecker

# Schema checkers (free tier)
from stablestack.checkers.schema import (
    PydanticNullabilityChecker,
    PydanticSqlalchemyFieldChecker,
)

# Project checkers (free tier)
from stablestack.checkers.project.claude_md import ClaudeMdChecker
from stablestack.checkers.project.gitignored_claude_md import GitignoredClaudeMdChecker

# Quality checkers (free tier)
from stablestack.checkers.quality.exception_swallowing import ExceptionSwallowingChecker
from stablestack.checkers.quality.file_length import FileLengthChecker

# Structure checkers (free tier)
from stablestack.checkers.structure.multiple_classes import MultipleClassesChecker


# Free-tier checkers: always available in the PyPI package.
FREE_CHECKERS: list[type[BaseChecker]] = [
    # Security (SEC001-SEC006, SEC012)
    HardcodedSecretsChecker,
    SqlInjectionChecker,
    EvalUsageChecker,
    InsecureRandomChecker,
    InnerHtmlXssChecker,
    WebhookSecurityBypassChecker,
    NodeEnvSecurityGateChecker,
    # Session (SESS002)
    ThreadSessionSafetyChecker,
    # Schema (SCHEMA001-SCHEMA002)
    PydanticNullabilityChecker,
    PydanticSqlalchemyFieldChecker,
    # Project (PROJ001, PROJ005)
    ClaudeMdChecker,
    GitignoredClaudeMdChecker,
    # Quality (QUAL001, QUAL009)
    ExceptionSwallowingChecker,
    FileLengthChecker,
    # Structure (STRUCT001)
    MultipleClassesChecker,
]


def get_all_checkers() -> list[type[BaseChecker]]:
    """Return free checkers + any paid compiled checkers that are installed."""
    from stablestack.checkers.loader import load_paid_checkers
    return FREE_CHECKERS + load_paid_checkers()


# Backwards compat: ALL_CHECKERS now delegates to get_all_checkers()
# so code that imported ALL_CHECKERS still works at module level.
ALL_CHECKERS: list[type[BaseChecker]] = FREE_CHECKERS


__all__ = [
    "BaseChecker",
    "ALL_CHECKERS",
    "FREE_CHECKERS",
    "get_all_checkers",
    # Free-tier security checkers
    "HardcodedSecretsChecker",
    "SqlInjectionChecker",
    "EvalUsageChecker",
    "InsecureRandomChecker",
    "InnerHtmlXssChecker",
    "WebhookSecurityBypassChecker",
    "NodeEnvSecurityGateChecker",
    # Free-tier session checkers
    "ThreadSessionSafetyChecker",
    # Free-tier schema checkers
    "PydanticNullabilityChecker",
    "PydanticSqlalchemyFieldChecker",
    # Free-tier project checkers
    "ClaudeMdChecker",
    "GitignoredClaudeMdChecker",
    # Free-tier quality checkers
    "ExceptionSwallowingChecker",
    "FileLengthChecker",
    # Free-tier structure checkers
    "MultipleClassesChecker",
]
