#pragma once

#include "DeckLinkAPI_h.h"

#include <string>

struct FrameSize
{
	unsigned width = 0;
	unsigned height = 0;

	bool IsEmpty() const { return width == 0 || height == 0; }
};

inline bool operator==(const FrameSize& left, const FrameSize& right)
{
	return left.width == right.width && left.height == right.height;
}

inline bool operator!=(const FrameSize& left, const FrameSize& right)
{
	return !(left == right);
}

struct VideoFormat
{
	BMDDisplayMode displayMode = bmdModeHD1080p5994;
	std::string displayName = "1080p59.94";
};

struct VideoFormatSelection
{
	VideoFormat input;
	VideoFormat output;
};

std::string NormalizeModeToken(const std::string& value);
bool ResolveConfiguredDisplayMode(const std::string& videoFormat, const std::string& frameRate, BMDDisplayMode& displayMode, std::string& displayModeName);
bool ResolveConfiguredVideoFormat(const std::string& videoFormat, const std::string& frameRate, VideoFormat& videoMode);
bool ResolveConfiguredVideoFormats(
	const std::string& inputVideoFormat,
	const std::string& inputFrameRate,
	const std::string& outputVideoFormat,
	const std::string& outputFrameRate,
	VideoFormatSelection& videoModes,
	std::string& error);
bool FindDeckLinkDisplayMode(IDeckLinkDisplayModeIterator* iterator, BMDDisplayMode targetMode, IDeckLinkDisplayMode** foundMode);
