add_namespace = rt56rp_ITA_create_aoi


country_event = {
	id = rt56rp_ITA_create_aoi.1
	title = rt56rp_ITA_create_aoi.1.t
	desc = rt56rp_ITA_create_aoi.1.desc
	picture = GFX_report_event_ITA_grand_council

	fire_only_once = yes

	mean_time_to_happen = {
		days = 3
	}

	trigger = {
		tag = ITA
			AND = {
				#Eritrea
				OR = {
					owns_state = 550
					any_subject_country = {
						owns_state = 550
					}
				}

				#Somaliland
				OR = {
					owns_state = 559
					any_subject_country = {
						owns_state = 559
					}
				}
				#Jubaland
				OR = {
					owns_state = 844
					any_subject_country = {
						owns_state = 844
					}
				}
				#Tigray
				OR = {
					owns_state = 842
					any_subject_country = {
						owns_state = 842
					}
				}
				#Begemder
				OR = {
					owns_state = 841
					any_subject_country = {
						owns_state = 841
					}
				}
				#Wello
				OR = {
					owns_state = 843
					any_subject_country = {
						owns_state = 843
					}
				}
				#Afar
				OR = {
					owns_state = 908
					any_subject_country = {
						owns_state = 908
					}
				}
				#Gojjam
				OR = {
					owns_state = 840
					any_subject_country = {
						owns_state = 840
					}
				}
				#Welega
				OR = {
					owns_state = 839
					any_subject_country = {
						owns_state = 839
					}
				}

				#Illubabor-Kaffa
				OR = {
					owns_state = 838
					any_subject_country = {
						owns_state = 838
					}
				}

				#Shewa
				OR = {
					owns_state = 271
					any_subject_country = {
						owns_state = 271
					}
				}

				#Sidamo
				OR = {
					owns_state = 837
					any_subject_country = {
						owns_state = 837
					}
				}

				#Bale
				OR = {
					owns_state = 836
					any_subject_country = {
						owns_state = 836
					}
				}

				#Hararghe
				OR = {
					owns_state = 835
					any_subject_country = {
						owns_state = 835
					}
				}
			}
	}

	option = { #Create AOI
		name = rt56rp_ITA_create_aoi.1.a

		custom_effect_tooltip = aoi_founded_tt
			if = {
				limit = {
					has_war_with = ETH
				}
				custom_effect_tooltip = r56_aoi_founded_warning_tt
			}
			hidden_effect = {
				set_global_flag = italian_east_africa_flag
				if = {
					limit = {
						has_war_with = ETH
					}
					271 = {
						add_contested_owner = AOI
						set_state_controller_to = AOI
						add_claim_by = AOI
					}
					843 = {
						add_contested_owner = AOI
						set_state_controller_to = AOI
						add_claim_by = AOI
					}
					842 = {
						add_contested_owner = AOI
						set_state_controller_to = AOI
						add_claim_by = AOI
					}
					841 = {
						add_contested_owner = AOI
						set_state_controller_to = AOI
						add_claim_by = AOI
					}
					840 = {
						add_contested_owner = AOI
						set_state_controller_to = AOI
						add_claim_by = AOI
					}
					839 = {
						add_contested_owner = AOI
						set_state_controller_to = AOI
						add_claim_by = AOI
					}
					838 = {
						add_contested_owner = AOI
						set_state_controller_to = AOI
						add_claim_by = AOI
					}
					837 = {
						add_contested_owner = AOI
						set_state_controller_to = AOI
						add_claim_by = AOI
					}
					836 = {
						add_contested_owner = AOI
						set_state_controller_to = AOI
						add_claim_by = AOI
					}
					835 = {
						add_contested_owner = AOI
						set_state_controller_to = AOI
						add_claim_by = AOI
					}
				#	835 = { # forgot a state or copy paste error
				#		add_contested_owner = AOI
				#		set_state_controller_to = AOI
				#		add_claim_by = AOI
				#	}
					AOI = { # Eritrea
						transfer_state = 550
						add_state_claim = 550
					}
					AOI = { # Somaliland
						transfer_state = 559
						add_state_claim = 559
					}
					AOI = { # Jubaland
						transfer_state = 844
						add_state_claim = 844
					}
					AOI = { # Afar
						transfer_state = 908
						add_state_claim = 908
					}
				}
				else = {
					# Shewa
					AOI = {
						transfer_state = 271
						add_state_claim = 271
					}

					# Wello
					AOI = {
						transfer_state = 843
						add_state_claim = 843
					}

					# Afar
					AOI = {
						transfer_state = 908
						add_state_claim = 908
					}

					# Tigray
					AOI = {
						transfer_state = 842
						add_state_claim = 842
					}

					# Begemder
					AOI = {
						transfer_state = 841
						add_state_claim = 841
					}

					# Eritrea
					AOI = {
						transfer_state = 550
						add_state_claim = 550
					}

					# Gojjam
					AOI = {
						transfer_state = 840
						add_state_claim = 840
					}

					# Welega
					AOI = {
						transfer_state = 839
						add_state_claim = 839
					}

					# Illubabor-Kaffa
					AOI = {
						transfer_state = 838
						add_state_claim = 838
					}

					# Sidamo
					AOI = {
						transfer_state = 837
						add_state_claim = 837
					}

					# Bale
					AOI = {
						transfer_state = 836
						add_state_claim = 836
					}

					# Hararghe
					AOI = {
						transfer_state = 835
						add_state_claim = 835
					}

					# Somaliland
					AOI = {
						transfer_state = 559
						add_state_claim = 559
					}

					# Jubaland
					AOI = {
						transfer_state = 844
						add_state_claim = 844
					}
				}

				set_autonomy = {
				    target = AOI
				    autonomy_state = autonomy_puppet
				    end_wars = no
				    end_civil_wars = no
				}

				AOI = {
					add_manpower = 75000
					add_political_power = 300
					army_experience = 75
					add_ideas = {
						AOI_enrico_cerulli
						AOI_africa_orientale_italiana_idea
						ITA_army_of_east_africa
						ITA_governor_commissariats
						ITA_collaborators_in_the_hills
					}
					set_technology = {
						militia_tech = 1
						TIB_mountainous_people_tech = 1 #need this for the ITA_collaborators_in_the_hills idea not to be a lie
					}
					add_offsite_building = { type = industrial_complex level = 6 }
					add_offsite_building = { type = arms_factory level = 7 }
					add_equipment_to_stockpile = {
					    type = infantry_equipment
					    amount = 25000
					    producer = ITA
					}
					add_equipment_to_stockpile = {
						type = artillery_equipment
						amount = 125
						producer = ITA
					}
					add_equipment_to_stockpile = {
						type = support_equipment
						amount = 1575
						producer = ITA
					}
					add_equipment_to_stockpile = {
						type = anti_air_equipment
						amount = 75
						producer = ITA
					}	

					#### adding templates

					division_template = { 
						name = "Divisione Coloniale" 
						division_names_group = ITA_COL_01 
					
						# Represents lesser-equipped colonial units
						regiments = { 
							infantry = { x = 0 y = 0 } 
							infantry = { x = 0 y = 1 } 
							infantry = { x = 0 y = 2 } 
							infantry = { x = 1 y = 0 } 
							infantry = { x = 1 y = 1 } 
							infantry = { x = 1 y = 2 } 
						} 
					
						priority = 0 
					} 
					division_template = {
						name = "Truppe Irregolari a Cavallo"		
						division_names_group = ITA_CAV_05
						override_model = ITA_cavalry_alt_3_entity
						is_locked = yes
						# Note: Represents irregular cavalry from the colonies (daskalian, dubats and other "bands")
						regiments = {
							cavalry = { x = 0 y = 0 }
							cavalry = { x = 0 y = 1 }
							cavalry = { x = 1 y = 0 }
							#cavalry = { x = 1 y = 1 }
						}
						priority = 0
					}
					division_template = { 
						name = "Reggimento di Cavalleria" 
						division_names_group = ITA_CAV_01 
					
						regiments = { 
							cavalry = { x = 0 y = 0 } 
							cavalry = { x = 0 y = 1 } 
							cavalry = { x = 1 y = 0 } 
							cavalry = { x = 1 y = 1 } 
						} 
					} 

					if = {
						limit = {
							has_dlc = "La Resistance"
						}
						create_intelligence_agency = yes
					}
					set_cosmetic_tag = AOI_Italian
				}
			}
	}

	option = { #Do nothing
		name = rt56rp_ITA_create_aoi.1.b
		custom_effect_tooltip = rt56rp_ITA_AOI_later_tt
	}
}