"""Centralized constants for TheAuditor utils package."""

from pathlib import Path

PF_DIR = Path("./.pf")


ERROR_LOG_FILE = PF_DIR / "error.log"
PIPELINE_LOG_FILE = PF_DIR / "pipeline.log"


RAW_DIR = PF_DIR / "raw"
DATABASE_FILE = PF_DIR / "repo_index.db"


DEFAULT_MEMORY_LIMIT_MB = 12000
MIN_MEMORY_LIMIT_MB = 2000
MAX_MEMORY_LIMIT_MB = 48000


MEMORY_ALLOCATION_RATIO = 0.60


DEFAULT_MAX_FILE_SIZE = 2 * 1024 * 1024


DEFAULT_MAX_CHUNK_SIZE = 65 * 1024


DEFAULT_MAX_CHUNKS_PER_FILE = 3


ENV_MEMORY_LIMIT = "THEAUDITOR_MEMORY_LIMIT_MB"
ENV_MAX_FILE_SIZE = "THEAUDITOR_LIMITS_MAX_FILE_SIZE"
ENV_MAX_CHUNK_SIZE = "THEAUDITOR_LIMITS_MAX_CHUNK_SIZE"
ENV_MAX_CHUNKS = "THEAUDITOR_LIMITS_MAX_CHUNKS_PER_FILE"
ENV_DB_BATCH_SIZE = "THEAUDITOR_DB_BATCH_SIZE"
ENV_DEBUG = "THEAUDITOR_DEBUG"


class ExitCodes:
    """Standard exit codes for TheAuditor CLI commands."""

    SUCCESS = 0

    HIGH_SEVERITY = 1
    CRITICAL_SEVERITY = 2

    TASK_INCOMPLETE = 3

    SCHEMA_STALE = 10
