"""Project exceptions for direct USB and protocol operations."""

from __future__ import annotations


class LibreVNAError(Exception):
    """Base error for all library exceptions."""


class ProtocolVersionMismatch(LibreVNAError):
    """Raised when device protocol version differs from required version."""


class CRCError(LibreVNAError):
    """Raised when packet CRC validation fails."""


class NackError(LibreVNAError):
    """Raised when the device explicitly responds with NACK."""


class TimeoutError(LibreVNAError):
    """Raised when waiting for packet/ack times out."""


class DeviceDisconnectedError(LibreVNAError):
    """Raised when USB transport is disconnected or unavailable."""


class IncompleteSweepError(LibreVNAError):
    """Raised when a sweep does not contain the required points."""


class ParseError(LibreVNAError):
    """Raised when packet decoding or payload parsing fails."""


class UnsupportedHardwareError(LibreVNAError):
    """Raised when a requested operation is unsupported for hardware family."""
