#pragma once

#include <concepts>
#include <functional>
#include <utility>

namespace renderive::detail {

template <class Destroy_Runtime, class Destroy_Targets, class Destroy_Scene, class Destroy_Gpu_Context>
requires std::invocable<Destroy_Runtime> && std::invocable<Destroy_Targets> &&
         std::invocable<Destroy_Scene> && std::invocable<Destroy_Gpu_Context>
void ordered_backend_shutdown(
    Destroy_Runtime&& destroy_runtime,
    Destroy_Targets&& destroy_targets,
    Destroy_Scene&& destroy_scene,
    Destroy_Gpu_Context&& destroy_gpu_context) {
    std::invoke(std::forward<Destroy_Runtime>(destroy_runtime));
    std::invoke(std::forward<Destroy_Targets>(destroy_targets));
    std::invoke(std::forward<Destroy_Scene>(destroy_scene));
    std::invoke(std::forward<Destroy_Gpu_Context>(destroy_gpu_context));
}

} // namespace renderive::detail
