package com.grigowashere.aismap.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * Маппинг MID (первые 3 цифры MMSI) -> ISO 3166-1 alpha-2 кода страны
 */
public final class MIDToCountry {

    public static final Map<String, String> MID_TO_COUNTRY;

    static {
        MID_TO_COUNTRY = new HashMap<>();
        // Europe
        MID_TO_COUNTRY.put("201", "AL"); // Albania
        MID_TO_COUNTRY.put("202", "AD"); // Andorra
        MID_TO_COUNTRY.put("203", "AT"); // Austria
        MID_TO_COUNTRY.put("204", "PT"); // Portugal (Azores)
        MID_TO_COUNTRY.put("205", "BE"); // Belgium
        MID_TO_COUNTRY.put("206", "BY"); // Belarus
        MID_TO_COUNTRY.put("207", "BG"); // Bulgaria
        MID_TO_COUNTRY.put("208", "VA"); // Vatican City
        MID_TO_COUNTRY.put("209", "CY"); // Cyprus
        MID_TO_COUNTRY.put("210", "CY"); // Cyprus
        MID_TO_COUNTRY.put("211", "DE"); // Germany
        MID_TO_COUNTRY.put("212", "CY"); // Cyprus
        MID_TO_COUNTRY.put("213", "GE"); // Georgia
        MID_TO_COUNTRY.put("214", "MD"); // Moldova
        MID_TO_COUNTRY.put("215", "MT"); // Malta
        MID_TO_COUNTRY.put("216", "AM"); // Armenia
        MID_TO_COUNTRY.put("218", "DE"); // Germany
        MID_TO_COUNTRY.put("219", "DK"); // Denmark
        MID_TO_COUNTRY.put("220", "DK"); // Denmark
        MID_TO_COUNTRY.put("224", "ES"); // Spain
        MID_TO_COUNTRY.put("225", "ES"); // Spain
        MID_TO_COUNTRY.put("226", "FR"); // France
        MID_TO_COUNTRY.put("227", "FR"); // France
        MID_TO_COUNTRY.put("228", "FR"); // France
        MID_TO_COUNTRY.put("229", "MT"); // Malta
        MID_TO_COUNTRY.put("230", "FI"); // Finland
        MID_TO_COUNTRY.put("231", "FO"); // Faroe Islands
        MID_TO_COUNTRY.put("232", "GB"); // United Kingdom
        MID_TO_COUNTRY.put("233", "GB"); // United Kingdom
        MID_TO_COUNTRY.put("234", "GB"); // United Kingdom
        MID_TO_COUNTRY.put("235", "GB"); // United Kingdom
        MID_TO_COUNTRY.put("236", "GI"); // Gibraltar
        MID_TO_COUNTRY.put("237", "GR"); // Greece
        MID_TO_COUNTRY.put("238", "HR"); // Croatia
        MID_TO_COUNTRY.put("239", "GR"); // Greece
        MID_TO_COUNTRY.put("240", "GR"); // Greece
        MID_TO_COUNTRY.put("241", "GR"); // Greece
        MID_TO_COUNTRY.put("242", "MA"); // Morocco
        MID_TO_COUNTRY.put("243", "HU"); // Hungary
        MID_TO_COUNTRY.put("244", "NL"); // Netherlands
        MID_TO_COUNTRY.put("245", "NL"); // Netherlands
        MID_TO_COUNTRY.put("246", "NL"); // Netherlands
        MID_TO_COUNTRY.put("247", "IT"); // Italy
        MID_TO_COUNTRY.put("248", "MT"); // Malta
        MID_TO_COUNTRY.put("249", "MT"); // Malta
        MID_TO_COUNTRY.put("250", "IE"); // Ireland
        MID_TO_COUNTRY.put("251", "IS"); // Iceland
        MID_TO_COUNTRY.put("252", "LI"); // Liechtenstein
        MID_TO_COUNTRY.put("253", "LU"); // Luxembourg
        MID_TO_COUNTRY.put("254", "MC"); // Monaco
        MID_TO_COUNTRY.put("255", "PT"); // Portugal (Madeira)
        MID_TO_COUNTRY.put("256", "MT"); // Malta
        MID_TO_COUNTRY.put("257", "NO"); // Norway
        MID_TO_COUNTRY.put("258", "NO"); // Norway
        MID_TO_COUNTRY.put("259", "NO"); // Norway
        MID_TO_COUNTRY.put("261", "PL"); // Poland
        MID_TO_COUNTRY.put("262", "ME"); // Montenegro
        MID_TO_COUNTRY.put("263", "PT"); // Portugal
        MID_TO_COUNTRY.put("264", "RO"); // Romania
        MID_TO_COUNTRY.put("265", "SE"); // Sweden
        MID_TO_COUNTRY.put("266", "SE"); // Sweden
        MID_TO_COUNTRY.put("267", "SK"); // Slovakia
        MID_TO_COUNTRY.put("268", "SM"); // San Marino
        MID_TO_COUNTRY.put("269", "CH"); // Switzerland
        MID_TO_COUNTRY.put("270", "CZ"); // Czech Republic
        MID_TO_COUNTRY.put("271", "TR"); // Turkey
        MID_TO_COUNTRY.put("272", "UA"); // Ukraine
        MID_TO_COUNTRY.put("273", "RU"); // Russian Federation
        MID_TO_COUNTRY.put("274", "MK"); // North Macedonia
        MID_TO_COUNTRY.put("275", "LV"); // Latvia
        MID_TO_COUNTRY.put("276", "EE"); // Estonia
        MID_TO_COUNTRY.put("277", "LT"); // Lithuania
        MID_TO_COUNTRY.put("278", "SI"); // Slovenia
        MID_TO_COUNTRY.put("279", "RS"); // Serbia

        // North America & Caribbean
        MID_TO_COUNTRY.put("301", "AI"); // Anguilla
        MID_TO_COUNTRY.put("303", "US"); // USA (Alaska)
        MID_TO_COUNTRY.put("304", "AG"); // Antigua and Barbuda
        MID_TO_COUNTRY.put("305", "AG"); // Antigua and Barbuda
        MID_TO_COUNTRY.put("306", "CW"); // Curaçao
        MID_TO_COUNTRY.put("307", "AW"); // Aruba
        MID_TO_COUNTRY.put("308", "BS"); // Bahamas
        MID_TO_COUNTRY.put("309", "BS"); // Bahamas
        MID_TO_COUNTRY.put("310", "BM"); // Bermuda
        MID_TO_COUNTRY.put("311", "BS"); // Bahamas
        MID_TO_COUNTRY.put("312", "BZ"); // Belize
        MID_TO_COUNTRY.put("314", "BB"); // Barbados
        MID_TO_COUNTRY.put("316", "CA"); // Canada
        MID_TO_COUNTRY.put("319", "KY"); // Cayman Islands
        MID_TO_COUNTRY.put("321", "CR"); // Costa Rica
        MID_TO_COUNTRY.put("323", "CU"); // Cuba
        MID_TO_COUNTRY.put("325", "DM"); // Dominica
        MID_TO_COUNTRY.put("327", "DO"); // Dominican Republic
        MID_TO_COUNTRY.put("329", "GP"); // Guadeloupe
        MID_TO_COUNTRY.put("330", "GD"); // Grenada
        MID_TO_COUNTRY.put("331", "GL"); // Greenland
        MID_TO_COUNTRY.put("332", "GT"); // Guatemala
        MID_TO_COUNTRY.put("334", "HN"); // Honduras
        MID_TO_COUNTRY.put("336", "HT"); // Haiti
        MID_TO_COUNTRY.put("338", "US"); // USA
        MID_TO_COUNTRY.put("339", "JM"); // Jamaica
        MID_TO_COUNTRY.put("341", "KN"); // Saint Kitts and Nevis
        MID_TO_COUNTRY.put("343", "LC"); // Saint Lucia
        MID_TO_COUNTRY.put("345", "MX"); // Mexico
        MID_TO_COUNTRY.put("347", "MQ"); // Martinique
        MID_TO_COUNTRY.put("348", "MS"); // Montserrat
        MID_TO_COUNTRY.put("350", "NI"); // Nicaragua
        MID_TO_COUNTRY.put("351", "PA"); // Panama
        MID_TO_COUNTRY.put("352", "PA"); // Panama
        MID_TO_COUNTRY.put("353", "PA"); // Panama
        MID_TO_COUNTRY.put("354", "PA"); // Panama
        MID_TO_COUNTRY.put("355", "PA"); // Panama
        MID_TO_COUNTRY.put("356", "PA"); // Panama
        MID_TO_COUNTRY.put("357", "PA"); // Panama
        MID_TO_COUNTRY.put("358", "PR"); // Puerto Rico
        MID_TO_COUNTRY.put("359", "SV"); // El Salvador
        MID_TO_COUNTRY.put("361", "PM"); // Saint Pierre and Miquelon
        MID_TO_COUNTRY.put("362", "TT"); // Trinidad and Tobago
        MID_TO_COUNTRY.put("364", "TC"); // Turks and Caicos Islands
        MID_TO_COUNTRY.put("366", "US"); // USA
        MID_TO_COUNTRY.put("367", "US"); // USA
        MID_TO_COUNTRY.put("368", "US"); // USA
        MID_TO_COUNTRY.put("369", "US"); // USA
        MID_TO_COUNTRY.put("370", "PA"); // Panama
        MID_TO_COUNTRY.put("371", "PA"); // Panama
        MID_TO_COUNTRY.put("372", "PA"); // Panama
        MID_TO_COUNTRY.put("373", "PA"); // Panama
        MID_TO_COUNTRY.put("375", "VC"); // Saint Vincent and the Grenadines
        MID_TO_COUNTRY.put("376", "VC"); // Saint Vincent and the Grenadines
        MID_TO_COUNTRY.put("377", "VC"); // Saint Vincent and the Grenadines
        MID_TO_COUNTRY.put("378", "VG"); // British Virgin Islands
        MID_TO_COUNTRY.put("379", "VI"); // U.S. Virgin Islands

        // Asia & Middle East
        MID_TO_COUNTRY.put("401", "AF"); // Afghanistan
        MID_TO_COUNTRY.put("403", "SA"); // Saudi Arabia
        MID_TO_COUNTRY.put("405", "BD"); // Bangladesh
        MID_TO_COUNTRY.put("408", "BH"); // Bahrain
        MID_TO_COUNTRY.put("410", "BT"); // Bhutan
        MID_TO_COUNTRY.put("412", "CN"); // China
        MID_TO_COUNTRY.put("413", "CN"); // China
        MID_TO_COUNTRY.put("414", "CN"); // China
        MID_TO_COUNTRY.put("416", "TW"); // Taiwan
        MID_TO_COUNTRY.put("417", "LK"); // Sri Lanka
        MID_TO_COUNTRY.put("419", "IN"); // India
        MID_TO_COUNTRY.put("422", "IR"); // Iran
        MID_TO_COUNTRY.put("423", "AZ"); // Azerbaijan
        MID_TO_COUNTRY.put("425", "IQ"); // Iraq
        MID_TO_COUNTRY.put("428", "IL"); // Israel
        MID_TO_COUNTRY.put("431", "JP"); // Japan
        MID_TO_COUNTRY.put("432", "JP"); // Japan
        MID_TO_COUNTRY.put("434", "TM"); // Turkmenistan
        MID_TO_COUNTRY.put("436", "KZ"); // Kazakhstan
        MID_TO_COUNTRY.put("437", "UZ"); // Uzbekistan
        MID_TO_COUNTRY.put("438", "JO"); // Jordan
        MID_TO_COUNTRY.put("440", "KR"); // South Korea
        MID_TO_COUNTRY.put("441", "KR"); // South Korea
        MID_TO_COUNTRY.put("443", "PS"); // Palestine
        MID_TO_COUNTRY.put("445", "KP"); // North Korea
        MID_TO_COUNTRY.put("447", "KW"); // Kuwait
        MID_TO_COUNTRY.put("450", "LB"); // Lebanon
        MID_TO_COUNTRY.put("451", "KG"); // Kyrgyzstan
        MID_TO_COUNTRY.put("453", "MO"); // Macao
        MID_TO_COUNTRY.put("455", "MV"); // Maldives
        MID_TO_COUNTRY.put("457", "MN"); // Mongolia
        MID_TO_COUNTRY.put("459", "NP"); // Nepal
        MID_TO_COUNTRY.put("461", "OM"); // Oman
        MID_TO_COUNTRY.put("463", "PK"); // Pakistan
        MID_TO_COUNTRY.put("466", "QA"); // Qatar
        MID_TO_COUNTRY.put("468", "SY"); // Syria
        MID_TO_COUNTRY.put("470", "AE"); // United Arab Emirates
        MID_TO_COUNTRY.put("471", "AE"); // United Arab Emirates
        MID_TO_COUNTRY.put("472", "TJ"); // Tajikistan
        MID_TO_COUNTRY.put("473", "YE"); // Yemen
        MID_TO_COUNTRY.put("475", "YE"); // Yemen
        MID_TO_COUNTRY.put("477", "HK"); // Hong Kong
        MID_TO_COUNTRY.put("478", "BA"); // Bosnia and Herzegovina (legacy routing usage)

        // Oceania
        MID_TO_COUNTRY.put("501", "AQ"); // Antarctica
        MID_TO_COUNTRY.put("503", "AU"); // Australia
        MID_TO_COUNTRY.put("506", "MM"); // Myanmar
        MID_TO_COUNTRY.put("508", "BN"); // Brunei
        MID_TO_COUNTRY.put("510", "FM"); // Micronesia
        MID_TO_COUNTRY.put("511", "PW"); // Palau
        MID_TO_COUNTRY.put("512", "NZ"); // New Zealand
        MID_TO_COUNTRY.put("514", "KH"); // Cambodia
        MID_TO_COUNTRY.put("515", "KH"); // Cambodia
        MID_TO_COUNTRY.put("516", "CX"); // Christmas Island
        MID_TO_COUNTRY.put("518", "CK"); // Cook Islands
        MID_TO_COUNTRY.put("520", "FJ"); // Fiji
        MID_TO_COUNTRY.put("523", "CC"); // Cocos (Keeling) Islands
        MID_TO_COUNTRY.put("525", "ID"); // Indonesia
        MID_TO_COUNTRY.put("529", "KI"); // Kiribati
        MID_TO_COUNTRY.put("531", "LA"); // Laos
        MID_TO_COUNTRY.put("533", "MY"); // Malaysia
        MID_TO_COUNTRY.put("536", "MP"); // Northern Mariana Islands
        MID_TO_COUNTRY.put("538", "MH"); // Marshall Islands
        MID_TO_COUNTRY.put("540", "NC"); // New Caledonia
        MID_TO_COUNTRY.put("542", "NU"); // Niue
        MID_TO_COUNTRY.put("544", "NR"); // Nauru
        MID_TO_COUNTRY.put("546", "PF"); // French Polynesia
        MID_TO_COUNTRY.put("548", "PH"); // Philippines
        MID_TO_COUNTRY.put("553", "PG"); // Papua New Guinea
        MID_TO_COUNTRY.put("555", "PN"); // Pitcairn Islands
        MID_TO_COUNTRY.put("557", "SB"); // Solomon Islands
        MID_TO_COUNTRY.put("559", "AS"); // American Samoa
        MID_TO_COUNTRY.put("561", "WS"); // Samoa
        MID_TO_COUNTRY.put("563", "SG"); // Singapore
        MID_TO_COUNTRY.put("564", "SG"); // Singapore
        MID_TO_COUNTRY.put("565", "SG"); // Singapore
        MID_TO_COUNTRY.put("566", "SG"); // Singapore
        MID_TO_COUNTRY.put("567", "TH"); // Thailand
        MID_TO_COUNTRY.put("570", "TO"); // Tonga
        MID_TO_COUNTRY.put("572", "TV"); // Tuvalu
        MID_TO_COUNTRY.put("574", "VN"); // Vietnam
        MID_TO_COUNTRY.put("576", "VU"); // Vanuatu
        MID_TO_COUNTRY.put("578", "WF"); // Wallis and Futuna

        // Africa
        MID_TO_COUNTRY.put("601", "ZA"); // South Africa
        MID_TO_COUNTRY.put("603", "AO"); // Angola
        MID_TO_COUNTRY.put("605", "DZ"); // Algeria
        MID_TO_COUNTRY.put("609", "BI"); // Burundi
        MID_TO_COUNTRY.put("610", "BJ"); // Benin
        MID_TO_COUNTRY.put("611", "BW"); // Botswana
        MID_TO_COUNTRY.put("612", "CF"); // Central African Republic
        MID_TO_COUNTRY.put("613", "CM"); // Cameroon
        MID_TO_COUNTRY.put("615", "CG"); // Congo (Republic)
        MID_TO_COUNTRY.put("616", "KM"); // Comoros
        MID_TO_COUNTRY.put("617", "CV"); // Cabo Verde
        MID_TO_COUNTRY.put("619", "CI"); // Côte d’Ivoire
        MID_TO_COUNTRY.put("621", "DJ"); // Djibouti
        MID_TO_COUNTRY.put("622", "EG"); // Egypt
        MID_TO_COUNTRY.put("624", "ET"); // Ethiopia
        MID_TO_COUNTRY.put("625", "ER"); // Eritrea
        MID_TO_COUNTRY.put("626", "GA"); // Gabon
        MID_TO_COUNTRY.put("627", "GH"); // Ghana
        MID_TO_COUNTRY.put("629", "GM"); // Gambia
        MID_TO_COUNTRY.put("630", "GW"); // Guinea-Bissau
        MID_TO_COUNTRY.put("631", "GQ"); // Equatorial Guinea
        MID_TO_COUNTRY.put("632", "GN"); // Guinea
        MID_TO_COUNTRY.put("633", "BF"); // Burkina Faso
        MID_TO_COUNTRY.put("634", "KE"); // Kenya
        MID_TO_COUNTRY.put("636", "LR"); // Liberia
        MID_TO_COUNTRY.put("637", "LR"); // Liberia
        MID_TO_COUNTRY.put("642", "LY"); // Libya
        MID_TO_COUNTRY.put("644", "LS"); // Lesotho
        MID_TO_COUNTRY.put("645", "MU"); // Mauritius
        MID_TO_COUNTRY.put("647", "MG"); // Madagascar
        MID_TO_COUNTRY.put("649", "ML"); // Mali
        MID_TO_COUNTRY.put("650", "MZ"); // Mozambique
        MID_TO_COUNTRY.put("654", "MR"); // Mauritania
        MID_TO_COUNTRY.put("655", "MW"); // Malawi
        MID_TO_COUNTRY.put("656", "NE"); // Niger
        MID_TO_COUNTRY.put("657", "NG"); // Nigeria
        MID_TO_COUNTRY.put("659", "NA"); // Namibia
        MID_TO_COUNTRY.put("660", "RE"); // Reunion (FR)
        MID_TO_COUNTRY.put("661", "RW"); // Rwanda
        MID_TO_COUNTRY.put("662", "SD"); // Sudan
        MID_TO_COUNTRY.put("663", "SN"); // Senegal
        MID_TO_COUNTRY.put("664", "SC"); // Seychelles
        MID_TO_COUNTRY.put("665", "SH"); // Saint Helena
        MID_TO_COUNTRY.put("666", "SO"); // Somalia
        MID_TO_COUNTRY.put("667", "SL"); // Sierra Leone
        MID_TO_COUNTRY.put("668", "ST"); // Sao Tome and Principe
        MID_TO_COUNTRY.put("669", "SZ"); // Eswatini
        MID_TO_COUNTRY.put("670", "TD"); // Chad
        MID_TO_COUNTRY.put("671", "TG"); // Togo
        MID_TO_COUNTRY.put("672", "TN"); // Tunisia
        MID_TO_COUNTRY.put("674", "TZ"); // Tanzania
        MID_TO_COUNTRY.put("675", "UG"); // Uganda
        MID_TO_COUNTRY.put("676", "CD"); // DR Congo
        MID_TO_COUNTRY.put("677", "TZ"); // Tanzania (alt)
        MID_TO_COUNTRY.put("678", "ZM"); // Zambia
        MID_TO_COUNTRY.put("679", "ZW"); // Zimbabwe

        // South America
        MID_TO_COUNTRY.put("701", "AR"); // Argentina
        MID_TO_COUNTRY.put("710", "BR"); // Brazil
        MID_TO_COUNTRY.put("720", "BO"); // Bolivia
        MID_TO_COUNTRY.put("725", "CL"); // Chile
        MID_TO_COUNTRY.put("730", "CO"); // Colombia
        MID_TO_COUNTRY.put("735", "EC"); // Ecuador
        MID_TO_COUNTRY.put("740", "FK"); // Falkland Islands
        MID_TO_COUNTRY.put("745", "GF"); // French Guiana
        MID_TO_COUNTRY.put("750", "GY"); // Guyana
        MID_TO_COUNTRY.put("755", "PY"); // Paraguay
        MID_TO_COUNTRY.put("760", "PE"); // Peru
        MID_TO_COUNTRY.put("765", "SR"); // Suriname
        MID_TO_COUNTRY.put("770", "UY"); // Uruguay
        MID_TO_COUNTRY.put("775", "VE"); // Venezuela
    }

    private MIDToCountry() {}
}


