// Copyright (c) Subzero Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use rialo_shared_types::Subscription;
use serde::{Deserialize, Serialize};

use super::rpc_response_context::RpcResponseContext;

/// The response message for a getSubscriptions request.
#[derive(Serialize, Deserialize, Debug)]
pub struct GetSubscriptionsResponse {
    pub context: RpcResponseContext,

    /// The subscriptions that are requested.
    pub subscriptions: Vec<Subscription>,
}

/// Request for getSubscriptions RPC call
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct GetSubscriptionsRequest {
    pub subscriber: Option<String>,
    pub nonce: Option<String>,
    pub limit: Option<u32>,
}

impl GetSubscriptionsRequest {
    pub fn new(subscriber: Option<String>, nonce: Option<String>, limit: Option<u32>) -> Self {
        Self {
            subscriber,
            nonce,
            limit,
        }
    }
}

impl Default for GetSubscriptionsRequest {
    fn default() -> Self {
        Self::new(None, None, None)
    }
}
