#include <vector>
#include <string>
#include <nlohmann/json.hpp>
#include <fstream>
#include <zlib.h>
#include <stdexcept>
#include <iomanip>

#ifndef ADSB_HELPERS_HPP
#define ADSB_HELPERS_HPP

using json = nlohmann::json;

struct FlightInfo {
    std::string icao;
    std::string r;
    std::string t;
    double timestamp;
};

std::vector<std::vector<double>> extract_trace_values(const json& data, double base_ts);
FlightInfo extract_flight_info(const json& data);
json parse_json_file(const std::string& filepath);
void write_csv(const FlightInfo& info, const std::vector<std::vector<double>>& trace_values, const std::string& output_filepath);
bool check_bounds(const std::vector<double>& values);
void process_adsb_file(const std::string& input_filepath, const std::string& output_filepath);
#endif