//! Subcommands for the mint RPC CLI

use cdk_common::grpc::VERSION_HEADER;
use tonic::metadata::MetadataValue;
use tonic::Request;

/// Helper function to add version header to a request
pub fn with_version_header<T>(mut request: Request<T>) -> Request<T> {
    request.metadata_mut().insert(
        VERSION_HEADER,
        MetadataValue::from_static(cdk_common::MINT_RPC_PROTOCOL_VERSION),
    );
    request
}

/// Module for rotating to the next keyset
mod rotate_next_keyset;
/// Module for updating mint contact information
mod update_contact;
/// Module for updating the mint's icon URL
mod update_icon_url;
/// Module for updating the mint's long description
mod update_long_description;
/// Module for updating the mint's message of the day
mod update_motd;
/// Module for updating the mint's name
mod update_name;
/// Module for updating NUT-04 settings (mint process)
mod update_nut04;
/// Module for updating NUT-04 quote state
mod update_nut04_quote;
/// Module for updating NUT-05 settings (melt process)
mod update_nut05;
/// Module for updating the mint's short description
mod update_short_description;
/// Module for updating quote time-to-live settings
mod update_ttl;
/// Module for managing mint URLs
mod update_urls;

pub use rotate_next_keyset::{rotate_next_keyset, RotateNextKeysetCommand};
pub use update_contact::{add_contact, remove_contact, AddContactCommand, RemoveContactCommand};
pub use update_icon_url::{update_icon_url, UpdateIconUrlCommand};
pub use update_long_description::{update_long_description, UpdateLongDescriptionCommand};
pub use update_motd::{update_motd, UpdateMotdCommand};
pub use update_name::{update_name, UpdateNameCommand};
pub use update_nut04::{update_nut04, UpdateNut04Command};
pub use update_nut04_quote::{update_nut04_quote_state, UpdateNut04QuoteCommand};
pub use update_nut05::{update_nut05, UpdateNut05Command};
pub use update_short_description::{update_short_description, UpdateShortDescriptionCommand};
pub use update_ttl::{get_quote_ttl, update_quote_ttl, UpdateQuoteTtlCommand};
pub use update_urls::{add_url, remove_url, AddUrlCommand, RemoveUrlCommand};
