#pragma once

#include <cstddef>
#include <cstdint>
#include <string>
#include <utility>
#include <vector>

#include "media/audio_transform.hpp"
#include "media/container_mux.hpp"
#include "media/video_transform.hpp"

namespace smartcut::media {

using EditRange = std::pair<std::size_t, std::size_t>;
enum class EditExportMode { smart_render, keyframe_copy, full_transcode };

std::vector<EditRange> normalize_removed_ranges(std::size_t frame_count,
                                                std::vector<EditRange> ranges);
std::vector<EditRange> kept_ranges_for_edits(std::size_t frame_count,
                                             const std::vector<EditRange>& removed_ranges);

std::string export_mkv_edits(const std::string& input, const std::string& output,
                             std::size_t frame_count,
                             const std::vector<EditRange>& removed_ranges,
                             const std::vector<std::size_t>& selected_streams = {},
                             EditExportMode mode = EditExportMode::smart_render,
                             std::int64_t audio_offset_ms = 0,
                             const AudioTransformOptions& audio = {},
                             const VideoTransformOptions& video = {},
                             const MpegTsMuxOptions& transport_stream = {});

}  // namespace smartcut::media
