#ifndef _ErrorCodes_h
#define _ErrorCodes_h


#include <iostream>
#include <string>


struct ErrorMessage {
    int code;
    std::string message;
};

std::string getErrorMessageI(int errorCode) {
    static const ErrorMessage errorMessages[] = {
        {0, "No error"},
        {36, "Error opening terrain- or morphological data file (data not available)"},
        {38, "Error opening border data file (data not available)"},
        {41, "Error get height for Tx(Calculated coord) (data not available)"},
        {42, "Error get height for Rx(Calculated coord) (data not available)"},
        {200, "Error in longitude (in 'Point_height' or 'Point_type' subroutine)"},
        {210, "Error in latitude (in 'Point_height' or 'Point_type' subroutine)"},
        {220, "Error reading record (in 'Point_height' or 'Point_type' subroutine)"},
        {300, "Latitude is not in range of 0.0 - 90.0 (in 'Point_height' or 'Point_type' subroutine)"},
        {400, "Height is missing (-9999) (in 'Point_height' subroutine)"},
        {1000, "Distance between Tx and Rx = 0. Calculations not possible"},
        {1001, "Error in geographical coordinates (Tx longitude, degrees)"},
        {1002, "Error in geographical coordinates (Tx longitude, minutes)"},
        {1003, "Error in geographical coordinates (Tx longitude, seconds)"},
        {1004, "Error in geographical coordinates (Tx longitude, E/W)"},
        {1005, "Error in geographical coordinates (Tx latitude, degrees)"},
        {1006, "Error in geographical coordinates (Tx latitude, minutes)"},
        {1007, "Error in geographical coordinates (Tx latitude, seconds)"},
        {1008, "Error in geographical coordinates (Tx latitude, N/S)"},
        {1009, "Error in Tx antenna height"},
        {1010, "Error in transmitting frequency value"},
        {1011, "Error in transmitting frequency unit"},
        {1012, "Error in radius of service area of Tx"},
        {1013, "Error in input value height of Tx site above sea level"},
        {1014, "Error in geographical coordinates (Rx longitude, degrees)"},
        {1015, "Error in geographical coordinates (Rx longitude, minutes)"},
        {1016, "Error in geographical coordinates (Rx longitude, seconds)"},
        {1017, "Error in geographical coordinates (Rx longitude, E/W)"},
        {1018, "Error in geographical coordinates (Rx latitude, degrees)"},
        {1019, "Error in geographical coordinates (Rx latitude, minutes)"},
        {1020, "Error in geographical coordinates (Rx latitude, seconds)"},
        {1021, "Error in geographical coordinates (Rx latitude, N/S)"},
        {1022, "Error in Rx antenna height"},
        {1023, "Error in reception frequency value"},
        {1024, "Error in reception frequency unit"},
        {1025, "C_mode is out of range"},
        {1026, "Error in input value of permissible field strength"},
        {1027, "Error in input value of maximum cross border range"},
        {1028, "The distance is more than acceptable. Calculations are impossible"},
        {1029, "Error in radius of Rx service area"},
        {1030, "Error in input value Rx site height above sea level"},
        {1031, "Error in Tx elevation"},
        {1032, "Error in Tx azimuth"},
        {1033, "Error in type of Tx antenna (E/I)"},
        {1034, "Error in power"},
        {1035, "Error in input value of distance over sea"},
        {1036, "The 'xxx.ALL' borderline file for Tx is missing"},
        {1037, "The 'xxx.ALL' borderline file for Rx is missing"},
        {1038, "Error in type of antenna (TR20-08)"},
        {1039, "Error in input data of correction factor according frequency difference"},
        {1040, "Channel spacing outside definition range (Rx)"},
        {1041, "Channel spacing outside definition range (Tx)"},
        {1042, "Error in Rx elevation"},
        {1043, "Error in Rx azimuth"},
        {1044, "Error in Rx type of antenna E/I"},
        {1045, "Error in gain of Rx antenna"},
        {1046, "Error in input data of depolarization loss"},
        {1047, "Distance to borderline is too long"},
        {1048, "Selected line data not available"},
        {1049, "Error in line data"},
        {1050, "non strict HCM Cmode and important technical data missing"},
        {2000, "wrong Figure_frequency (from Get_figure_FS_value)"},
        {2001, "wrong Time_percentage (from Get_figure_FS_value)"},
        {2002, "wrong Sea_temperature (from Get_figure_FS_value)"},
        {2003, "wrong Figure_Heff (from Get_figure_FS_value)"},
        {2004, "wrong Figure_distance (from Get_figure_FS_value)"},
        {2005, "wrong Get_figure_FS_value (error in curves)"},
        {3100, "x-km line calculation doesn't support variable Tx coordinates"}
        
    };

    for (const auto& error : errorMessages) {
        if (error.code == errorCode) {
            return error.message;
        }
    }

    return "Unknown error code";
}

struct InfoMessage {
    int code;
    std::string message;
};

std::string getInfoMessageI(int InfoCode) {
    static const InfoMessage infoMessages[] = {
        {1, "No height of Tx site is given or Tx is mobile; height is taken from the terrain database"},
        {2, "Height of Tx site differs from height of terrain database"},
        {3, "Height of Tx site differs more than 10%%, calculated values may be (extremely) wrong!"},
        {4, "Frequency out of range of table in Annex 1"},
        {5, "Input value of permissible field strength is used"},
        {6, "Input value of maximum cross border range is used"},
        {7, "Distance between Tx and Rx is less than both service area radiuses; field strength is set to 999.9"},
        {8, "No height of Rx site is given or Rx is mobile/line, height is from the terrain database"},
        {9, "Height of Rx site differs from height of terrain data"},
        {10, "Rx site height differs more than 10%%, calculated values may be (extremely) wrong!"},
        {11, "Free space field strength used because distance < 1 km"},
        {12, "Free space field strength is used, because 1st Fresnel zone is free"},
        {13, "Distance over sea is greater than total distance. Distance between Tx and Rx is used!"},
        {14, "Input value of correction factor according frequency difference is used"},
        {15, "Frequency difference outside definition range; 82 dB is used"},
        {16, "Calculated distance over sea is set to 0 because of missing morphological data."},
        {17, "Tx channel spacing outside definition range, 25 kHz is used!"},
        {18, "Correction factors for the band 380 - 400 MHz are used."}
    };

    for (const auto& info : infoMessages) {
        if (info.code == InfoCode) {
            return info.message;
        }
    }

    return "Unknown info code";
}


#endif
