"""Centralized constants for the Slack Chat Migrator."""

# --- HTTP Status Codes ---
HTTP_OK = 200
HTTP_BAD_REQUEST = 400
HTTP_UNAUTHORIZED = 401
HTTP_FORBIDDEN = 403
HTTP_NOT_FOUND = 404
HTTP_CONFLICT = 409
HTTP_RATE_LIMIT = 429
HTTP_SERVER_ERROR_MIN = 500

# --- Slack Message Subtypes ---
BOT_MESSAGE_SUBTYPE = "bot_message"
APP_MESSAGE_SUBTYPE = "app_message"
CHANNEL_JOIN_SUBTYPE = "channel_join"
CHANNEL_LEAVE_SUBTYPE = "channel_leave"
BOT_SUBTYPES = frozenset({BOT_MESSAGE_SUBTYPE, APP_MESSAGE_SUBTYPE})
SYSTEM_SUBTYPES = frozenset({CHANNEL_JOIN_SUBTYPE, CHANNEL_LEAVE_SUBTYPE})

# --- File Size Limits ---
DIRECT_UPLOAD_MAX_BYTES = 25 * 1024 * 1024  # 25 MB
RESUMABLE_UPLOAD_THRESHOLD_BYTES = 5 * 1024 * 1024  # 5 MB
MAX_FILE_SIZE_BYTES = 200 * 1024 * 1024  # 200 MB (Drive API limit)
FILE_READ_CHUNK_BYTES = 4096

# --- API Pagination ---
SPACES_PAGE_SIZE = 100
DRIVE_FILES_PAGE_SIZE = 1000

# --- Space Configuration ---
SPACE_TYPE = "SPACE"
SPACE_THREADING_STATE = "THREADED_MESSAGES"
SPACE_NAME_PREFIX = "Slack #"
IMPORT_MODE_DAYS_LIMIT = 90

# --- Google Chat API ---
MEMBER_TYPE_HUMAN = "HUMAN"

# --- Google Drive Roles ---
DRIVE_ROLE_EDITOR = "editor"
DRIVE_ROLE_READER = "reader"

# --- Membership Time Offsets ---
DEFAULT_FALLBACK_JOIN_TIME = "2020-01-01T00:00:00Z"
HISTORICAL_DELETE_TIME_OFFSET_SECONDS = 5
EARLIEST_MESSAGE_OFFSET_MINUTES = 2
FIRST_MESSAGE_OFFSET_MINUTES = 1

# --- Logging/Truncation Limits ---
RESPONSE_MAX_LENGTH = 2000
RESPONSE_FALLBACK_LENGTH = 1000
ERROR_DETAIL_MAX_LENGTH = 500
URL_TRUNCATION_LENGTH = 100
ID_HASH_LENGTH = 8

# --- Error Patterns ---
PERMISSION_DENIED_ERROR = "PERMISSION_DENIED"

# --- API Throttle Delays (seconds) ---
API_THROTTLE_MESSAGE_SECONDS = 0.05
API_THROTTLE_MEMBER_SECONDS = 0.1
API_THROTTLE_DISCOVERY_SECONDS = 0.2
