#pragma once

#include <string_view>

enum class RuntimeEventType
{
	Unknown = 0,

	// Control ingress.
	OscValueReceived,
	OscValueCoalesced,
	OscCommitRequested,
	HttpControlMutationRequested,
	WebSocketClientConnected,
	RuntimeStateBroadcastRequested,
	FileChangeDetected,
	ManualReloadRequested,

	// Runtime policy and state.
	RuntimeMutationAccepted,
	RuntimeMutationRejected,
	RuntimeStateChanged,
	RuntimePersistenceRequested,
	RuntimeReloadRequested,
	ShaderPackagesChanged,
	RenderSnapshotPublishRequested,
	RuntimeStatePresentationChanged,

	// Shader build lifecycle.
	ShaderBuildRequested,
	ShaderBuildPrepared,
	ShaderBuildApplied,
	ShaderBuildFailed,
	CompileStatusChanged,

	// Render lifecycle.
	RenderSnapshotPublished,
	RenderResetRequested,
	RenderResetApplied,
	OscOverlayApplied,
	OscOverlaySettled,
	FrameRendered,
	PreviewFrameAvailable,

	// Video backend lifecycle.
	InputSignalChanged,
	InputFrameArrived,
	OutputFrameScheduled,
	OutputFrameCompleted,
	OutputLateFrameDetected,
	OutputDroppedFrameDetected,
	BackendStateChanged,

	// Health and telemetry.
	SubsystemWarningRaised,
	SubsystemWarningCleared,
	SubsystemRecovered,
	TimingSampleRecorded,
	QueueDepthChanged
};

constexpr std::string_view RuntimeEventTypeName(RuntimeEventType type)
{
	switch (type)
	{
	case RuntimeEventType::Unknown:
		return "Unknown";
	case RuntimeEventType::OscValueReceived:
		return "OscValueReceived";
	case RuntimeEventType::OscValueCoalesced:
		return "OscValueCoalesced";
	case RuntimeEventType::OscCommitRequested:
		return "OscCommitRequested";
	case RuntimeEventType::HttpControlMutationRequested:
		return "HttpControlMutationRequested";
	case RuntimeEventType::WebSocketClientConnected:
		return "WebSocketClientConnected";
	case RuntimeEventType::RuntimeStateBroadcastRequested:
		return "RuntimeStateBroadcastRequested";
	case RuntimeEventType::FileChangeDetected:
		return "FileChangeDetected";
	case RuntimeEventType::ManualReloadRequested:
		return "ManualReloadRequested";
	case RuntimeEventType::RuntimeMutationAccepted:
		return "RuntimeMutationAccepted";
	case RuntimeEventType::RuntimeMutationRejected:
		return "RuntimeMutationRejected";
	case RuntimeEventType::RuntimeStateChanged:
		return "RuntimeStateChanged";
	case RuntimeEventType::RuntimePersistenceRequested:
		return "RuntimePersistenceRequested";
	case RuntimeEventType::RuntimeReloadRequested:
		return "RuntimeReloadRequested";
	case RuntimeEventType::ShaderPackagesChanged:
		return "ShaderPackagesChanged";
	case RuntimeEventType::RenderSnapshotPublishRequested:
		return "RenderSnapshotPublishRequested";
	case RuntimeEventType::RuntimeStatePresentationChanged:
		return "RuntimeStatePresentationChanged";
	case RuntimeEventType::ShaderBuildRequested:
		return "ShaderBuildRequested";
	case RuntimeEventType::ShaderBuildPrepared:
		return "ShaderBuildPrepared";
	case RuntimeEventType::ShaderBuildApplied:
		return "ShaderBuildApplied";
	case RuntimeEventType::ShaderBuildFailed:
		return "ShaderBuildFailed";
	case RuntimeEventType::CompileStatusChanged:
		return "CompileStatusChanged";
	case RuntimeEventType::RenderSnapshotPublished:
		return "RenderSnapshotPublished";
	case RuntimeEventType::RenderResetRequested:
		return "RenderResetRequested";
	case RuntimeEventType::RenderResetApplied:
		return "RenderResetApplied";
	case RuntimeEventType::OscOverlayApplied:
		return "OscOverlayApplied";
	case RuntimeEventType::OscOverlaySettled:
		return "OscOverlaySettled";
	case RuntimeEventType::FrameRendered:
		return "FrameRendered";
	case RuntimeEventType::PreviewFrameAvailable:
		return "PreviewFrameAvailable";
	case RuntimeEventType::InputSignalChanged:
		return "InputSignalChanged";
	case RuntimeEventType::InputFrameArrived:
		return "InputFrameArrived";
	case RuntimeEventType::OutputFrameScheduled:
		return "OutputFrameScheduled";
	case RuntimeEventType::OutputFrameCompleted:
		return "OutputFrameCompleted";
	case RuntimeEventType::OutputLateFrameDetected:
		return "OutputLateFrameDetected";
	case RuntimeEventType::OutputDroppedFrameDetected:
		return "OutputDroppedFrameDetected";
	case RuntimeEventType::BackendStateChanged:
		return "BackendStateChanged";
	case RuntimeEventType::SubsystemWarningRaised:
		return "SubsystemWarningRaised";
	case RuntimeEventType::SubsystemWarningCleared:
		return "SubsystemWarningCleared";
	case RuntimeEventType::SubsystemRecovered:
		return "SubsystemRecovered";
	case RuntimeEventType::TimingSampleRecorded:
		return "TimingSampleRecorded";
	case RuntimeEventType::QueueDepthChanged:
		return "QueueDepthChanged";
	}

	return "Unknown";
}
