//! Error types for CreditService

use thiserror::Error;

/// CreditService error type
#[derive(Debug, Error)]
pub enum Error {
    #[error("Wallet not found: {0}")]
    WalletNotFound(String),

    #[error("Wallet already exists: {0}")]
    WalletAlreadyExists(String),

    #[error("Insufficient balance: required {required}, available {available}")]
    InsufficientBalance { required: i64, available: i64 },

    #[error("Quota exceeded: {resource_type} limit is {limit}, current usage is {current}")]
    QuotaExceeded {
        resource_type: String,
        limit: i64,
        current: i64,
    },

    #[error("Reservation not found: {0}")]
    ReservationNotFound(String),

    #[error("Reservation expired: {0}")]
    ReservationExpired(String),

    #[error("Reservation already processed: {0}")]
    ReservationAlreadyProcessed(String),

    #[error("Wallet suspended: {0}")]
    WalletSuspended(String),

    #[error("Storage error: {0}")]
    Storage(String),

    #[error("Internal error: {0}")]
    Internal(String),
}

/// Result type for CreditService operations
pub type Result<T> = std::result::Result<T, Error>;
