import Foundation
import MapKit

struct CountryAnnotationItem: Identifiable {
    var coordinate: CLLocationCoordinate2D
    let country: Country
    let id = UUID()
}

class TrendsViewModel: ObservableObject {
    let countries = [
        Country(name: "Afghanistan", lat: 33, long: 66 ),
        Country(name: "Albania", lat: 41, long: 20 ),
        Country(name: "Algeria", lat: 28, long: 3 ),
        Country(name: "Andorra", lat: 42.5, long: 1.5 ),
        Country(name: "Angola", lat: -12.5, long: 18.5 ),
        Country(name: "Antigua and Barbuda", lat: 17.05, long: -61.8 ),
        Country(name: "Argentina", lat: -34, long: -64 ),
        Country(name: "Armenia", lat: 40, long: 45 ),
        Country(name: "Australia", lat: -25, long: 135 ),
        Country(name: "Austria", lat: 47.333333, long: 13.333333 ),
        Country(name: "Azerbaijan", lat: 40.5, long: 47.5 ),
        Country(name: "Bahamas", lat: 24, long: -76 ),
        Country(name: "Bahrain", lat: 26, long: 50.5 ),
        Country(name: "Bangladesh", lat: 24, long: 90 ),
        Country(name: "Barbados", lat: 13.166667, long: -59.533333 ),
        Country(name: "Belarus", lat: 53, long: 28 ),
        Country(name: "Belgium", lat: 50.833333, long: 4 ),
        Country(name: "Belize", lat: 17.25, long: -88.75 ),
        Country(name: "Benin", lat: 9.5, long: 2.25 ),
        Country(name: "Bhutan", lat: 27.5, long: 90.5 ),
        Country(name: "Bolivia", lat: -17, long: -65 ),
        Country(name: "Bosnia and Herzegovina", lat: 44.25, long: 17.833333 ),
        Country(name: "Botswana", lat: -22, long: 24 ),
        Country(name: "Brazil", lat: -10, long: -55 ),
        Country(name: "Brunei Darussalam", lat: 4.5, long: 114.666667 ),
        Country(name: "Bulgaria", lat: 43, long: 25 ),
        Country(name: "Burkina Faso", lat: 13, long: -2 ),
        Country(name: "Burundi", lat: -3.5, long: 30 ),
        Country(name: "Cabo Verde", lat: 16, long: -24 ),
        Country(name: "Cambodia", lat: 13, long: 105 ),
        Country(name: "Cameroon", lat: 6, long: 12 ),
        Country(name: "Canada", lat: 60, long: -96 ),
        Country(name: "Central African Republic", lat: 7, long: 21 ),
        Country(name: "Chad", lat: 15, long: 19 ),
        Country(name: "Chile", lat: -30, long: -71 ),
        Country(name: "China", lat: 35, long: 105 ),
        Country(name: "Colombia", lat: 4, long: -72 ),
        Country(name: "Comoros", lat: -12.166667, long: 44.25 ),
        Country(name: "Congo", lat: -1, long: 15 ),
        Country(name: "Costa Rica", lat: 10, long: -84 ),
        Country(name: "Côte d’Ivoire", lat: 8, long: -5 ),
        Country(name: "Croatia", lat: 45.166667, long: 15.5 ),
        Country(name: "Cuba", lat: 22, long: -79.5 ),
        Country(name: "Cyprus", lat: 35, long: 33 ),
        Country(name: "Czech Republic", lat: 49.75, long: 15 ),
        Country(name: "Democratic People’s Republic of Korea", lat: 40, long: 127 ),
        Country(name: "Democratic Republic of the Congo", lat: 0, long: 25 ),
        Country(name: "Denmark", lat: 56, long: 10 ),
        Country(name: "Djibouti", lat: 11.5, long: 42.5 ),
        Country(name: "Dominica", lat: 15.5, long: -61.333333 ),
        Country(name: "Dominican Republic", lat: 19, long: -70.666667 ),
        Country(name: "Ecuador", lat: -2, long: -77.5 ),
        Country(name: "Egypt", lat: 27, long: 30 ),
        Country(name: "El Salvador", lat: 13.833333, long: -88.916667 ),
        Country(name: "Equatorial Guinea", lat: 2, long: 10 ),
        Country(name: "Eritrea", lat: 15, long: 39 ),
        Country(name: "Estonia", lat: 59, long: 26 ),
        Country(name: "Ethiopia", lat: 8, long: 38 ),
        Country(name: "Fiji", lat: -18, long: 178 ),
        Country(name: "Finland", lat: 64, long: 26 ),
        Country(name: "France", lat: 46, long: 2 ),
        Country(name: "Gabon", lat: -1, long: 11.75 ),
        Country(name: "Gambia", lat: 13.5, long: -15.5 ),
        Country(name: "Georgia", lat: 41.999981, long: 43.499905 ),
        Country(name: "Germany", lat: 51.5, long: 10.5 ),
        Country(name: "Ghana", lat: 8, long: -2 ),
        Country(name: "Greece", lat: 39, long: 22 ),
        Country(name: "Grenada", lat: 12.116667, long: -61.666667 ),
        Country(name: "Guatemala", lat: 15.5, long: -90.25 ),
        Country(name: "Guinea", lat: 11, long: -10 ),
        Country(name: "Guinea-Bissau", lat: 12, long: -15 ),
        Country(name: "Guyana", lat: 5, long: -59 ),
        Country(name: "Haiti", lat: 19, long: -72.416667 ),
        Country(name: "Honduras", lat: 15, long: -86.5 ),
        Country(name: "Hungary", lat: 47, long: 20 ),
        Country(name: "Iceland", lat: 65, long: -18 ),
        Country(name: "India", lat: 20, long: 77 ),
        Country(name: "Indonesia", lat: -5, long: 120 ),
        Country(name: "Iran", lat: 32, long: 53 ),
        Country(name: "Iraq", lat: 33, long: 44 ),
        Country(name: "Ireland", lat: 53, long: -8 ),
        Country(name: "Israel", lat: 31.5, long: 34.75 ),
        Country(name: "Italy", lat: 42.833333, long: 12.833333 ),
        Country(name: "Jamaica", lat: 18.25, long: -77.5 ),
        Country(name: "Japan", lat: 36, long: 138 ),
        Country(name: "Jordan", lat: 31, long: 36 ),
        Country(name: "Kazakhstan", lat: 48, long: 68 ),
        Country(name: "Kenya", lat: 1, long: 38 ),
        Country(name: "Kiribati", lat: -5, long: -170 ),
        Country(name: "Kuwait", lat: 29.5, long: 47.75 ),
        Country(name: "Kyrgyzstan", lat: 41, long: 75 ),
        Country(name: "Laos", lat: 18, long: 105 ),
        Country(name: "Latvia", lat: 57, long: 25 ),
        Country(name: "Lebanon", lat: 33.833333, long: 35.833333 ),
        Country(name: "Lesotho", lat: -29.5, long: 28.25 ),
        Country(name: "Liberia", lat: 6.5, long: 9.5 ),
        Country(name: "Libya", lat: 25, long: 17 ),
        Country(name: "Liechtenstein", lat: 47.166667, long: 9.533333 ),
        Country(name: "Lithuania", lat: 56, long: 24 ),
        Country(name: "Luxembourg", lat: 49.75, long: 6.166667 ),
        Country(name: "Macedonia", lat: 41.833333, long: 22 ),
        Country(name: "Madagascar", lat: -20, long: 47 ),
        Country(name: "Malawi", lat: -13.5, long: 34 ),
        Country(name: "Malaysia", lat: 2.5, long: 112.5 ),
        Country(name: "Maldives", lat: 3.2, long: 73 ),
        Country(name: "Mali", lat: 17, long: -4 ),
        Country(name: "Malta", lat: 35.916667, long: 14.433333 ),
        Country(name: "Marshall Islands", lat: 10, long: 167 ),
        Country(name: "Mauritania", lat: 20, long: -12 ),
        Country(name: "Mauritius", lat: -20.3, long: 57.583333 ),
        Country(name: "Mexico", lat: 23, long: -102 ),
        Country(name: "Federated States of Micronesia", lat: 5, long: 152 ),
        Country(name: "Monaco", lat: 43.733333, long: 7.4 ),
        Country(name: "Mongolia", lat: 46, long: 105 ),
        Country(name: "Montenegro", lat: 42.5, long: 19.3 ),
        Country(name: "Morocco", lat: 32, long: -5 ),
        Country(name: "Mozambique", lat: -18.25, long: 35 ),
        Country(name: "Myanmar", lat: 22, long: 98 ),
        Country(name: "Namibia", lat: -22, long: 17 ),
        Country(name: "Nauru", lat: -0.533333, long: 166.916667 ),
        Country(name: "Nepal", lat: 28, long: 84 ),
        Country(name: "Netherlands", lat: 52.5, long: 5.75 ),
        Country(name: "New Zealand", lat: -42, long: 174 ),
        Country(name: "Nicaragua", lat: 13, long: -85 ),
        Country(name: "Niger", lat: 16, long: 8 ),
        Country(name: "Nigeria", lat: 10, long: 8 ),
        Country(name: "Norway", lat: 62, long: 10 ),
        Country(name: "Oman", lat: 21, long: 57 ),
        Country(name: "Pakistan", lat: 30, long: 70 ),
        Country(name: "Palau", lat: 6, long: 134 ),
        Country(name: "Panama", lat: 9, long: -80 ),
        Country(name: "Papua New Guinea", lat: -6, long: 147 ),
        Country(name: "Paraguay", lat: -22.993333, long: -57.996389 ),
        Country(name: "Peru", lat: -10, long: -76 ),
        Country(name: "Philippines", lat: 13, long: 122 ),
        Country(name: "Poland", lat: 52, long: 20 ),
        Country(name: "Portugal", lat: 39.5, long: -8 ),
        Country(name: "Qatar", lat: 25.5, long: 51.25 ),
        Country(name: "Republic of Korea", lat: 37, long: 127.5 ),
        Country(name: "Republic of Moldova", lat: 47, long: 29 ),
        Country(name: "Romania", lat: 46, long: 25 ),
        Country(name: "Russian Federation", lat: 60, long: 100 ),
        Country(name: "Rwanda", lat: -2, long: 30 ),
        Country(name: "Saint Kitts and Nevis", lat: 17.333333, long: -62.75 ),
        Country(name: "Saint Lucia", lat: 13.883333, long: -60.966667 ),
        Country(name: "Saint Vincent and the Grenadines", lat: 13.083333, long: -61.2 ),
        Country(name: "Samoa", lat: -13.803096, long: -172.178309 ),
        Country(name: "San Marino", lat: 43.933333, long: 12.416667 ),
        Country(name: "Sao Tome and Principe", lat: 1, long: 7 ),
        Country(name: "Saudi Arabia", lat: 25, long: 45 ),
        Country(name: "Senegal", lat: 14, long: -14 ),
        Country(name: "Serbia", lat: 44, long: 21 ),
        Country(name: "Seychelles", lat: -4.583333, long: 55.666667 ),
        Country(name: "Sierra Leone", lat: 8.5, long: -11.5 ),
        Country(name: "Singapore", lat: 1.366667, long: 103.8 ),
        Country(name: "Slovakia", lat: 48.666667, long: 19.5 ),
        Country(name: "Slovenia", lat: 46.25, long: 15.166667 ),
        Country(name: "Solomon Islands", lat: -8, long: 159 ),
        Country(name: "Somalia", lat: 6, long: 48 ),
        Country(name: "South Africa", lat: -30, long: 26 ),
        Country(name: "South Sudan", lat: 8, long: 30 ),
        Country(name: "Spain", lat: 40, long: -4 ),
        Country(name: "Sri Lanka", lat: 7, long: 81 ),
        Country(name: "Sudan", lat: 16, long: 30 ),
        Country(name: "Suriname", lat: 4, long: -56 ),
        Country(name: "Swaziland", lat: -26.5, long: 31.5 ),
        Country(name: "Sweden", lat: 62, long: 15 ),
        Country(name: "Switzerland", lat: 47, long: 8 ),
        Country(name: "Syrian Arab Republic", lat: 35, long: 38 ),
        Country(name: "Tajikistan", lat: 39, long: 71 ),
        Country(name: "Tanzania", lat: -6, long: 35 ),
        Country(name: "Thailand", lat: 15, long: 100 ),
        Country(name: "Timor-Leste", lat: -8.833333, long: 125.75 ),
        Country(name: "Togo", lat: 8, long: 1.166667 ),
        Country(name: "Tonga", lat: -20, long: -175 ),
        Country(name: "Trinidad and Tobago", lat: 11, long: -61 ),
        Country(name: "Tunisia", lat: 34, long: 9 ),
        Country(name: "Turkey", lat: 39.059012, long: 34.911546 ),
        Country(name: "Turkmenistan", lat: 40, long: 60 ),
        Country(name: "Tuvalu", lat: -8, long: 178 ),
        Country(name: "Uganda", lat: 2, long: 33 ),
        Country(name: "Ukraine", lat: 49, long: 32 ),
        Country(name: "United Arab Emirates", lat: 24, long: 54 ),
        Country(name: "United Kingdom", lat: 54, long: -4 ),
        Country(name: "United States of America", lat: 39.828175, long: -98.5795 ),
        Country(name: "Uruguay", lat: -33, long: -56 ),
        Country(name: "Uzbekistan", lat: 41.707542, long: 63.84911 ),
        Country(name: "Vanuatu", lat: -16, long: 167 ),
        Country(name: "Venezuela", lat: 8, long: -66 ),
        Country(name: "Vietnam", lat: 16.166667, long: 107.833333 ),
        Country(name: "Yemen", lat: 15.5, long: 47.5 ),
        Country(name: "Zambia", lat: -15, long: 30 ),
        Country(name: "Zimbabwe", lat: -19, long: 29)
    ]

    var annotationItems: [CountryAnnotationItem] = []

    init() {
        for country in countries {
            annotationItems.append(
                CountryAnnotationItem(
                    coordinate: CLLocationCoordinate2D(
                        latitude: country.lat,
                        longitude: country.long
                        // swiftlint:disable force_cast
                    ), country: country.copy() as! Country
                )
            )
        }
    }
}
