using System.Collections.Generic;
public static void Main()
InterviewTest test = new InterviewTest();
internal class InterviewTest
private const string ErrorsInput = @"
""Message"": ""Error message one"",
""Date"": ""2023-08-03T00:00:00"",
""ShortMessage"": ""Short one"",
""Message"": ""Error message two"",
""Date"": ""2023-08-04T00:00:00"",
""ShortMessage"": ""Short two"",
""Message"": ""Error message three"",
""Date"": ""2023-08-05T00:00:00"",
""ShortMessage"": ""Short three"",
""Message"": ""Error message four"",
""Date"": ""2023-08-06T00:00:00"",
""ShortMessage"": ""Short four"",
private const string CustomerErrorsInput = @"
""CustomerName"": ""Bob"",
""CustomerName"": ""Jeff"",
""CustomerName"": ""George"",
""CustomerName"": ""George"",
public int ID { get; set; }
public string Message { get; set; }
public List<ErrorDetail> Details { get; set; }
public DateTime Date { get; set; }
public string ShortMessage { get; set; }
public int SeverityLevel { get; set; }
public class ClientSupportTicket
public int CustomerId { get; set; }
public string CustomerName { get; set; }
public List<int> ErrorIds { get; set; }
List<Error> errors = JsonSerializer.Deserialize<List<Error>>(ErrorsInput);
List<ClientSupportTicket> supportTickets = JsonSerializer.Deserialize<List<ClientSupportTicket>>(CustomerErrorsInput);
Console.WriteLine($"Number of errors: {errors.Count}");
Console.WriteLine($"Number of tickets: {supportTickets.Count}");
int customerIdWithMostErrors = CustomerWithMostErrors(errors, supportTickets);
int customeridWithMostRecentError = CustomerWithMostRecentError(errors, supportTickets);
int customerWithMostSevereError = CustomerWithMostSevereError(errors, supportTickets);
int customerWithHighestSeverityError = CustomerWithHighestAverageSeverity(errors, supportTickets);
Console.WriteLine($"Customer with most errors: {customerIdWithMostErrors}");
Console.WriteLine($"Customer with most recent error: {customeridWithMostRecentError}");
Console.WriteLine($"Customer with most severe error: {customerWithMostSevereError}");
Console.WriteLine($"Customer with most highest average severity: {customerWithHighestSeverityError}");
public int CustomerWithMostErrors(List<Error> errors, List<ClientSupportTicket> supportTickets)
public int CustomerWithMostRecentError(List<Error> errors, List<ClientSupportTicket> supportTickets)
public int CustomerWithMostSevereError(List<Error> errors, List<ClientSupportTicket> supportTickets)
public int CustomerWithHighestAverageSeverity(List<Error> errors, List<ClientSupportTicket> supportTickets)