﻿je_french_natural_borders = {
	icon = "gfx/interface/icons/event_icons/bicorne_hat.dds"

	group = je_group_historical_content

	is_shown_when_inactive = {
		exists = c:FRA
		this = c:FRA
		has_dlc_feature = voice_of_the_people_content
	}

	possible = {
		has_technology_researched = nationalism
		any_interest_group = {
			is_powerful = yes
			is_in_government = yes
			leader = {
				OR = {
					has_ideology = ideology:ideology_jingoist_leader
					has_ideology = ideology:ideology_ethno_nationalist
					has_ideology = ideology:ideology_fascist
					has_ideology = ideology:ideology_integralist
					has_ideology = ideology:ideology_bonapartist
				}
			}
		}
	}

	immediate = {
		trigger_event = { id = natural_borders.1 popup = yes }
	}

	complete = {
		is_at_war = no
		custom_tooltip = {
			text = own_all_french_homelands
			NOT = {
				any_state = {
					state_region = {
						is_homeland = cu:french
					}
					NOT = { owner = ROOT }
				}
			}
		}
		any_scope_state = {
			state_region = s:STATE_WALLONIA
			is_incorporated = yes
			is_split_state = no
		}
		any_scope_state = {
			state_region = s:STATE_FLANDERS
			is_incorporated = yes
			is_split_state = no
		}
		any_scope_state = {
			state_region = s:STATE_RHINELAND
			is_incorporated = yes
			is_split_state = no
		}
		any_scope_state = {
			state_region = s:STATE_NORTH_RHINE
			is_incorporated = yes
			is_split_state = no
		}
	}

	on_complete = {
		set_variable = completed_natural_borders_je
		trigger_event = { id = natural_borders.2 popup = yes }
	}

	invalid = {
		has_variable = reject_natural_borders
	}

	should_be_pinned_by_default = yes

	weight = 100
}

je_confederation_of_the_rhine = {
	icon = "gfx/interface/icons/event_icons/waving_flag.dds"

	group = je_group_foreign_affairs

	is_shown_when_inactive = {
		OR = {
			any_subject_or_below = {
				capital = {
					OR = {
						region = sr:region_rhine
						region = sr:region_north_germany
						region = sr:region_south_germany
					}
				}
			}
			any_scope_state = {
				state_region = {
					OR = {
						is_homeland = cu:south_german
						is_homeland = cu:north_german
					}
				}
				OR = {
					region = sr:region_rhine
					region = sr:region_north_germany
					region = sr:region_south_germany
				}
				is_incorporated = no
				NOT = {
					ROOT = {
						has_claim = prev.state_region
					}
				}
			}
		}
		NOR = {
			country_has_primary_culture = cu:north_german
			country_has_primary_culture = cu:south_german
		}
	}

	possible = {
		country_rank >= rank_value:great_power
		any_state = {
			OR = {
				region = sr:region_rhine
				region = sr:region_north_germany
				region = sr:region_south_germany
			}
			state_region = {
				OR = {
					is_homeland = cu:south_german
					is_homeland = cu:north_german
				}
			}
			OR = {
				owner = {
					is_subject_of = ROOT
					NOT = {
						has_diplomatic_pact = {
							who = ROOT
							type = personal_union
							is_initiator = no
						}
					}
					capital = {
						OR = {
							region = sr:region_rhine
							region = sr:region_north_germany
							region = sr:region_south_germany
						}
					}
					OR = {
						country_has_primary_culture = cu:north_german
						country_has_primary_culture = cu:south_german
					}
				}
				owner = ROOT
			}
			count >= 4
		}
	}

	immediate = {
		save_scope_as = rhine_overlord
		cu:north_german = {
			save_scope_as = north_german_scope
		}
		cu:south_german = {
			save_scope_as = south_german_scope
		}
	}

	scripted_button = je_confederation_of_the_rhine_confederate_button
	scripted_button = je_confederation_of_the_rhine_expand_button

	invalid = {
		NOR = {
			any_country = {
				is_subject_of = ROOT
				capital = {
					OR = {
						region = sr:region_rhine
						region = sr:region_north_germany
						region = sr:region_south_germany
					}
				}
			}
			any_scope_state = {
				state_region = {
					OR = {
						is_homeland = cu:south_german
						is_homeland = cu:north_german
					}
				}
				OR = {
					region = sr:region_rhine
					region = sr:region_north_germany
					region = sr:region_south_germany
				}
				is_incorporated = no
			}
		}
	}

	complete = {
		custom_tooltip = {
			text = no_german_great_powers_tt
			NOT = {
				any_country = {
					OR = {
						country_has_primary_culture = cu:north_german
						country_has_primary_culture = cu:south_german
					}
					country_rank = rank_value:great_power
				}
			}
		}
	}

	fail = {
		exists = c:RHN
		c:RHN ?= {
			NOT = {
				is_subject_of = ROOT
			}
		}
	}

	on_fail = {
		add_modifier = {
			name = modifier_fall_of_germany
			months = normal_modifier_time
			is_decaying = yes
		}
	}

	should_be_pinned_by_default = yes

	weight = 100
}
