#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <stdexcept>
#include <vector>
#include <filesystem>

#ifndef CSV_HELPERS_HPP
#define CSV_HELPERS_HPP

struct CSVRow {
    std::string icao;
    std::string r;
    std::string t;
    double timestamp;
    double lat;
    double lon;
    double alt;
    double ias;
};

const double AIRPORT_PROXIMITY_THRESHOLD_KM = 20.0;
const double AIRPORT_MAX_ALTITUDE_FT = 5000.0;

CSVRow parse_csv_line(const std::string& line);
CSVRow read_first_csv_row(const std::string& filepath);
CSVRow read_last_csv_row(const std::string& filepath);

double haversine_distance(double lat1, double lon1, double lat2, double lon2);

bool aircraft_type_filter(const std::string& t);
bool near_airport_filter(const double lat, const double lon, const double alt);

std::vector<std::string> list_csv_files_in_folder(const std::string& folder_path);


#endif // CSV_HELPERS_HPP