# Allows you to create your own dynamic keys
# to be called in localization.
# defined_text -> this is it, we're defining the text
# text -> a discrete entry that can be picked to display in loc.
# trigger -> determines if a text entry will be picked or not.
# (The triggers need to be valid for the scope the key is called in
# (eg Root or From.From).)
# localization_key -> points to the localization key
# that'll be used if trigger passes

defined_text = { # Get Description for the Prep category based on ideology
	name = Get_prep_category_description 
	text = {
		trigger = {
			NOR = { has_country_flag = NOR_going_fascist }  			
		}
		localization_key = NOR_democratic_preparation_decisions_category_desc_fascist
	}
	text = {
		trigger = {
			NOR = { has_country_flag = NOR_going_communist }  			
		}
		localization_key = NOR_democratic_preparation_decisions_category_desc_communist
	}
	text = {
		trigger = {
			NOR = { has_country_flag = NOR_going_monarchist }  			
		}
		localization_key = NOR_democratic_preparation_decisions_category_desc_monarchist
	}
	text = {
		trigger = {
			NOR = { has_country_flag = NOR_going_dem_allied }
		}
		localization_key = NOR_democratic_preparation_decisions_category_desc_allied
	}
	text = {
		localization_key = NOR_democratic_preparation_decisions_category_desc_historical
	}
}



defined_text = { # This is so the name of the decision to deploy prep matches what the decision is doing depending on the level. 
	name = get_deploy_prep_decision_name 
	text = {
		trigger = {
			FROM = {
				check_variable = { NOR_state_preparation = 1 }
			}
		}
		localization_key = NOR_decision_defend_state_title
	}
	text = {
		trigger = {
			FROM = {
				check_variable = { NOR_state_preparation = 2 }
			}
		}
		localization_key = NOR_decision_emergency_production_title
	}
	text = {
		trigger = {
			FROM = {
				check_variable = { NOR_state_preparation = 3 }
			}
		}
		localization_key = NOR_decision_deploy_emergency_militias_title
	}
}

defined_text = {
	name = get_deploy_prep_decision_name_fascist
	text = {
		trigger = {
			FROM = {
				check_variable = { NOR_state_preparation = 1 }
			}
		}
		localization_key = NOR_decision_take_over_state_title
	}
	text = {
		trigger = {
			FROM = {
				check_variable = { NOR_state_preparation = 2 }
			}
		}
		localization_key = NOR_decision_industrial_takeover_title
	}
	text = {
		trigger = {
			FROM = {
				check_variable = { NOR_state_preparation = 3 }
			}
		}
		localization_key = NOR_decision_military_takeover_title
	}
}

defined_text = {
	name = get_trotsky_lastname
	text = {
		trigger = {
			ROOT = { original_tag = NOR }
		}
		localization_key = NOR_lastname_trotskij
	}
	text = {
		localization_key = NOR_lastname_trotsky	
	}
}

defined_text = {
	name = NOR_get_air_force_name
	text = {
		trigger = {
			NOR = {
				has_completed_focus = NOR_luftforsvaret
			}
		}
		localization_key = NOR_royal_air_force_name
	}
	text = {
		localization_key = NOR_army_air_force_name
	}
}

defined_text = {
	name = get_NOR_contested_leadership_ns_desc 
	text = {
		trigger = {
			any_country = {
				original_tag = NOR 
				has_government = fascism 
				is_in_faction_with = GER 
			}
		}
		localization_key = NOR_contested_leadership_ns_desc_ger
	}
	text = {
		localization_key = NOR_contested_leadership_ns_desc_generic
	}	
}

defined_text = {
	name = NOR_GetExiledMonarchyLastParagraph
	text = {
		trigger = {
			DEN = {
				exists = yes 
				NOT = { has_country_flag = DEN_depose_the_king }
			}
		}
		localization_key = NOR_exiled_monarchy_to_desc_DEN
	}
	text = {
		trigger = {
			ENG ={
				exists = yes 
				NOT = { has_completed_focus = ENG_the_fate_of_the_royal_family }
			}
		}
		localization_key = NOR_exiled_monarchy_to_desc_ENG
	}
	text = {
		trigger = {
			SWE = {
				exists = yes
				NOT = { has_completed_focus = SWE_liquidate_the_monarchy }
			}	
		}
		localization_key = NOR_exiled_monarchy_to_desc_SWE
	}
	text = {
		localization_key = NOR_exiled_monarchy_to_desc_NONE
	}
}

defined_text = { 
	name = GetRousingProletariatDesc
	text = { # Stalinist-ish
		trigger = {
			has_country_flag = NOR_going_stalinist
			any_other_country = {
				original_tag = SOV 
				has_government = communism 
				NOT = { 
					has_war_with = NOR 
					has_completed_focus = SOV_the_left_opposition
				}

			}
		}
		localization_key = NOR_communist_preparation_decisions_category_desc_stalinist
	}
	text = { # Going Trotsky 
		trigger = {
			has_country_flag = NOR_trotsky_embraced
			has_completed_focus = NOR_prosecute_the_nkp
		}
		localization_key = NOR_communist_preparation_decisions_category_desc_trostkyist
	}
	text = {
		localization_key = NOR_communist_preparation_decisions_category_desc_other
	}
}

defined_text = {
	name = NOR_active_prep_flag_name
	text = {
		trigger = {
			has_country_flag = NOR_going_monarchist
		}
		localization_key = NOR_active_prep_flag_name_monarchist 
	}
	text = {
		localization_key = NOR_active_prep_flag_name_generic
	}
}

defined_text = {
	name = GetNorwegianClaims
	text = { 
		trigger = {
			FROM = { has_country_flag = NOR_claiming_iceland }
		}
		localization_key = GetNorwegianClaims_iceland
	}
	text = { 
		trigger = {
			FROM = { has_country_flag = NOR_claiming_greenland }
		}
		localization_key = GetNorwegianClaims_greenland
	}
	text = { 
		trigger = {
			FROM = { has_country_flag = NOR_claiming_faroes }
		}
		localization_key = GetNorwegianClaims_faroes
	}
	text = { 
		trigger = {
			FROM = { has_country_flag = NOR_claiming_sweden } 
		}
		localization_key = GetNorwegianClaims_sweden
	}
	text = { 
		trigger = {
			FROM = { has_country_flag = NOR_claiming_bjarmeland }
		}
		localization_key = GetNorwegianClaims_bjarmeland
	}
	text = { 
		trigger = {
			FROM = { has_country_flag = NOR_claiming_ireland }
		}
		localization_key = GetNorwegianClaims_ireland
	}
	text = { 
		trigger = {
			FROM = { has_country_flag = NOR_claiming_scotland }
		}
		localization_key = GetNorwegianClaims_scotland
	}
	text = { 
		trigger = {
			FROM = { has_country_flag = NOR_claiming_vinland }
		}
		localization_key = GetNorwegianClaims_vinland
	}
	text = {
		trigger = {
			FROM = {
				has_country_flag = NOR_claiming_denmark
				has_government = fascism
			}
		}
		localization_key = GetNorwegianClaims_denmark
	}
}

defined_text = {
	name = GetNorwegianFascistOverlord
	text = {
		trigger = {
			any_other_country = {
				original_tag = GER
				has_government = fascism
				exists = yes
				NOT = { has_war_with = NOR }
			}
		}
		localization_key = GER_fascism_DEF
	}
	text = {
		trigger = {
			has_variable = NOR.NOR_cw_fascist_attacker
		}
		localization_key = NOR_fascist_attacker_loc
	}
	text = {
		trigger = {
			has_variable = NOR.platonic_local_dangerous_fascist
		}
		localization_key = NOR_local_dangerous_fascist
	}
	text = {
		localization_key = NOR_generic_fascist_ally
	}
}

defined_text = {
	name = GetNorwegianThreateningFascist
	text = {
		trigger = {
			any_other_country = {
				original_tag = GER
				has_government = fascism 
				exists = yes 
				NOT = { is_in_faction_with = ROOT }
			}
		}
		localization_key = GER_fascism_DEF
	}
	text = {
		trigger = {
			has_variable = NOR.platonic_local_dangerous_fascist
		}
		localization_key = NOR_local_dangerous_fascist
	}
	text = {
		localization_key = NOR_generic_fascist_threat
	}
}

defined_text = {
	name = GetCrushStalinName 
	text = {
		trigger = { # Stalin's still around
			NOR_stalin_exists = yes 
		}
		localization_key = NOR_crush_stalin_canonical 
	} 
	text = {
		trigger = { #Stalin is not around but there's a non trotsky soviet union
			any_other_country = { 
				original_tag = SOV
				has_government = communism
				NOT = { has_completed_focus = SOV_the_left_opposition }
				has_capitulated = no
			}
		}
		localization_key = NOR_crush_stalin_generic
	}
	text = {
		trigger = { # Stalin is not around and there's no SOV
			NOT = {
				any_other_country = {
					original_tag = SOV
					has_government = communism
					has_capitulated = no 		
				}
			}
			has_variable = GLOBAL.platonic_big_communist
		}
		localization_key = NOR_crush_big_communist
	}
	text = { # If there's no option it'll revert to Stalin and not be allowed.
		localization_key = NOR_crush_stalin_canonical
	}
}

defined_text = {
	name = NOR_GetSwedishClaimsDesc
	text = {
		trigger = {
			has_country_flag = NOR_going_fascist
		}
		localization_key = NOR_swedish_claims_desc_fas
	}
	text = {
		localization_key = NOR_swedish_claims_desc_mon
	}
}

defined_text = {
	name = NOR_GetDanishClaimsDesc
	text = {
		trigger = {
			has_country_flag = NOR_going_fascist
		}
		localization_key = NOR_claims_on_denmark_desc_fasc
	}
	text = {
		localization_key = NOR_claims_on_denmark_desc_mon
	}
}
defined_text = {
	name = GetConsolidateKingdomDesc 
	text = {
		trigger = {
			has_country_leader = {
				character = NOR_queen_mathilde_i
				ruling_only = yes 
			}
		}
		localization_key = NOR_consolidate_kingdom_desc_alt
	}
	text = {
		localization_key = NOR_consolidate_kingdom_desc_PAWJ
	}
}

defined_text = {
	name = NOR_GetOurRoyalClaimsDesc 
	text = {
		trigger = {
			has_country_leader = {
				character = NOR_queen_mathilde_i
				ruling_only = yes 
			}
		}
		localization_key = NOR_our_royal_claims_desc_queen
	}
	text = {
		localization_key = NOR_our_royal_claims_desc_king
	}
}

defined_text = {
	name = NOR_GetIcelandClaimDesc 
	text = {
		trigger = {
			has_country_leader = {
				character = NOR_queen_mathilde_i
				ruling_only = yes 
			}
		}
		localization_key = NOR_iceland_desc_ALT
	}
	text = {
		localization_key = NOR_iceland_desc_PAWJ
	}
}

defined_text = {
	name = NOR_GetFaroeClaimsDesc 
	text = {
		trigger = {
			has_country_leader = {
				character = NOR_queen_mathilde_i
				ruling_only = yes 
			}
		}
		localization_key = NOR_claims_on_faroe_islands_desc_ALT
	}
	text = {
		localization_key = NOR_claims_on_faroe_islands_desc_PAWJ
	}
}
