// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END

#pragma once
#include "warning-disable.hpp"
#include <QUrl>
#include <QWidget>

#include <memory>
#include "warning-enable.hpp"

#include "obs/browser/obs-browser-panel.hpp"
#include "util/util-library.hpp"

namespace streamfx::ui {
	class obs_browser_cef {
		std::shared_ptr<::streamfx::util::library> _module;

		streamfx::obs::QCef*              _cef;
		streamfx::obs::QCefCookieManager* _cookie;

		private:
		obs_browser_cef();

		public:
		~obs_browser_cef();

		streamfx::obs::QCef* cef();

		streamfx::obs::QCefCookieManager* cookie_manager();

		public: // Singleton
		static std::shared_ptr<obs_browser_cef> instance();
	};

	class obs_browser_widget : public QWidget {
		Q_OBJECT

		private:
		std::shared_ptr<obs_browser_cef> _cef;
		streamfx::obs::QCefWidget*       _widget;

		public:
		obs_browser_widget(QUrl url, QWidget* parent = nullptr);
		virtual ~obs_browser_widget();

		void set_url(QUrl url);

		streamfx::obs::QCefWidget* cefwidget();

		public:
		static bool is_available();
	};
} // namespace streamfx::ui
