//! Facilitator response types for verify and settle operations.
//!
//! - [`VerifyResponse`] — returned by the facilitator's `/verify` endpoint
//! - [`SettleResponse`] — returned by the facilitator's `/settle` or `/verify-and-settle` endpoint

use alloy::primitives::Address;
use serde::{Deserialize, Serialize};

/// Response from the facilitator's `/verify` endpoint.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VerifyResponse {
    pub is_valid: bool,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invalid_reason: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payer: Option<Address>,
}

/// Response from the facilitator's `/settle` endpoint.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SettleResponse {
    pub success: bool,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub error_reason: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payer: Option<Address>,
    /// Transaction hash, if settlement succeeded. `None` on failure.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub transaction: Option<String>,
    pub network: String,
}
