using DFS.Core.Abstractions;
using DFS.Core.Abstractions.View;
using Microsoft.AspNetCore.Mvc;

namespace DFS.Core.Mvc.Results
{
    /// <summary>
    /// 标准对象结果
    /// </summary>
    public class StandardObjectResult : ObjectResult
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="protocol">基础结构</param>
        public StandardObjectResult(ServiceProtocol protocol)
            : base(protocol)
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="obj">对象结果</param>
        public StandardObjectResult(ObjectResult obj, string requestId)
            : this(new ServiceProtocol() { Content = obj.Value, StatusCode = (int)MicroServiceStatus.Normal, RequestId = requestId })
        {
        }


        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="obj">对象结果</param>
        public StandardObjectResult(ObjectResult obj, string requestId,bool UnAuthorized)
            : this(new ServiceProtocol() { Content = obj.Value, StatusCode = (int)MicroServiceStatus.UnAuthorized, RequestId = requestId})
        {
        }

        /// <summary>
        /// 复写基类的值
        /// </summary>
        public new ServiceProtocol Value { get; set; }
    }
}
