using System.Collections.Generic;
using FrameDoctor.Editor.Logic;

namespace FrameDoctor.Editor
{
    // Container for all captured profiler data.
    public class CaptureData
    {
        public List<FrameData> Frames { get; set; } = new List<FrameData>();
        public List<GcAllocation> GcAllocations { get; set; } = new List<GcAllocation>();
        public List<MarkerData> Markers { get; set; } = new List<MarkerData>();
        public float TotalDurationMs { get; set; }
        public int TotalFrames { get; set; }
        public string UnityVersion { get; set; }
        public string Platform { get; set; }
        public string ProductName { get; set; }

        // Asset inventory for cross-referencing
        public AssetInventoryData AssetInventory { get; set; }
    }

    // Data structure for captured frame information.
    public class FrameData
    {
        public int FrameIndex { get; set; }
        public float StartTimeMs { get; set; }
        public float DurationMs { get; set; }

        // CPU breakdown
        public float CpuFrameTimeMs { get; set; }
        public float CpuMainThreadMs { get; set; }
        public float CpuRenderThreadMs { get; set; }

        // Subsystem times
        public float ScriptsMs { get; set; }
        public float PhysicsMs { get; set; }
        public float AnimationMs { get; set; }
        public float RenderingMs { get; set; }
        public float UIMs { get; set; }

        // GPU
        public float GpuFrameTimeMs { get; set; }

        // Memory
        public long TotalUsedMemoryBytes { get; set; }
        public long GcUsedMemoryBytes { get; set; }
        public long GcAllocatedInFrameBytes { get; set; }
        public int GcAllocCountInFrame { get; set; }

        // Rendering stats
        public int DrawCalls { get; set; }
        public int Batches { get; set; }
        public int Triangles { get; set; }
        public int Vertices { get; set; }
        public int SetPassCalls { get; set; }

        // FrameDoctor overhead measurement
        public float FrameDoctorOverheadMs { get; set; }
    }

    // Data structure for GC allocation information.
    public class GcAllocation
    {
        public int FrameIndex { get; set; }
        public int AllocCount { get; set; }
        public long AllocBytes { get; set; }
        public string FunctionName { get; set; }
        public string Category { get; set; }
    }

    // Data structure for profiler marker samples.
    public class MarkerData
    {
        public int FrameIndex { get; set; }
        public string MarkerName { get; set; }
        public string Category { get; set; }
        public float DurationMs { get; set; }
        public int CallCount { get; set; }
    }
}
