using Quadarax.Foundation.Core.Value.Extensions;
using System.Text;

namespace qdr.fnd.core.pqueue.Extensions
{
    public static class PsQueueItemDescriptorExt
    {
        public static string ToString(this IPsQueueItemDescriptor _)
        {
            var sb = new StringBuilder();
            sb.Append("Own: ").Append(_.Owner).Append("; ");
            sb.Append("OwnRef: ").Append(_.OwnerRef).Append("; ");
            sb.Append("Prv: ").Append(_.ProcessProviderClass).Append("; ");
            sb.Append("PrvArgs: ").Append(string.Join(",",_.Arguments.Select(x=>x.Name))).Append("; ");
            sb.Append("From: ").Append(_.ValidFrom.ToFileUtcString()).Append("; ");
            sb.Append("To: ").Append((_.ValidTo == null ? "NULL" : _.ValidTo.Value.ToFileUtcString())).Append("; ");
            return sb.ToString();
        }
    }
}
