"""
SQLCipher compatibility module for cross-platform support.

Provides a unified interface for importing SQLCipher on different platforms:
- x86_64 Linux: Uses sqlcipher3-binary (pre-compiled wheel)
- ARM64 Linux: Uses sqlcipher3 (builds from source)
- Other platforms: Uses sqlcipher3
"""


def get_sqlcipher_module():
    """
    Get the appropriate SQLCipher module for the current platform.

    Returns the sqlcipher3 module (either sqlcipher3-binary or sqlcipher3
    depending on platform and what's installed).

    Returns:
        module: The sqlcipher module with dbapi2 attribute

    Raises:
        ImportError: If sqlcipher3 is not available
    """
    try:
        import sqlcipher3

        return sqlcipher3
    except ImportError:
        raise ImportError(
            "sqlcipher3 is not installed. "
            "Ensure SQLCipher system library is installed, then run: pdm install"
        )
