"""Constants and configuration values for mcilspy.

This module centralizes all timeouts, limits, and magic numbers used throughout
the codebase. Import from here rather than hardcoding values.
"""

# =============================================================================
# Subprocess Timeouts
# =============================================================================

# Maximum time to wait for ilspycmd decompilation (in seconds)
# Large assemblies or corrupted files may take longer
DECOMPILE_TIMEOUT_SECONDS: float = 300.0  # 5 minutes

# =============================================================================
# Output Limits
# =============================================================================

# Maximum characters to display from subprocess output in error messages
MAX_ERROR_OUTPUT_CHARS: int = 1000

# Maximum line length when displaying code snippets (truncate longer lines)
MAX_LINE_LENGTH: int = 200

# Maximum unparsed lines to log before suppressing (avoid log spam)
MAX_UNPARSED_LOG_LINES: int = 3

# Preview length for unparsed line debug messages
UNPARSED_LINE_PREVIEW_LENGTH: int = 100

# Maximum characters to return inline from decompile_assembly before
# truncating and saving the full output to a temp file.
# Set to 0 in a tool call to disable truncation entirely.
DEFAULT_MAX_OUTPUT_CHARS: int = 100_000

# =============================================================================
# Search Limits
# =============================================================================

# Default maximum results for search operations
DEFAULT_MAX_SEARCH_RESULTS: int = 100

# Maximum matches to display per type in grouped results
MAX_MATCHES_PER_TYPE: int = 20

# =============================================================================
# Tool Identifiers (for ilspycmd CLI)
# =============================================================================

# Default entity types for list operations
DEFAULT_ENTITY_TYPES: list[str] = ["class"]

# All supported entity types
ALL_ENTITY_TYPES: list[str] = ["class", "interface", "struct", "delegate", "enum"]
