using e_suite.Service.Performance.Implementations;
using eSuite.Core.Clock;

namespace e_suite.Service.Performance;

public class PerformanceCapture
{
    private readonly IClock _clock;
    public PerformanceCapture(IClock clock) : this("Round Trip", clock)
    {
    }

    public PerformanceCapture(string rootMarker, IClock clock)
    {
        _clock = clock;
        Stopwatch = Stopwatch.StartNew();
        Markers = new PerformanceMarker(rootMarker, Stopwatch);
        StartDateTime = _clock!.GetNow;
    }

    public Stopwatch Stopwatch { get; }

    public string Host { get; set; } = null!;
    public string ControllerName { get; set; } = null!;
    public string ActionName { get; set; } = null!;
    public string RequestType { get; set; } = null!;

    public IDictionary<string, object>? ActionParameters { get; set; } = null;

    public PerformanceMarker Markers { get; } = null!;
    public DateTimeOffset StartDateTime { get; }
}
