"""
MongoDB Constants
Contains regular expressions, column names, and other constants used in MongoDB operations
"""

# Regular expression patterns for parsing MongoDB shell syntax
PATTERNS = {
    'collection': r'db\.([a-zA-Z_][a-zA-Z0-9_]*)\.([a-zA-Z_][a-zA-Z0-9_]*)\((.*)\)',
    'db': r'db\.([a-zA-Z_][a-zA-Z0-9_]*)\((.*)\)',
    'rs': r'rs\.([a-zA-Z_][a-zA-Z0-9_]*)\((.*)\)',
    'sh': r'sh\.([a-zA-Z_][a-zA-Z0-9_]*)\((.*)\)',
    'show': r'show\s+(\w+)',
    'connection_db': r'(@[^/]+/)([^?]*)'
}

# Column name definitions for different MongoDB operations
COLUMN_NAMES = {
    'build_info': ["version", "gitVersion", "buildEnvironment"],
    'server_status': ["uptime", "current_connections", "available_connections"],
    'current_op': ["opid", "active", "operation", "namespace"],
    'users_info': ["user", "database", "roles"],
    'connection_status': ["user", "database", "roles"],
    'parameters': ["parameter", "value"],
    'count': ["count"],
    'database_list': ["database_name"],
    'collection_list': ["collection_name"],
    'roles_info': ["role", "database", "privileges"],
    'log_entries': ["log_entries"],
    'kill_op': ["info", "ok"],
    'create_result': ["result"],
    'drop_result': ["result"],
    'index_result': ["result"],
    'list_indexes': ["name", "key", "unique"],
    'replica_config': ["_id", "version", "members_count"],
    'replica_status': ["name", "state", "stateStr", "health"],
    'collection_stats': ["ns", "count", "size"],
    'db_stats': ["db", "collections", "objects"],
    'host_info': ["hostname", "numCores"],
    'conn_pool_stats': ["host", "inUse", "available", "created"],
    'top_stats': ["collection", "total_time", "count"],
    'status_generic': ["status"],
    'aggregation_result': ["result"],
    'no_results': ["result"]
}

# Default connection string templates
CONNECTION_TEMPLATES = {
    'with_auth': "mongodb+srv://{user}:{password}@{service}/{database}?authSource=admin&tls=true&replicaSet=mongod_replset_1&readPreference=primaryPreferred&readPreferenceTags=nodeType:common",
    'without_auth': "mongodb+srv://{service}/{database}?authSource=admin&tls=true&replicaSet=mongod_replset_1&readPreference=primaryPreferred&readPreferenceTags=nodeType:common"
}

# Default databases
DEFAULT_DATABASES = {
    'general': 'admin',
}

# Limits for result sets
RESULT_LIMITS = {
    'parameters': 20,
    'active_ops': 10,
    'log_entries': 10,
    'top_stats': 10
}

# Special handling indicators
SPECIAL_METHODS = {
    'admin_command': None,
    'run_command': None,
    'kill_op': None,
    'rs_add': None,
    'rs_remove': None,
    'rs_freeze': None,
    'sh_enable_sharding': None,
    'sh_shard_collection': None,
    'sh_disable_balancing': None,
    'sh_enable_balancing': None
}