using System; using System.Text.Json.Serialization; namespace Adaptation.FileHandlers.json.WorkItems; public class WorkItem { #nullable enable [JsonConstructor] public WorkItem(string areaPath, string? assignedTo, int? businessValue, DateTime changedDate, DateTime? closedDate, int commentCount, DateTime createdDate, string description, float? effort, int id, string iterationPath, int? parent, int? priority, Relation[]? relations, string? requester, DateTime? resolvedDate, int revision, int? riskReductionMinusOpportunityEnablement, DateTime? startDate, string state, string tags, DateTime? targetDate, float? timeCriticality, string title, string? violation, float? weightedShortestJobFirst, string workItemType) { AreaPath = areaPath; AssignedTo = assignedTo; BusinessValue = businessValue; ChangedDate = changedDate; ClosedDate = closedDate; CommentCount = commentCount; CreatedDate = createdDate; Description = description; Effort = effort; Id = id; IterationPath = iterationPath; Parent = parent; Priority = priority; Relations = relations; Requester = requester; ResolvedDate = resolvedDate; Revision = revision; RiskReductionMinusOpportunityEnablement = riskReductionMinusOpportunityEnablement; StartDate = startDate; State = state; Tags = tags; TargetDate = targetDate; TimeCriticality = timeCriticality; Title = title; Violation = violation; WeightedShortestJobFirst = weightedShortestJobFirst; WorkItemType = workItemType; } public override string ToString() => $"{Id} - {WorkItemType} - {Title}"; public static WorkItem Get(WorkItem workItem, string? violation) { WorkItem result = new(workItem.AreaPath, workItem.AssignedTo, workItem.BusinessValue, workItem.ChangedDate, workItem.ClosedDate, workItem.CommentCount, workItem.CreatedDate, workItem.Description, workItem.Effort, workItem.Id, workItem.IterationPath, workItem.Parent, workItem.Priority, workItem.Relations, workItem.Requester, workItem.ResolvedDate, workItem.Revision, workItem.RiskReductionMinusOpportunityEnablement, workItem.StartDate, workItem.State, workItem.Tags, workItem.TargetDate, workItem.TimeCriticality, workItem.Title, workItem.Violation is null ? violation : workItem.Violation, workItem.WeightedShortestJobFirst, workItem.WorkItemType); return result; } public string AreaPath { get; set; } public string? AssignedTo { get; set; } public int? BusinessValue { get; set; } public DateTime ChangedDate { get; set; } public DateTime? ClosedDate { get; set; } public int CommentCount { get; set; } public DateTime CreatedDate { get; set; } public string Description { get; set; } public float? Effort { get; set; } public int Id { get; set; } public string IterationPath { get; set; } public int? Parent { get; set; } public int? Priority { get; set; } public Relation[]? Relations { get; set; } public string? Requester { get; set; } public DateTime? ResolvedDate { get; set; } public int Revision { get; set; } public int? RiskReductionMinusOpportunityEnablement { get; set; } public DateTime? StartDate { get; set; } public string State { get; set; } public string Tags { get; set; } public DateTime? TargetDate { get; set; } public float? TimeCriticality { get; set; } public string Title { get; set; } public string? Violation { get; set; } public string WorkItemType { get; set; } public float? WeightedShortestJobFirst { get; set; } }