using System;

namespace Toolbox.Docking.Api.ExtraActions
{
    /// <summary>
    /// Definition for a Toolbox extra action result
    /// </summary>
    [Serializable]
    public sealed class TbExtraActionResult
    {
        /// <summary>
        /// Constructor for the result object
        /// </summary>
        /// <param name="result">Integer value for the action result</param>
        /// <param name="payload">String encoded payload. Encoding/Decoding of the payload string is left to the Server/Client implementation of the addin</param>
        /// <param name="explainer">
        ///  Name of client's plugin (IToolboxPluginExplain) wich can explain this result
        /// </param>
        public TbExtraActionResult(int result, string payload, string explainer)
        {
            Result = result;
            Payload = payload;
            Explainer = explainer;
        }

        /// <summary>
        ///     Name of client's plugin (IToolboxPluginExplain) wich can explain this result
        /// </summary>
        public string Explainer { get; }

        /// <summary>
        ///     integer result
        /// </summary>
        public int Result { get; }

        /// <summary>
        ///     string coded result.
        /// </summary>
        public string Payload { get; }

        /// <summary>
        /// Create an empty extra action result
        /// </summary>
        /// <returns>The constructed extra action result.</returns>
        public static TbExtraActionResult EmptyResult()
        {
            return new TbExtraActionResult(0, string.Empty, string.Empty);
        }
    }
}