#pragma once

#include <cstdint>
#include <filesystem>
#include <optional>
#include <string>
#include <vector>

#include "core/videoredo_project.hpp"

namespace smartcut::core {

struct VideoReDoJoinerItem {
  VideoReDoProject project;
  int type{1};
  std::uint64_t original_duration_us{};
  std::uint64_t cut_duration_us{};
  std::uint64_t output_bytes{};
};

struct VideoReDoJoinerProject {
  int version{6};
  std::uint64_t frame_duration_100ns{400'000};
  std::vector<VideoReDoJoinerItem> items;
};

std::optional<VideoReDoJoinerProject> read_videoredo_joiner_project(
    const std::filesystem::path& path, std::string* error = nullptr);
bool write_videoredo_joiner_project(const std::filesystem::path& path,
                                    const VideoReDoJoinerProject& project,
                                    std::string* error = nullptr);

}  // namespace smartcut::core
