#include <cameraModeRequest.h>
#include <sstream>
#include <stdexcept>

namespace lcamera_dev {

void validateCameraModeRequest(const LcameraDevCameraModeRequest& request)
{
	if (request.width == 0 || request.height == 0)
	{
		throw std::runtime_error(
			"lcameraDev: camera mode request width and height must be "
			"non-zero");
	}

	if (request.colourSpace != LcameraDevColourSpace::Yuv)
	{
		throw std::runtime_error(
			"lcameraDev: unsupported colour-space for camera mode request");
	}
}

bool cameraModeRequestsEqual(
	const LcameraDevCameraModeRequest& left,
	const LcameraDevCameraModeRequest& right)
{
	return left.width == right.width
		&& left.height == right.height
		&& left.colourSpace == right.colourSpace
		&& left.fullPlanarIsOptional == right.fullPlanarIsOptional;
}

} // namespace lcamera_dev
