/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

#pragma once

#include "IO/FileDescription.hpp"
#include <memory>

struct archive;
struct archive_entry;

namespace spdlog
{
	class logger;
}

namespace OpenVulkano
{
	class ArchiveBase
	{
	protected:
		archive* m_archive;
		archive_entry* m_archiveEntry;
		std::shared_ptr<spdlog::logger> m_logger;

		bool ChkErr(long result) const;
	public:
		ArchiveBase(archive* arch, archive_entry* archEntry, const std::shared_ptr<spdlog::logger>& logger);

		virtual ~ArchiveBase();

		void SetLogger(const std::shared_ptr<spdlog::logger>& logger) { m_logger = logger; }
		[[nodiscard]] std::shared_ptr<spdlog::logger> GetLogger() const { return m_logger; }
	};
}