"""Global constants for TracerTM.

Extracted from magic values across the codebase to improve maintainability
and prevent typo bugs (addresses PLR2004 violations).
"""

# HTTP Status Codes
HTTP_OK = 200
HTTP_CREATED = 201
HTTP_ACCEPTED = 202
HTTP_NO_CONTENT = 204
HTTP_BAD_REQUEST = 400
HTTP_UNAUTHORIZED = 401
HTTP_FORBIDDEN = 403
HTTP_NOT_FOUND = 404
HTTP_CONFLICT = 409
HTTP_TOO_MANY_REQUESTS = 429
HTTP_INTERNAL_SERVER_ERROR = 500
HTTP_SERVICE_UNAVAILABLE = 503

# Private status constants (for internal use)
_STATUS_OK = HTTP_OK
_STATUS_CREATED = HTTP_CREATED
_STATUS_NO_CONTENT = HTTP_NO_CONTENT
_STATUS_BAD_REQUEST = HTTP_BAD_REQUEST
_STATUS_UNAUTHORIZED = HTTP_UNAUTHORIZED
_STATUS_FORBIDDEN = HTTP_FORBIDDEN
_STATUS_NOT_FOUND = HTTP_NOT_FOUND
_STATUS_SERVER_ERROR = HTTP_INTERNAL_SERVER_ERROR

# Timeout Values (seconds)
TIMEOUT_SHORT = 5
TIMEOUT_DEFAULT = 30
TIMEOUT_MEDIUM = 60
TIMEOUT_LONG = 300
TIMEOUT_VERY_LONG = 3600

# Pagination Defaults
DEFAULT_PAGE_SIZE = 50
DEFAULT_LIMIT = 100
MAX_PAGE_SIZE = 100
DEFAULT_OFFSET = 0

# Preview/Display Defaults
PREVIEW_SIZE_DEFAULT = 200
MAX_PREVIEW_SIZE = 1000

# GraphQL Pagination
GRAPHQL_FIRST_DEFAULT = 100
GRAPHQL_MAX_FIRST = 1000

# Retry Defaults
DEFAULT_MAX_RETRIES = 3
MAX_RETRIES_DEFAULT = 3
DEFAULT_RETRY_DELAY = 1.0
RETRY_BACKOFF_BASE = 2.0
RETRY_BACKOFF_MAX = 60.0

# Rate Limiting
RATE_LIMIT_DEFAULT = 1000
RATE_LIMIT_BURST = 50

# Cache TTL (seconds)
CACHE_TTL_SHORT = 60
CACHE_TTL_DEFAULT = 300
CACHE_TTL_LONG = 3600

# Database Limits
MAX_BATCH_SIZE = 1000
DEFAULT_POOL_SIZE = 20
MAX_POOL_SIZE = 100

# File Size Limits (bytes)
MAX_UPLOAD_SIZE = 10 * 1024 * 1024  # 10MB
MAX_EXPORT_SIZE = 100 * 1024 * 1024  # 100MB

# String Length Limits
MAX_TITLE_LENGTH = 255
MAX_DESCRIPTION_LENGTH = 5000
MAX_CONTENT_LENGTH = 50000

# Common Percentages
PERCENT_COMPLETE = 100
PERCENTAGE_MAX = 100
PERCENT_HALF = 50
PERCENT_QUARTER = 25

# Common Values
ZERO = 0
ONE = 1

# Logging Levels
LOG_LEVEL_DEBUG = "DEBUG"
LOG_LEVEL_INFO = "INFO"
LOG_LEVEL_WARNING = "WARNING"
LOG_LEVEL_ERROR = "ERROR"
LOG_LEVEL_CRITICAL = "CRITICAL"

# Time Windows (seconds)
TIME_WINDOW_HOUR = 3600
TIME_WINDOW_DAY = 86400
TIME_WINDOW_WEEK = 604800
TIME_WINDOW_MONTH = 2592000

# Decimal/Float Precision
DECIMAL_PRECISION_DEFAULT = 2
DECIMAL_PRECISION_MONEY = 2
DECIMAL_PRECISION_PERCENTAGE = 1

# Hash/Crypto Sizes
HASH_SIZE_STANDARD = 32
HASH_SIZE_LONG = 64

# TTL Aliases (for clarity)
TTL_VERY_SHORT = 30
TTL_SHORT = 60
TTL_MEDIUM = 300
TTL_STANDARD = 600
TTL_LONG = 3600

# Score Ranges
SCORE_MIN = 0
SCORE_MAX = 100

# Version Defaults
VERSION_INITIAL = 1
VERSION_INCREMENT = 1

# Sequence Defaults
SEQUENCE_START = 0
SEQUENCE_PADDING = 10
TTL_EXTENDED = 600  # 10 minutes

# JWT constants
JWT_CLOCK_SKEW = 30  # seconds - allowable skew for token expiration
JWT_EXPIRY_SHORT = 3600  # 1 hour
RETRY_BACKOFF_MIN = 1.0
RETRY_BACKOFF_MULTIPLIER = 2.0
