using System.Threading.Tasks.Dataflow;
using System.Net;
using System.Text;
using Newtonsoft.Json;

namespace isn
{
    public class PushReport
    {
        public PushReport()
        {
           

        }

        public string PkgName { get; set; }
        public bool Executed { get; set; }
        public bool OK { get; set; }
        public bool AlreadyPresent { get; set; }
        public string Message { get; set; }
        public string StatusCode { get; set; }
        public string StackTrace { get; set; }
        public APIKO KO { get; set; }

        public string ToDoc()
        {
            StringBuilder sb = new StringBuilder($"= push {PkgName}\n\n");
            if (Executed) sb.AppendLine("* Executed");
            if (OK) sb.AppendLine("* OK");
            if (!string.IsNullOrWhiteSpace(Message))
                sb.AppendLine("* Message :" + Message);
            if (!string.IsNullOrWhiteSpace(StatusCode))
                sb.AppendLine($"* Status Code : ");
            if (!string.IsNullOrWhiteSpace(StackTrace))
                sb.AppendLine($"* StackTrace : " + StackTrace);
            if (KO!=null)
                sb.AppendLine($"* KO : " + KO.Context);

            return sb.ToString();
        }
    }
}