tiger-lib 1.17.0

Library used by the tools ck3-tiger, vic3-tiger, and imperator-tiger. This library holds the bulk of the code for them. It can be built either for ck3-tiger with the feature ck3, or for vic3-tiger with the feature vic3, or for imperator-tiger with the feature imperator, but not both at the same time.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
#![allow(unused_imports)] // TODO EU5: remove this when ready
use std::sync::LazyLock;

use crate::helpers::TigerHashMap;
use crate::scopes::{ArgumentValue, Scopes};

#[inline]
pub fn scope_to_scope(name: &str) -> Option<(Scopes, Scopes)> {
    SCOPE_TO_SCOPE_MAP.get(name).copied()
}

static SCOPE_TO_SCOPE_MAP: LazyLock<TigerHashMap<&'static str, (Scopes, Scopes)>> =
    LazyLock::new(|| {
        let mut hash = TigerHashMap::default();
        for (from, s, to) in SCOPE_TO_SCOPE.iter().copied() {
            hash.insert(s, (from, to));
        }
        hash
    });

/// See `event_targets.log` from the game data dumps
/// These are scope transitions that can be chained like `root.joined_faction.faction_leader`
const SCOPE_TO_SCOPE: &[(Scopes, &str, Scopes)] = &[
    // TODO: EU5 verify the autogenerated table and the entries with Scopes::all() scopes
    (Scopes::Country, "active_mission", Scopes::Mission),
    (
        Scopes::Location
            .union(Scopes::Province)
            .union(Scopes::ProvinceDefinition)
            .union(Scopes::Privateer)
            .union(Scopes::Exploration),
        "area",
        Scopes::Area,
    ),
    (Scopes::War, "attacker_leader", Scopes::Country),
    (Scopes::Country, "autocephalous_patriarchate", Scopes::InternationalOrganization),
    (Scopes::HolySite, "avatar", Scopes::Avatar),
    (Scopes::Character, "birth_location", Scopes::Location),
    (Scopes::Loan, "borrower", Scopes::Country),
    (Scopes::BuildingType, "building_base_cost_in_gold", Scopes::Value),
    (Scopes::Building, "building_type", Scopes::BuildingType),
    (Scopes::Character.union(Scopes::Cabinet), "cabinet_action", Scopes::CabinetAction),
    (Scopes::Cabinet, "cabinet_member", Scopes::Character),
    (Scopes::Trade, "capacity_market", Scopes::Market),
    (
        Scopes::Country.union(Scopes::Dynasty).union(Scopes::Province).union(Scopes::Area),
        "capital",
        Scopes::Location,
    ),
    (Scopes::Location, "cardinal", Scopes::Cardinal),
    (Scopes::War, "casus_belli", Scopes::CasusBelli),
    (Scopes::Country, "civil_war", Scopes::War),
    (Scopes::Country, "civil_war_opponent", Scopes::Country),
    (Scopes::Location.union(Scopes::Unit).union(Scopes::CombatSide), "combat", Scopes::Combat),
    (Scopes::Combat, "combat_attacker", Scopes::CombatSide),
    (Scopes::Combat, "combat_defender", Scopes::CombatSide),
    (Scopes::CombatSide, "commander", Scopes::Country),
    (Scopes::CombatSide, "commanding_country", Scopes::Country),
    (Scopes::all(), "compare_date", Scopes::Date),
    (Scopes::all(), "compare_value", Scopes::Value),
    (Scopes::Country, "consort", Scopes::Character),
    (
        Scopes::Location
            .union(Scopes::Province)
            .union(Scopes::ProvinceDefinition)
            .union(Scopes::Area)
            .union(Scopes::Region)
            .union(Scopes::SubContinent),
        "continent",
        Scopes::Continent,
    ),
    (Scopes::Location.union(Scopes::SubUnit), "controller", Scopes::Country),
    (Scopes::Country, "country_color", Scopes::Color),
    (Scopes::Country, "country_rank", Scopes::CountryRank),
    (Scopes::Country, "country_stance", Scopes::MilitaryStance),
    (Scopes::Country, "court_dialect", Scopes::Dialect),
    (Scopes::Country, "court_language", Scopes::Language),
    (Scopes::WorkOfArt, "creator", Scopes::Character),
    (
        Scopes::Country
            .union(Scopes::SubUnit)
            .union(Scopes::Character)
            .union(Scopes::Dynasty)
            .union(Scopes::Pop)
            .union(Scopes::Rebels)
            .union(Scopes::Mercenary),
        "culture",
        Scopes::Culture,
    ),
    (Scopes::Country, "current_mission_task", Scopes::MissionTask),
    (Scopes::Mercenary, "customer", Scopes::Country),
    (Scopes::War, "defender_leader", Scopes::Country),
    (
        Scopes::Character
            .union(Scopes::Dynasty)
            .union(Scopes::Pop)
            .union(Scopes::Culture)
            .union(Scopes::Religion)
            .union(Scopes::Market),
        "dialect",
        Scopes::Dialect,
    ),
    (Scopes::Disaster, "disaster_type", Scopes::DisasterType),
    (Scopes::DiseaseOutbreak, "disease", Scopes::Disease),
    (Scopes::Culture, "dominant_country", Scopes::Country),
    (
        Scopes::Location.union(Scopes::Country).union(Scopes::Province),
        "dominant_culture",
        Scopes::Culture,
    ),
    (Scopes::Location.union(Scopes::Country), "dominant_dialect", Scopes::Dialect),
    (Scopes::Location.union(Scopes::Country), "dominant_language", Scopes::Language),
    (
        Scopes::Location.union(Scopes::Country).union(Scopes::Province),
        "dominant_religion",
        Scopes::Religion,
    ),
    (Scopes::Country, "dominant_upper_class_culture", Scopes::Culture),
    (Scopes::Character, "dynasty", Scopes::Dynasty),
    (Scopes::Dynasty, "dynasty_head", Scopes::Character),
    (Scopes::Dynasty, "dynasty_home", Scopes::Location),
    (Scopes::Character, "employer", Scopes::Country),
    (Scopes::CombatSide, "enemy_side", Scopes::CombatSide),
    (Scopes::Estate, "estate_tax_base", Scopes::Value),
    (
        Scopes::Character
            .union(Scopes::Pop)
            .union(Scopes::Rebels)
            .union(Scopes::Building)
            .union(Scopes::EstatePrivilege)
            .union(Scopes::ParliamentIssue)
            .union(Scopes::Estate),
        "estate_type",
        Scopes::EstateType,
    ),
    (Scopes::Character, "ethnicity", Scopes::Ethnicity),
    (Scopes::Character, "exploration", Scopes::Exploration),
    (Scopes::Character, "father", Scopes::Character),
    (Scopes::Character, "first_spouse", Scopes::Character),
    (Scopes::Trade, "from_market", Scopes::Market),
    (Scopes::Culture, "gfx_culture", Scopes::GraphicalCulture),
    (Scopes::HolySite.union(Scopes::Avatar), "god", Scopes::God),
    (Scopes::Country, "government_type", Scopes::Government),
    (Scopes::Religion, "group", Scopes::Group),
    (Scopes::Country, "heir", Scopes::Character),
    (Scopes::God.union(Scopes::Avatar), "holy_site", Scopes::HolySite),
    (Scopes::InternationalOrganization, "international_organization_target", Scopes::Country),
    (
        Scopes::InternationalOrganization,
        "international_organization_type",
        Scopes::InternationalOrganizationType,
    ),
    (Scopes::InternationalOrganization, "land_ownership_rule", Scopes::LandOwnershipRule),
    (
        Scopes::Country
            .union(Scopes::SubUnit)
            .union(Scopes::Character)
            .union(Scopes::Dynasty)
            .union(Scopes::Culture)
            .union(Scopes::Religion)
            .union(Scopes::Market)
            .union(Scopes::Dialect),
        "language",
        Scopes::Language,
    ),
    (Scopes::Language, "language_family", Scopes::LanguageFamily),
    (Scopes::Location, "last_dynasty_in_location", Scopes::Dynasty),
    (Scopes::InternationalOrganization, "last_leader_country", Scopes::Country),
    (Scopes::Country, "last_valid_ruler", Scopes::Character),
    (Scopes::Policy, "law", Scopes::Law),
    (Scopes::Unit.union(Scopes::Exploration), "leader", Scopes::Character),
    (Scopes::InternationalOrganization, "leader_country", Scopes::Country),
    (Scopes::InternationalOrganization, "leadership_election_resolution", Scopes::Resolution),
    (Scopes::CombatSide, "leading_unit", Scopes::Unit),
    (Scopes::Country, "liturgical_dialect", Scopes::Dialect),
    (Scopes::Country, "liturgical_language", Scopes::Language),
    (
        Scopes::Character
            .union(Scopes::Pop)
            .union(Scopes::Combat)
            .union(Scopes::Siege)
            .union(Scopes::Market)
            .union(Scopes::Exploration)
            .union(Scopes::WorkOfArt)
            .union(Scopes::HolySite)
            .union(Scopes::Building)
            .union(Scopes::Cardinal),
        "location",
        Scopes::Location,
    ),
    (Scopes::Location, "location_rank", Scopes::LocationRank),
    (Scopes::Country, "low_control_best_tax_base", Scopes::Province),
    (Scopes::Location, "market", Scopes::Market),
    (Scopes::Country, "marriage_union", Scopes::InternationalOrganization),
    (Scopes::all(), "max_great_powers", Scopes::Value),
    (Scopes::Mercenary, "mercenary_home", Scopes::Location),
    (Scopes::Market, "most_powerful_merchant", Scopes::Country),
    (Scopes::Character, "mother", Scopes::Character),
    (Scopes::SubUnit, "name_culture", Scopes::Culture),
    (Scopes::all(), "named_script_value", Scopes::Value.union(Scopes::Color)),
    (Scopes::None, "no", Scopes::Bool),
    (
        Scopes::WorkOfArt
            .union(Scopes::Institution)
            .union(Scopes::DiseaseOutbreak)
            .union(Scopes::Disease),
        "origin",
        Scopes::Location,
    ),
    (Scopes::Disease, "original_outbreak", Scopes::DiseaseOutbreak),
    (Scopes::Country, "overlord", Scopes::Country),
    (
        Scopes::Location
            .union(Scopes::Unit)
            .union(Scopes::SubUnit)
            .union(Scopes::Character)
            .union(Scopes::Pop)
            .union(Scopes::ColonialCharter)
            .union(Scopes::Market)
            .union(Scopes::Province)
            .union(Scopes::Rebels)
            .union(Scopes::Trade)
            .union(Scopes::Privateer)
            .union(Scopes::Exploration)
            .union(Scopes::Mercenary)
            .union(Scopes::WorkOfArt)
            .union(Scopes::Loan)
            .union(Scopes::Building)
            .union(Scopes::Disaster)
            .union(Scopes::Cabinet)
            .union(Scopes::Cardinal)
            .union(Scopes::Estate),
        "owner",
        Scopes::Country,
    ),
    (Scopes::SubUnit, "owning_unit", Scopes::Unit),
    (
        Scopes::Country.union(Scopes::InternationalOrganization),
        "parliament_issue",
        Scopes::ParliamentIssue,
    ),
    (Scopes::Country.union(Scopes::InternationalOrganization), "parliament_seat", Scopes::Location),
    (
        Scopes::Country.union(Scopes::InternationalOrganization),
        "parliament_type",
        Scopes::ParliamentType,
    ),
    (Scopes::Pop, "pop_type", Scopes::PopType),
    (Scopes::None, "prev", Scopes::all()),
    (Scopes::Location, "previous_owner", Scopes::Country),
    (Scopes::Country, "previous_ruler", Scopes::Character),
    (Scopes::Policy, "price", Scopes::Price),
    (Scopes::ProductionMethod, "produced_goods", Scopes::Goods),
    (Scopes::Location, "province", Scopes::Province),
    (Scopes::Province, "province_capital", Scopes::Location),
    (
        Scopes::Location.union(Scopes::ColonialCharter).union(Scopes::Province),
        "province_definition",
        Scopes::ProvinceDefinition,
    ),
    (Scopes::Location, "raw_material", Scopes::Goods),
    (Scopes::Location, "raw_material_location", Scopes::Goods),
    (Scopes::Character.union(Scopes::Pop), "rebel", Scopes::Rebels),
    (Scopes::Country, "regency_type", Scopes::RegencyType),
    (Scopes::Country, "regent", Scopes::Character),
    (
        Scopes::Location
            .union(Scopes::Province)
            .union(Scopes::ProvinceDefinition)
            .union(Scopes::Area),
        "region",
        Scopes::Region,
    ),
    (
        Scopes::Country
            .union(Scopes::SubUnit)
            .union(Scopes::Character)
            .union(Scopes::Dynasty)
            .union(Scopes::Pop)
            .union(Scopes::Rebels)
            .union(Scopes::Mercenary),
        "religion",
        Scopes::Religion,
    ),
    (Scopes::Religion, "religious_head", Scopes::Country),
    (Scopes::Country.union(Scopes::Character), "religious_school", Scopes::ReligiousSchool),
    (Scopes::ActiveResolution, "resolution", Scopes::Resolution),
    (Scopes::ActiveResolution, "resolution_proposer", Scopes::Country),
    (Scopes::all(), "revolutionary_target", Scopes::Country),
    (Scopes::None, "root", Scopes::all()),
    (Scopes::Country, "ruler", Scopes::Character),
    (Scopes::Country, "ruler_or_heir_if_regent", Scopes::Character),
    (Scopes::Country, "ruler_or_regent", Scopes::Character),
    (Scopes::Location, "sea_zone", Scopes::Location),
    (Scopes::Location, "second_best_market", Scopes::Market),
    (Scopes::Location, "secondary_culture", Scopes::Culture),
    (Scopes::Location, "secondary_otherwise_primary_culture", Scopes::Culture),
    (Scopes::Location.union(Scopes::Unit), "siege", Scopes::Siege),
    (Scopes::Siege, "siege_defender", Scopes::Country),
    (Scopes::Siege, "siege_main_attacker", Scopes::Country),
    (Scopes::ColonialCharter, "source_province", Scopes::Province),
    (Scopes::ParliamentIssue, "special_status", Scopes::SpecialStatus),
    (
        Scopes::Location
            .union(Scopes::Province)
            .union(Scopes::ProvinceDefinition)
            .union(Scopes::Area)
            .union(Scopes::Region),
        "sub_continent",
        Scopes::SubContinent,
    ),
    (Scopes::SubUnit, "sub_unit_category", Scopes::SubUnitCategory),
    (Scopes::Country, "subject_type", Scopes::SubjectType),
    (Scopes::SubUnit, "subunit_home", Scopes::Location),
    (Scopes::Country, "succession_law", Scopes::HeirSelection),
    (Scopes::all(), "this", Scopes::all()),
    (Scopes::Trade, "to_market", Scopes::Market),
    (Scopes::Country, "top_overlord", Scopes::Country),
    (Scopes::Country, "top_overlord_or_this", Scopes::Country),
    (Scopes::Location, "top_owner", Scopes::Country),
    (Scopes::Trade, "traded_goods", Scopes::Goods),
    (Scopes::Country, "union", Scopes::InternationalOrganization),
    (Scopes::Character, "unit", Scopes::Unit),
    (Scopes::Unit, "unit_destination", Scopes::Location),
    (Scopes::Unit, "unit_location", Scopes::Location),
    (Scopes::Unit, "unit_next_location", Scopes::Location),
    (Scopes::ProductionMethod, "upgrade_demand", Scopes::Demand),
    (Scopes::None, "value", Scopes::Value),
    (Scopes::WorkOfArt, "work_of_art_type", Scopes::WorkOfArtType),
    (Scopes::None, "yes", Scopes::Bool),
];

#[inline]
pub fn scope_prefix(name: &str) -> Option<(Scopes, Scopes, ArgumentValue)> {
    SCOPE_PREFIX_MAP.get(name).copied()
}

static SCOPE_PREFIX_MAP: LazyLock<TigerHashMap<&'static str, (Scopes, Scopes, ArgumentValue)>> =
    LazyLock::new(|| {
        let mut hash = TigerHashMap::default();
        for (from, s, to, argument) in SCOPE_PREFIX.iter().copied() {
            hash.insert(s, (from, to, argument));
        }
        hash
    });

/// See `event_targets.log` from the game data dumps
/// These are absolute scopes (like character:100000) and scope transitions that require
/// a key (like `root.cp:councillor_steward`)
const SCOPE_PREFIX: &[(Scopes, &str, Scopes, ArgumentValue)] = {
    use crate::item::Item;
    use ArgumentValue::*;
    &[
        // TODO: EU5 fill in the UncheckedValue entries and the entries with Scopes::all() scopes
        (
            Scopes::Location.union(Scopes::SubUnit),
            "active_outbreak",
            Scopes::DiseaseOutbreak,
            UncheckedValue,
        ),
        (
            Scopes::InternationalOrganization.union(Scopes::Situation),
            "active_resolution",
            Scopes::ActiveResolution,
            UncheckedValue,
        ),
        (Scopes::all(), "advance_type", Scopes::AdvanceType, UncheckedValue),
        (Scopes::all(), "age", Scopes::Age, UncheckedValue),
        (Scopes::all(), "area", Scopes::Area, UncheckedValue),
        (Scopes::Area, "area_exploration", Scopes::Exploration, UncheckedValue),
        (Scopes::None, "array_define", Scopes::Value, UncheckedValue),
        (Scopes::all(), "artist_type", Scopes::ArtistType, UncheckedValue),
        (Scopes::all(), "avatar", Scopes::Avatar, UncheckedValue),
        (Scopes::all(), "bias_value", Scopes::Value, UncheckedValue),
        (Scopes::Location, "building", Scopes::Building, UncheckedValue),
        (Scopes::all(), "building_type", Scopes::BuildingType, UncheckedValue),
        (Scopes::all(), "c", Scopes::Country, UncheckedValue),
        (Scopes::all(), "cabinet_action", Scopes::CabinetAction, UncheckedValue),
        (Scopes::ActiveResolution, "cast_vote_in_active_resolution", Scopes::all(), UncheckedValue),
        (Scopes::all(), "casus_belli", Scopes::CasusBelli, UncheckedValue),
        (Scopes::all(), "character", Scopes::Character, UncheckedValue),
        (Scopes::all(), "character_interaction", Scopes::CharacterInteraction, UncheckedValue),
        (Scopes::all(), "child_education", Scopes::ChildEducation, UncheckedValue),
        (Scopes::all(), "climate", Scopes::Climate, UncheckedValue),
        (Scopes::all(), "compare_complex_value", Scopes::Value, UncheckedValue),
        (Scopes::all(), "continent", Scopes::Continent, UncheckedValue),
        (Scopes::all(), "country_interaction", Scopes::CountryInteraction, UncheckedValue),
        (Scopes::all(), "country_rank", Scopes::CountryRank, UncheckedValue),
        (Scopes::Country, "country_rank_on_date", Scopes::CountryRank, UncheckedValue),
        (Scopes::all(), "culture", Scopes::Culture, UncheckedValue),
        (Scopes::all(), "culture_group", Scopes::CultureGroup, UncheckedValue),
        (Scopes::all(), "default_price", Scopes::Value, UncheckedValue),
        (
            Scopes::None,
            "define",
            Scopes::Value.union(Scopes::Color).union(Scopes::Date),
            UncheckedValue,
        ),
        (Scopes::all(), "demand", Scopes::Demand, UncheckedValue),
        (Scopes::all(), "dialect", Scopes::Dialect, UncheckedValue),
        (Scopes::all(), "disaster_type", Scopes::DisasterType, UncheckedValue),
        (Scopes::all(), "disease", Scopes::Disease, UncheckedValue),
        (Scopes::all(), "dynasty", Scopes::Dynasty, UncheckedValue),
        (Scopes::all(), "employment_system", Scopes::EmploymentSystem, UncheckedValue),
        (Scopes::Country, "estate", Scopes::Estate, UncheckedValue),
        (Scopes::Country, "estate_power", Scopes::Value, UncheckedValue),
        (Scopes::all(), "estate_privilege", Scopes::EstatePrivilege, UncheckedValue),
        (Scopes::Country, "estate_satisfaction", Scopes::Value, UncheckedValue),
        (Scopes::Country, "estate_target_satisfaction", Scopes::Value, UncheckedValue),
        (Scopes::Country, "estate_tax_base", Scopes::Value, UncheckedValue),
        (Scopes::Country, "estate_tax_percentage", Scopes::Value, UncheckedValue),
        (Scopes::all(), "estate_type", Scopes::EstateType, UncheckedValue),
        (Scopes::all(), "ethnicity", Scopes::Ethnicity, UncheckedValue),
        (Scopes::None, "flag", Scopes::Flag, UncheckedValue),
        (Scopes::all(), "formable_country", Scopes::FormableCountry, UncheckedValue),
        (Scopes::all(), "generic_action", Scopes::GenericAction, UncheckedValue),
        (Scopes::all(), "gfx_culture", Scopes::GraphicalCulture, UncheckedValue),
        (Scopes::None, "global_var", Scopes::all(), UncheckedValue),
        (Scopes::all(), "god", Scopes::God, UncheckedValue),
        (Scopes::all(), "goods", Scopes::Goods, UncheckedValue),
        (Scopes::all(), "government_reform", Scopes::GovernmentReform, UncheckedValue),
        (Scopes::all(), "government_type", Scopes::Government, UncheckedValue),
        (Scopes::all(), "hegemony", Scopes::Hegemony, UncheckedValue),
        (Scopes::all(), "heir_selection", Scopes::HeirSelection, UncheckedValue),
        (Scopes::all(), "holy_site_definition", Scopes::HolySiteDefinition, UncheckedValue),
        (Scopes::all(), "holy_site_type", Scopes::HolySiteType, UncheckedValue),
        (Scopes::None, "institution", Scopes::Institution, UncheckedValue),
        (Scopes::Location, "institution_progress", Scopes::Value, UncheckedValue),
        (Scopes::Cabinet, "interaction_target", Scopes::all(), UncheckedValue),
        (
            Scopes::all(),
            "international_organization",
            Scopes::InternationalOrganization,
            UncheckedValue,
        ),
        (
            Scopes::all(),
            "international_organization_type",
            Scopes::InternationalOrganizationType,
            UncheckedValue,
        ),
        (Scopes::Country, "known_in_country", Scopes::Value, UncheckedValue),
        (Scopes::all(), "land_ownership_rule", Scopes::LandOwnershipRule, UncheckedValue),
        (Scopes::all(), "language", Scopes::Language, UncheckedValue),
        (Scopes::all(), "language_family", Scopes::LanguageFamily, UncheckedValue),
        (Scopes::all(), "law", Scopes::Law, UncheckedValue),
        (
            Scopes::Country.union(Scopes::InternationalOrganization),
            "law_policy",
            Scopes::Policy,
            UncheckedValue,
        ),
        (Scopes::InternationalOrganization, "leader_at_index", Scopes::Character, UncheckedValue),
        (Scopes::all(), "levy_setup", Scopes::LevySetup, UncheckedValue),
        (Scopes::None, "local_var", Scopes::all(), UncheckedValue),
        (Scopes::all(), "location", Scopes::Location, UncheckedValue),
        (Scopes::all(), "location_rank", Scopes::LocationRank, UncheckedValue),
        (Scopes::Market, "market_price", Scopes::Value, UncheckedValue),
        (Scopes::all(), "mission", Scopes::Mission, UncheckedValue),
        (Scopes::all(), "mission_task", Scopes::MissionTask, UncheckedValue),
        (
            Scopes::Location
                .union(Scopes::Country)
                .union(Scopes::Unit)
                .union(Scopes::Character)
                .union(Scopes::Religion)
                .union(Scopes::Province)
                .union(Scopes::InternationalOrganization),
            "modifier",
            Scopes::Value.union(Scopes::Bool),
            UncheckedValue,
        ),
        (Scopes::Country, "num_estate_privileges", Scopes::Value, UncheckedValue),
        (Scopes::Country, "num_location_rank", Scopes::Value, UncheckedValue),
        (Scopes::Location, "num_pop_type", Scopes::Value, UncheckedValue),
        (Scopes::Country, "num_pop_type_in_country", Scopes::Value, UncheckedValue),
        (Scopes::Province, "num_pop_type_in_province", Scopes::Value, UncheckedValue),
        (Scopes::Country, "num_possible_estate_privileges", Scopes::Value, UncheckedValue),
        (Scopes::all(), "parliament_agenda", Scopes::ParliamentAgenda, UncheckedValue),
        (Scopes::all(), "parliament_issue", Scopes::ParliamentIssue, UncheckedValue),
        (Scopes::all(), "parliament_type", Scopes::ParliamentType, UncheckedValue),
        (Scopes::all(), "payment", Scopes::Payment, UncheckedValue),
        (Scopes::all(), "peace_treaty", Scopes::PeaceTreaty, UncheckedValue),
        (Scopes::Country, "percentage_pop_type_in_country", Scopes::Value, UncheckedValue),
        (Scopes::Location, "percentage_pop_type_in_location", Scopes::Value, UncheckedValue),
        (Scopes::all(), "policy", Scopes::Policy, UncheckedValue),
        (Scopes::all(), "pop_type", Scopes::PopType, UncheckedValue),
        (Scopes::all(), "price", Scopes::Price, UncheckedValue),
        (Scopes::Country, "produced_in_country", Scopes::Value, UncheckedValue),
        (Scopes::Market, "produced_in_market", Scopes::Value, UncheckedValue),
        (Scopes::all(), "produced_in_world", Scopes::Value, UncheckedValue),
        (Scopes::all(), "production_method", Scopes::ProductionMethod, UncheckedValue),
        (Scopes::Country, "province", Scopes::Province, UncheckedValue),
        (Scopes::all(), "province_definition", Scopes::ProvinceDefinition, UncheckedValue),
        (Scopes::all(), "recruitment_method", Scopes::RecruitmentMethod, UncheckedValue),
        (Scopes::all(), "regency_type", Scopes::RegencyType, UncheckedValue),
        (Scopes::all(), "region", Scopes::Region, UncheckedValue),
        (Scopes::all(), "relation_type", Scopes::RelationType, UncheckedValue),
        (Scopes::all(), "religion", Scopes::Religion, UncheckedValue),
        (Scopes::all(), "religion_group", Scopes::Group, UncheckedValue),
        (Scopes::all(), "religious_aspect", Scopes::ReligiousAspect, UncheckedValue),
        (Scopes::all(), "religious_faction", Scopes::ReligiousFaction, UncheckedValue),
        (Scopes::all(), "religious_figure", Scopes::ReligiousFigure, UncheckedValue),
        (Scopes::all(), "religious_focus", Scopes::ReligiousFocus, UncheckedValue),
        (Scopes::all(), "religious_school", Scopes::ReligiousSchool, UncheckedValue),
        (Scopes::all(), "resolution", Scopes::Resolution, UncheckedValue),
        (Scopes::ActiveResolution, "resolution_target", Scopes::all(), UncheckedValue),
        (Scopes::all(), "resolution_vote", Scopes::all(), UncheckedValue),
        (Scopes::all(), "road_type", Scopes::RoadType, UncheckedValue),
        (Scopes::Character, "rule_end_date", Scopes::Date, UncheckedValue),
        (Scopes::None, "scope", Scopes::all(), UncheckedValue),
        (
            Scopes::all(),
            "scriptable_hint_definition",
            Scopes::ScriptableHintDefinition,
            UncheckedValue,
        ),
        (Scopes::all(), "situation", Scopes::Situation, UncheckedValue),
        (Scopes::Country, "societal_value", Scopes::Value, UncheckedValue),
        (Scopes::all(), "societal_value_type", Scopes::SocietalValueType, UncheckedValue),
        (Scopes::all(), "special_status", Scopes::SpecialStatus, UncheckedValue),
        (Scopes::Market, "stockpile_in_market", Scopes::Value, UncheckedValue),
        (Scopes::all(), "sub_continent", Scopes::SubContinent, UncheckedValue),
        (Scopes::all(), "sub_unit_category", Scopes::SubUnitCategory, UncheckedValue),
        (Scopes::Unit, "sub_unit_count", Scopes::Value, UncheckedValue),
        (Scopes::Unit, "sub_unit_fraction", Scopes::Value, UncheckedValue),
        (Scopes::Unit, "sub_unit_strength", Scopes::Value, UncheckedValue),
        (Scopes::all(), "subject_military_stance", Scopes::MilitaryStance, UncheckedValue),
        (Scopes::all(), "subject_type", Scopes::SubjectType, UncheckedValue),
        (Scopes::Market, "target_price", Scopes::Value, UncheckedValue),
        (Scopes::all(), "topography", Scopes::Topography, UncheckedValue),
        (Scopes::Country, "total_effective_building_levels", Scopes::Value, UncheckedValue),
        (Scopes::Unit, "total_sub_unit_category_in_unit", Scopes::Value, UncheckedValue),
        (Scopes::Country, "total_sub_unit_count", Scopes::Value, UncheckedValue),
        (Scopes::Country, "total_sub_unit_strength", Scopes::Value, UncheckedValue),
        (Scopes::Country, "total_sub_unit_type_count", Scopes::Value, UncheckedValue),
        (Scopes::Unit, "total_sub_unit_type_strength", Scopes::Value, UncheckedValue),
        (Scopes::Market, "traded_in_market", Scopes::Value, UncheckedValue),
        (Scopes::all(), "trait", Scopes::Trait, UncheckedValue),
        (Scopes::all(), "unit_ability", Scopes::UnitAbility, UncheckedValue),
        (Scopes::all(), "unit_type", Scopes::UnitType, UncheckedValue),
        (Scopes::all(), "var", Scopes::all(), UncheckedValue),
        (Scopes::all(), "vegetation", Scopes::Vegetation, UncheckedValue),
        (Scopes::ActiveResolution, "vote_in_active_resolution", Scopes::all(), UncheckedValue),
        (Scopes::Country, "war_with_country", Scopes::War, UncheckedValue),
        (Scopes::all(), "work_of_art", Scopes::WorkOfArt, UncheckedValue),
        (Scopes::all(), "work_of_art_type", Scopes::WorkOfArtType, UncheckedValue),
    ]
};

pub fn scope_to_scope_removed(name: &str) -> Option<(&'static str, &'static str)> {
    for (removed_name, version, explanation) in SCOPE_TO_SCOPE_REMOVED.iter().copied() {
        if name == removed_name {
            return Some((version, explanation));
        }
    }
    None
}

const SCOPE_TO_SCOPE_REMOVED: &[(&str, &str, &str)] = &[];