// TODO Use a macro to generate both server/client Rpc trait from the same code

#[cfg(feature = "server")]
pub mod server {
    use jsonrpc_core::Result;
    use jsonrpc_derive::rpc;

    #[rpc(server)]
    pub trait Rpc {
        #[rpc(name = "send_email")]
        fn send_email(&self, recipients: Vec<String>, subject: String, text: String) -> Result<()>;

        #[rpc(name = "verify_address")]
        fn verify_address(&self, address: String) -> Result<()>;
    }
}

#[cfg(feature = "client")]
pub mod client {
    use jsonrpc_derive::rpc;

    #[rpc(client)]
    pub trait Rpc {
        #[rpc(name = "send_email")]
        fn send_email(&self, recipients: Vec<String>, subject: String, text: String) -> Result<()>;

        #[rpc(name = "verify_address")]
        fn verify_address(&self, address: String) -> Result<()>;
    }

    // This is generated by rpc macro
    #[cfg(feature = "client")]
    pub type GenClient = gen_client::Client;
}
