using System;

namespace RobotLib.Communication
{
    public interface IPublisherSubscriber
    {
        /// <summary>
        /// New message to a subscribed topic arrived.
        /// </summary>
        event EventHandler<SubscribedMsgArrivedEventArgs> NewMessageArrived;

        /// <summary>
        /// Connection state.
        /// </summary>
        bool IsConnected { get; }

        /// <summary>
        /// Subscribe to a topic.
        /// </summary>
        /// <param name="topic">The topic to subscribe to.</param>
        void Subscribe(string topic);

        /// <summary>
        /// Publish message to a topic.
        /// </summary>
        /// <param name="topic">The topic where to publish the data to.</param>
        /// <param name="message">Data to publish.</param>
        void Publish(string topic, string message);
    }
}
