1use std::collections::HashSet;
2use std::sync::LazyLock;
3
4/// Returns whether the given country code is supported by Google Gemini.
5///
6/// <https://ai.google.dev/gemini-api/docs/available-regions>
7pub fn is_supported_country(country_code: &str) -> bool {
8 SUPPORTED_COUNTRIES.contains(&country_code)
9}
10
11/// The list of country codes supported by Google Gemini.
12///
13/// https://ai.google.dev/gemini-api/docs/available-regions
14static SUPPORTED_COUNTRIES: LazyLock<HashSet<&'static str>> = LazyLock::new(|| {
15 vec![
16 "DZ", // Algeria
17 "AS", // American Samoa
18 "AO", // Angola
19 "AI", // Anguilla
20 "AQ", // Antarctica
21 "AG", // Antigua and Barbuda
22 "AR", // Argentina
23 "AM", // Armenia
24 "AW", // Aruba
25 "AU", // Australia
26 "AT", // Austria
27 "AZ", // Azerbaijan
28 "BS", // The Bahamas
29 "BH", // Bahrain
30 "BD", // Bangladesh
31 "BB", // Barbados
32 "BE", // Belgium
33 "BZ", // Belize
34 "BJ", // Benin
35 "BM", // Bermuda
36 "BT", // Bhutan
37 "BO", // Bolivia
38 "BW", // Botswana
39 "BR", // Brazil
40 "IO", // British Indian Ocean Territory
41 "VG", // British Virgin Islands
42 "BN", // Brunei
43 "BG", // Bulgaria
44 "BF", // Burkina Faso
45 "BI", // Burundi
46 "CV", // Cabo Verde
47 "KH", // Cambodia
48 "CM", // Cameroon
49 "CA", // Canada
50 "BQ", // Caribbean Netherlands
51 "KY", // Cayman Islands
52 "CF", // Central African Republic
53 "TD", // Chad
54 "CL", // Chile
55 "CX", // Christmas Island
56 "CC", // Cocos (Keeling) Islands
57 "CO", // Colombia
58 "KM", // Comoros
59 "CK", // Cook Islands
60 "CI", // Côte d'Ivoire
61 "CR", // Costa Rica
62 "HR", // Croatia
63 "CW", // Curaçao
64 "CZ", // Czech Republic
65 "CD", // Democratic Republic of the Congo
66 "DK", // Denmark
67 "DJ", // Djibouti
68 "DM", // Dominica
69 "DO", // Dominican Republic
70 "EC", // Ecuador
71 "EG", // Egypt
72 "SV", // El Salvador
73 "GQ", // Equatorial Guinea
74 "ER", // Eritrea
75 "EE", // Estonia
76 "SZ", // Eswatini
77 "ET", // Ethiopia
78 "FK", // Falkland Islands (Islas Malvinas)
79 "FJ", // Fiji
80 "FI", // Finland
81 "FR", // France
82 "GA", // Gabon
83 "GM", // The Gambia
84 "GE", // Georgia
85 "DE", // Germany
86 "GH", // Ghana
87 "GI", // Gibraltar
88 "GR", // Greece
89 "GD", // Grenada
90 "GU", // Guam
91 "GT", // Guatemala
92 "GG", // Guernsey
93 "GN", // Guinea
94 "GW", // Guinea-Bissau
95 "GY", // Guyana
96 "HT", // Haiti
97 "HM", // Heard Island and McDonald Islands
98 "HN", // Honduras
99 "HU", // Hungary
100 "IS", // Iceland
101 "IN", // India
102 "ID", // Indonesia
103 "IQ", // Iraq
104 "IE", // Ireland
105 "IM", // Isle of Man
106 "IL", // Israel
107 "IT", // Italy
108 "JM", // Jamaica
109 "JP", // Japan
110 "JE", // Jersey
111 "JO", // Jordan
112 "KZ", // Kazakhstan
113 "KE", // Kenya
114 "KI", // Kiribati
115 "KG", // Kyrgyzstan
116 "KW", // Kuwait
117 "LA", // Laos
118 "LV", // Latvia
119 "LB", // Lebanon
120 "LS", // Lesotho
121 "LR", // Liberia
122 "LY", // Libya
123 "LI", // Liechtenstein
124 "LT", // Lithuania
125 "LU", // Luxembourg
126 "MG", // Madagascar
127 "MW", // Malawi
128 "MY", // Malaysia
129 "MV", // Maldives
130 "ML", // Mali
131 "MT", // Malta
132 "MH", // Marshall Islands
133 "MR", // Mauritania
134 "MU", // Mauritius
135 "MX", // Mexico
136 "FM", // Micronesia
137 "MN", // Mongolia
138 "MS", // Montserrat
139 "MA", // Morocco
140 "MZ", // Mozambique
141 "NA", // Namibia
142 "NR", // Nauru
143 "NP", // Nepal
144 "NL", // Netherlands
145 "NC", // New Caledonia
146 "NZ", // New Zealand
147 "NI", // Nicaragua
148 "NE", // Niger
149 "NG", // Nigeria
150 "NU", // Niue
151 "NF", // Norfolk Island
152 "MP", // Northern Mariana Islands
153 "NO", // Norway
154 "OM", // Oman
155 "PK", // Pakistan
156 "PW", // Palau
157 "PS", // Palestine
158 "PA", // Panama
159 "PG", // Papua New Guinea
160 "PY", // Paraguay
161 "PE", // Peru
162 "PH", // Philippines
163 "PN", // Pitcairn Islands
164 "PL", // Poland
165 "PT", // Portugal
166 "PR", // Puerto Rico
167 "QA", // Qatar
168 "CY", // Republic of Cyprus
169 "CG", // Republic of the Congo
170 "RO", // Romania
171 "RW", // Rwanda
172 "BL", // Saint Barthélemy
173 "KN", // Saint Kitts and Nevis
174 "LC", // Saint Lucia
175 "PM", // Saint Pierre and Miquelon
176 "VC", // Saint Vincent and the Grenadines
177 "SH", // Saint Helena, Ascension and Tristan da Cunha
178 "WS", // Samoa
179 "ST", // São Tomé and Príncipe
180 "SA", // Saudi Arabia
181 "SN", // Senegal
182 "SC", // Seychelles
183 "SL", // Sierra Leone
184 "SG", // Singapore
185 "SK", // Slovakia
186 "SI", // Slovenia
187 "SB", // Solomon Islands
188 "SO", // Somalia
189 "ZA", // South Africa
190 "GS", // South Georgia and the South Sandwich Islands
191 "KR", // South Korea
192 "SS", // South Sudan
193 "ES", // Spain
194 "LK", // Sri Lanka
195 "SD", // Sudan
196 "SR", // Suriname
197 "SE", // Sweden
198 "CH", // Switzerland
199 "TW", // Taiwan
200 "TJ", // Tajikistan
201 "TZ", // Tanzania
202 "TH", // Thailand
203 "TL", // Timor-Leste
204 "TG", // Togo
205 "TK", // Tokelau
206 "TO", // Tonga
207 "TT", // Trinidad and Tobago
208 "TN", // Tunisia
209 "TR", // Türkiye
210 "TM", // Turkmenistan
211 "TC", // Turks and Caicos Islands
212 "TV", // Tuvalu
213 "UG", // Uganda
214 "GB", // United Kingdom
215 "AE", // United Arab Emirates
216 "US", // United States
217 "UM", // United States Minor Outlying Islands
218 "VI", // U.S. Virgin Islands
219 "UY", // Uruguay
220 "UZ", // Uzbekistan
221 "VU", // Vanuatu
222 "VE", // Venezuela
223 "VN", // Vietnam
224 "WF", // Wallis and Futuna
225 "EH", // Western Sahara
226 "YE", // Yemen
227 "ZM", // Zambia
228 "ZW", // Zimbabwe
229 ]
230 .into_iter()
231 .collect()
232});