country_decisions = {
	#All Exarch establishments are found in ByzSubjectCountryFormations.txt
	
	#Decisions taken from Renovatio Imperii, but adjusted somewhat as the ideas are now completely changed. Used with permission
	reform_varangian_guard = {
		potential = {
			has_idea_group = new_BYZ_ideas #Because this caused issues with custom nations.
			tag = BYZ
			NOT = { has_country_flag = br_varangian_guard_enabled }
			capital = 151 #Because a new world Byzantium could actually pass this decision and not get mercenaries.
		}
		allow = {
			has_idea = basilics_law
			mil_power = 100
			OR = {
				mil = 5
				army_organiser = 2
				army_reformer = 2
				quartermaster = 2
				recruitmaster = 2
			}
		}
		effect = {
			add_mil_power = -100
			custom_tooltip = br_varangian_guard_enabled_tooltip
			set_country_flag = br_varangian_guard_enabled
			# capital_scope = { #BR Cut - feels unnecessary now.
				# area = {
					# add_province_modifier = {
						# name = varangians
						# duration = -1
					# }
				# }
			# }
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	sole_autocrat_of_romans = {
		potential = {
			has_idea_group = new_BYZ_ideas #Because this caused issues with custom nations.
			tag = BYZ
			num_of_cities = 40
			is_free_or_tributary_trigger = yes
			is_nomad = no
			NOT = { has_country_modifier = the_absolutism } #Blocking the decision from being taken more than once.
		}
		allow = {
			is_at_war = no
			current_age = age_of_absolutism
			owns = 151 # Constantinople
			owns = 118 # Rome
			total_development = 2000 #Empire rank
			stability = 3
			has_idea = basilics_law
			#adm_power = 100
		}
		effect = {
			#add_adm_power = -100
			add_country_modifier = {
				name = the_absolutism
				duration = -1
			}
		}
		ai_will_do = {
			factor = 1
		}
	}

	#I've added this with some regret. To be honest, there is a reason why the Exarchate was based in Ravenna: That city is essentially surrounded by a swamp, making it much easier to defend.
	#Rome, on the other hand, sits quite open. It is horrible for defenses, which is really bad if you intend on making it your capital.
	#I kind of want to make a decision to move the capital to Ravenna instead, leaving the city to the clergy and its Patriarch instead.
	#Alternatively, one could move the seat to Mediolanum, however that capital was quite short-lived I think.
	#Instead I could make an event that rebuilds Rome, granting the "rome restored" flag.
	
	#Rome = 118
	#Ravenna = 114
	#Mediolanum = 104
	
	#Capital move.
	byz_move_capital_to_rome = { 
		potential = {
			normal_or_historical_nations = yes
			tag = BYZ
			owns = 118 #Rome
			NOT = { has_country_flag = chose_rome_as_capital }
			NOT = { exists = RVN } #The Exarchate of Ravenna is not allowed to exist.
		}
		allow = {
			is_at_war = no
			118 = { 
				owned_by = ROOT
				religion = ROOT
			}
			num_of_owned_provinces_with = {
				value = 100
				continent = europe
			}
			#To give a reason as to why the capital should be moved - I.e the empire being more euro-centric.
			#TODO: Make tooltip nicer
			OR = {
				custom_trigger_tooltip = {
					tooltip = byz_rival
					any_rival_country = {
						capital_scope = {
							continent = europe
						}
						#To see if rival is mutual
						is_rival = ROOT
					}
				}
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					continent = europe
					value = 250			#I think there's at least some 300-400 tag in Roman Empire Europe by now.
				}
			}
		}
		effect = {
			118 = {
				move_capital_effect = yes
				if = {
					limit = { NOT = { has_global_flag = rome_restored } }
					add_base_tax = 4
					add_base_production = 4
					add_base_manpower = 3
					change_culture = ROOT
					set_province_flag = rome_restored
				}
			}
			set_country_flag = chose_rome_as_capital
		}
	}
	
	#Renovatio Imperii
	restore_roman_empire_byzantium = {
	    major = yes
		potential = {
		    normal_or_historical_nations = yes
			tag = BYZ
			religion_group = christian
			NOT = { exists = ROM }
			OR = {
				ai = no
				num_of_cities = 20
			}
			is_colonial_nation = no
			NOT = { has_global_flag = roman_empire_restored }
			is_subject = no
			is_nomad = no
		}
		allow = {
			OR = {
				legitimacy = 90
				republican_tradition = 90
			}
			prestige = 50
			is_at_war = no
			if = {
				limit = { religion = orthodox }
				custom_trigger_tooltip = {
					tooltip = restore_roman_empire_byzantium_pentarchy_tooltip
					has_country_modifier = pentarchy_mod
				}
			}
			else = { #Because some people actually play catholic Byzantium?!
				118 = { 
					if = { #Only applicable if not Catholic Byzantium. If you are, you shall not have to own Rome.
						limit = {
							NOT = { ROOT = { religion = catholic } }
						}
						owned_by = ROOT
					}
					religion = ROOT
				}
				151 = { 
					owned_by = ROOT
					religion = ROOT
				}
				2313 = {
					owned_by = ROOT
					religion = ROOT
				}
				379 = { 
					owned_by = ROOT
					religion = ROOT 
				}
				358 = { 
					owned_by = ROOT
					religion = ROOT 
				}
			}
			OR = {
				custom_trigger_tooltip = {
					tooltip = restore_roman_empire_byzantium_dismantle_hre_tooltip
					NOT = { hre_size = 1 }
					NOT = { exists = HLR } #Added
				}
				AND = { #Byzantium is the emperor
					is_emperor = yes
					if = {
						limit = {
							has_dlc = "Emperor"
						}
						hre_reform_passed = emperor_erbkaisertum
					}
					else = {
						hre_reform_passed = erbkaisertum
					}
					imperial_influence = 50
				}
			}
		}
		effect = {
			if = {
				limit = { NOT = { government_rank = 3 } }
				set_government_rank = 3
			}
			if = { #Holy Byzantine Empire
				limit = { is_emperor = yes }
				country_event = {
					id = holy_byzantine_empire.1
				}
			}
			add_prestige = 50
			override_country_name = ROM
			set_global_flag = roman_empire_restored
		}
		ai_will_do = { factor = 1 }
		ai_importance = 400
	}	

	#Restore the Alexandrine Library
	restore_library_of_alexandria = {
		potential = {
			has_dlc = "Leviathan" #Because I'm too lazy to create a non-Leviathan equivalent.
			tag = BYZ
			owns = 358 #Alexandria
			NOT = { 358 = { has_province_flag = br_rebuilt_library_of_alexandria } }
		}
		allow = {
			mission_completed = byz_pandidakterion
			OR = {
				full_idea_group = innovativeness_ideas
				philosopher = 3
				natural_scientist = 3
			}
			358 = {
				has_building = university
			}
			treasury = 1000
		}
		effect = {
			add_treasury = -1000
			358 = {
				set_province_flag = br_rebuilt_library_of_alexandria
				change_trade_goods = bt_trade_good_books
				add_great_project = {
					type = library_of_alexandria
					instant = yes
				}
				custom_tooltip = restore_library_of_alexandria_tooltip
			}
		}
	}
	
	#Patriarch of Mecca & Medina, as it was not part of the Pentarchy itself.
	establish_the_patriarch_of_mecca_medina = {
		potential = {
			religion = orthodox
			OR = {
				owns = 384
				owns = 385
			} #Mecca or Medina
			NOT = { has_country_flag = established_patriarch_of_mecca_medina }
			is_free_or_tributary_trigger = yes
			is_nomad = no
		}
		allow = {
			is_at_war = no
			384 = {
				owned_by = ROOT
				is_core = ROOT
				religion = ROOT
			}
			385 = {
				owned_by = ROOT
				is_core = ROOT
				religion = ROOT
			}
			advisor = theologian
			stability = 1
		}
		effect = {
			add_prestige = 10
			add_patriarch_authority = 0.2
			country_event = {
				id = "resurgent_BYZ.33"
			}
			set_country_flag = established_patriarch_of_mecca_medina
		}
		ai_will_do = {
			factor = 1
		}
	}
}