﻿je_schleswig_holstein_question = {
	icon = "gfx/interface/icons/event_icons/waving_flag.dds"
	
	group = je_group_historical_content

	is_shown_when_inactive = {
		hidden_trigger = { NOT = { has_global_variable = schleswig_holstein_question_solved } }		
		OR = {
			country_has_primary_culture = cu:north_german
			country_has_primary_culture = cu:south_german
		}
	}

	possible = {
		hidden_trigger = { NOT = { has_global_variable = schleswig_holstein_question_solved } }			
		OR = {
			country_has_primary_culture = cu:north_german
			country_has_primary_culture = cu:south_german
		}			
	}

	complete = {
		trigger_if = {
			limit = {
				OR = {
					c:HOL ?= this
					c:SCH ?= this
				}
			}
			is_subject = no
		}
		trigger_if = {
			limit = {
				NOT = { c:HOL ?= this }
				NOT = { c:SCH ?= this }
				exists = c:DEN
			}
			custom_tooltip = {
				text = je_schleswig_holstein_question_state_ownership_desc
				any_scope_state = { state_region = s:STATE_SCHLESWIG_HOLSTEIN }
				s:STATE_SCHLESWIG_HOLSTEIN = {
					NOT = {
						any_scope_state = {
							OR = {
								NOT = {
									owner = {
										OR = {
											country_has_primary_culture = cu:north_german
											country_has_primary_culture = cu:south_german
										}
									}
								}
								owner = {
									is_subject_of = c:DEN
								}
							}
						}
					}
				}
			}
		}
		trigger_if = {
			limit = {
				c:LUB ?= this
			}
			country_or_subject_owns_entire_state_region = STATE_SCHLESWIG_HOLSTEIN
		}
	}
	
	fail = {
		custom_tooltip = {
			has_global_variable = schleswig_holstein_question_solved
			text = je_schleswig_holstein_question_solved_fail_trigger_desc
		}
		NOT = { has_modifier = schleswig_holstein_question_solver }
	}	

	on_complete = {
		add_modifier = {
			name = schleswig_holstein_question_solver
			months = long_modifier_time
		}	
		hidden_effect = { set_global_variable = schleswig_holstein_question_solved }		
	}
	
	status_desc = {
		first_valid = {
			triggered_desc = { 
				desc = je_schleswig_holstein_question_status
			}
		}
	}

	weight = 1000
	should_be_pinned_by_default = yes
}

je_german_unification_idea = {
	icon = "gfx/interface/icons/event_icons/waving_flag.dds"
	
	group = je_group_historical_content

	is_shown_when_inactive = {
		OR = {
			country_has_primary_culture = cu:north_german
			country_has_primary_culture = cu:south_german
		}
	}

	possible = {
		OR = {
			country_has_primary_culture = cu:north_german
			country_has_primary_culture = cu:south_german
		}	
	}
 
	complete = {		
		any_country = {
			filter = {
				OR = {
					country_has_primary_culture = cu:north_german
					country_has_primary_culture = cu:south_german				
				}
			}
			has_technology_researched = nationalism	
			percent >= 0.75
		}
	}

	on_complete = {
		hidden_effect = {
			if = {
				limit = {
					any_country = { 
						country_rank >= rank_value:great_power 
						OR = {
							AND = {
								country_has_primary_culture = cu:north_german
								root = { country_has_primary_culture = cu:north_german }
							}						
							AND = {
								country_has_primary_culture = cu:south_german
								root = { country_has_primary_culture = cu:south_german }
							}						
						}
					}			
				}			
				random_country = {
					limit = { 
						country_rank >= rank_value:great_power 
						OR = {
							AND = {
								country_has_primary_culture = cu:north_german
								root = { country_has_primary_culture = cu:north_german }
							}						
							AND = {
								country_has_primary_culture = cu:south_german
								root = { country_has_primary_culture = cu:south_german }
							}						
						}					
					}
					save_scope_as = german_unifier_candidate
				}				
			}
			else_if = {
				limit = {
					any_country = { 
						country_rank >= rank_value:great_power 
						OR = {
							country_has_primary_culture = cu:north_german
							country_has_primary_culture = cu:south_german					
						}
					}			
				}			
				random_country = {
					limit = { 
						country_rank >= rank_value:great_power 
						OR = {
							country_has_primary_culture = cu:north_german					
							country_has_primary_culture = cu:south_german						
						}					
					}
					save_scope_as = german_unifier_candidate
				}				
			}
			else_if = {
				limit = {
					any_country = { 
						country_rank >= rank_value:major_power 
						OR = {
							AND = {
								country_has_primary_culture = cu:north_german
								root = { country_has_primary_culture = cu:north_german }
							}						
							AND = {
								country_has_primary_culture = cu:south_german
								root = { country_has_primary_culture = cu:south_german }
							}						
						}
					}			
				}			
				random_country = {
					limit = { 
						country_rank >= rank_value:major_power 
						OR = {
							AND = {
								country_has_primary_culture = cu:north_german
								root = { country_has_primary_culture = cu:north_german }
							}						
							AND = {
								country_has_primary_culture = cu:south_german
								root = { country_has_primary_culture = cu:south_german }
							}						
						}					
					}
					save_scope_as = german_unifier_candidate
				}				
			}	
			else_if = {
				limit = {
					any_country = { 
						country_rank >= rank_value:major_power 
						OR = {
							country_has_primary_culture = cu:north_german
							country_has_primary_culture = cu:south_german					
						}
					}			
				}			
				random_country = {
					limit = { 
						country_rank >= rank_value:major_power 
						OR = {
							country_has_primary_culture = cu:north_german					
							country_has_primary_culture = cu:south_german						
						}					
					}
					save_scope_as = german_unifier_candidate
				}				
			}			
		}	
		
		hidden_effect = { set_variable = je_german_unification_idea }
		trigger_event = { id = german_unification.5 } # German National Identity
	}

	status_desc = {
		first_valid = {
			triggered_desc = { 
				desc = je_german_unification_idea_status
			}
		}
	}

	weight = 1000
	should_be_pinned_by_default = yes
}

je_north_german_unification = {
	icon = "gfx/interface/icons/event_icons/waving_flag.dds"
	
	group = je_group_historical_content
	
	complete = {
		custom_tooltip = {
			has_global_variable = schleswig_holstein_question_solved
			text = je_schleswig_holstein_question_solved_trigger_desc
		}
		hidden_trigger = {
			has_variable = je_unification_progress
		}	
		has_technology_researched = nationalism
		is_unification_candidate = GER
		custom_tooltip = {
			text = je_german_unification_sole_candidate_trigger_desc
			NOT = {
				any_country = {
					NOT = { this = root }				
					is_unification_candidate = GER
				}
			}	
		}				
	}

	on_monthly_pulse = {
		events = {
			german_unification.3 # Bismarck
		}
	
		effect = {
			if = { 
				limit = { NOT = { has_variable = je_unification_progress } } 
				set_variable = je_unification_progress
			}
		}	
	}

	on_complete = {
		trigger_event = { id = german_unification.1 } # North German Confederation
		remove_variable = je_unification_progress
	}

	status_desc = {
		first_valid = {
			triggered_desc = { 
				desc = je_north_german_status
			}
		}
	}

	weight = 1000
	should_be_pinned_by_default = yes
}

je_south_german_unification = {
	icon = "gfx/interface/icons/event_icons/waving_flag.dds"
	
	group = je_group_historical_content

	complete = {
		custom_tooltip = {
			has_global_variable = schleswig_holstein_question_solved
			text = je_schleswig_holstein_question_solved_trigger_desc
		}	
		hidden_trigger = {
			has_variable = je_unification_progress
		}	
		has_technology_researched = nationalism
		is_unification_candidate = GER
		custom_tooltip = {
			text = je_german_unification_sole_candidate_trigger_desc
			NOT = {
				any_country = {
					NOT = { this = root }				
					is_unification_candidate = GER
				}
			}	
		}	
	}

	on_monthly_pulse = {
		effect = {
			if = { 
				limit = { NOT = { has_variable = je_unification_progress } } 
				set_variable = je_unification_progress
			}
		}
	}

	on_complete = {
		trigger_event = { id = german_unification.1 } # South German Confederation
		remove_variable = je_unification_progress
	}

	status_desc = {
		first_valid = {
			triggered_desc = {
				desc = je_south_german_status
				trigger = {
					always = yes
				}
			}
		}
	}

	weight = 1000
	should_be_pinned_by_default = yes
}

je_german_unification = {
	icon = "gfx/interface/icons/event_icons/waving_flag.dds"
	
	group = je_group_historical_content

	is_shown_when_inactive = {
		has_variable = je_german_confederate_unifier
	}

	possible = {
		hidden_trigger = { has_variable = je_german_confederate_unifier }
		country_rank >= rank_value:major_power
		has_technology_researched = pan-nationalism
		is_subject = no
	}

	complete = {
		custom_tooltip = {
			c:GER ?= this
			text = je_german_unification_complete_trigger_desc
		}	
	}

	on_complete = {
		show_as_tooltip = {
			trigger_event = { id = german_unification.4 popup = yes } # German Unification
		}
		remove_variable = je_unification_progress
	}

	status_desc = {
		first_valid = {
			triggered_desc = {
				desc = je_german_status
			}
		}
	}

	invalid = {
		OR = {
			country_has_primary_culture = cu:hungarian
			c:HRE ?= THIS
		}
	}

	weight = 1000
	should_be_pinned_by_default = yes
}
