"""
Exception hierarchy for Kilit.

This module defines a clean, minimal exception hierarchy with 4 types
for different error categories.
"""


class KilitError(Exception):
    """
    Base exception for all Kilit errors.

    All Kilit-specific exceptions inherit from this base class,
    making it easy to catch all Kilit errors with a single except clause.
    """

    pass


class KilitKeyError(KilitError):
    """
    Master key related errors.

    Raised when:
    - Master key is missing (no source available)
    - Master key format is invalid (not base64 encoded)
    - Master key is wrong (decryption authentication fails)
    - Scrypt parameters are invalid
    """

    pass


class KilitFileError(KilitError):
    """
    File operation errors.

    Raised when:
    - File not found
    - File already exists (during init)
    - File is corrupted (invalid envelope structure)
    - Permission denied
    - Disk full or other IO errors
    """

    pass


class KilitFormatError(KilitError):
    """
    Codec/envelope format errors.

    Raised when:
    - JSON/YAML parsing fails
    - Envelope structure is invalid
    - Envelope version is unsupported
    - Required codec is not available
    """

    pass


class KilitCredentialsError(KilitError):
    """
    Runtime API errors.

    Raised when:
    - Required credential key is missing (require() method)
    - Dotted path is invalid
    - Credentials file cannot be loaded
    """

    pass
