/*-------------------------------------------------------------------------
 * 功能描述：TResult
 * 作者：xulisong
 * 创建时间： 2019/6/27 10:50:29
 * 版本号：v1.0
 *  -------------------------------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Com.FirmLib.UI.Common
{
    public class TResult
    {
        public TResult(bool isSuccessed)
        {
            IsSuccessed = isSuccessed;
        }
        public TResult(bool isSuccessed,string message):this(isSuccessed)
        {
            Message = message;
        }
        public bool IsSuccessed { get;private set; }
        public string Id { get; set; }
        public string Message { get; set; }

        /// <summary>
        /// tag
        /// </summary>
        public object Tag { get; set; }

        public static implicit operator bool(TResult result)
        {
            return result.IsSuccessed;
        }
        public static implicit operator TResult(bool d)
        {
            return new TResult(d);
        }

        public override string ToString()
        {
            return Message??string.Empty;
        }
    }
}
