political_actions = {
	#BRA_decision_weaken_the_elites = {
	#	available = {
	#		has_completed_focus = BRA_fight_the_elites
	#	}
	#	visible = {
	#		has_completed_focus = BRA_fight_the_elites
	#	}
	#	allowed = { TAG = BRA }
	#	fire_only_once = yes
	#	cost = 15
	#	complete_effect = {
	#		BRA = {
	#			add_stability = 0.02
	#			add_political_power = 150
	#		}
	#	}
	#}
	#BRA_decision_olinda_1857_ministers = {
	#	available = {
	#		BRA =  { has_completed_focus = BRA_olinda_1857 }
	#		has_idea = BRA_Marquis_of_Olinda_adm
	#		NOT = { has_idea = BRA_Pedro_II }
	#	}
	#	visible = {
	#		BRA =  { has_completed_focus = BRA_olinda_1857 }
	#		has_idea = BRA_Marquis_of_Olinda_adm
	#		NOT = { has_idea = BRA_Pedro_II }
	#	}
	#	allowed = {
	#		original_tag = BRA
	#	}
	#	fire_only_once = yes
	#	cost = 0
	#	complete_effect = {
	#		country_event = { id = brazil.minister.actions.1 }
	#	}
	#}
	BRA_mission_olinda_1857_replace_advisor = {
		allowed = {
			original_tag = BRA
		}
		available = {
			has_idea = BRA_Marquis_of_Olinda_adm
			NOT = { has_idea = BRA_jeronimo_coelho_army_chief }
		}
		activation = {
			date > 1858.7.3
			has_idea = BRA_Marquis_of_Olinda_adm
			has_idea = BRA_jeronimo_coelho_army_chief
		}
		is_good = yes
		days_mission_timeout = 7
		complete_effect = {
			add_political_power = 50
		}
		timeout_effect = {
			country_event = { id = brazil.minister.actions.2 }
		}
	}

	#BRA_mission_abaete_1858_appoint_army_chief = {
	#	allowed = {
	#		original_tag = BRA
	#	}
	#	available = {
	#		has_idea = BRA_visconde_de_abaete
	#		NOT = { has_idea = BRA_manuel_felizardo_de_sousa_e_melo_army }
	#	}
	#	activation = {
	#		date > 1859.2.4
	#		has_idea = BRA_visconde_de_abaete
	#		has_idea = BRA_manuel_felizardo_de_sousa_e_melo_army
	#	}
	#	is_good = yes
	#	days_mission_timeout = 7
	#	complete_effect = {
	#		add_political_power = 50
	#	}
	#	timeout_effect = {
	#		country_event = { id = brazil.minister.actions.5 }
	#	}
	#}

	#BRA_mission_abaete_1858_replace_minister_of_justice = {
	#	allowed = {
	#		original_tag = BRA
	#	}
	#	available = {
	#		has_idea = BRA_visconde_de_abaete
	#		NOT = { has_idea = BRA_Jose_Tomas_Nabuco_de_Araujo_Filho }
	#	}
	#	activation = {
	#		date > 1859.3.13
	#		has_idea = BRA_visconde_de_abaete
	#		has_idea = BRA_Jose_Tomas_Nabuco_de_Araujo_Filho
	#	}
	#	is_good = yes
	#	days_mission_timeout = 7
	#	complete_effect = {
	#		add_political_power = 50
	#	}
	#	timeout_effect = {
	#		country_event = { id = brazil.minister.actions.6 }
	#	}
	#}
}
eoanb_category_politics_internal  = {

	BRA_mission_Afro_Brazilian_Carriers_Strikes_in_Bahia = {
		icon = POL_looming_peasants_strike
		allowed = { always = no }
		available = {
			owns_state = 499
			499 = {
				NOT = { has_dynamic_modifier = { modifier = BRA_african_workers_strikes } }
			}
		}
		activation = { always = no }
		priority = 49
		highlight_states = {
			highlight_state_targets = {
				state = 499
			}
		}
		fire_only_once = yes
		is_good = no
		days_mission_timeout = 30
		timeout_effect = {
			country_event = { id = brazil.907 }
		}
		complete_effect = {
			
		}
		ai_will_do = {
			base = 100
		}
	}

		BRA_decision_rethink_taxes_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1857_rethink_the_taxes
				NOT = { has_idea = BRA_1857_taxes_act }
				#has_idea = BRA_Marquis_of_Olinda_adm
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1857_rethink_the_taxes
				NOT = { has_idea = BRA_1857_taxes_act }
				#has_idea = BRA_Marquis_of_Olinda_adm
			}
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.14 days = 1 }
		}
	}

	BRA_decision_mortgage_land_act_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = { has_completed_focus = BRA_1857_reform_mortgage_system }
			check_variable = { current_reform_id = 0 }
			NOT = { has_country_flag = BRA_reform_mortgage_land_act }
		}
		visible = {
			has_completed_focus = BRA_1857_reform_mortgage_system
			NOT = { has_country_flag = BRA_reform_mortgage_land_act }
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.9 days = 1 }
		}
	}

	BRA_decision_english_money_in_public_station_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = { has_completed_focus = BRA_1857_british_money }
			#has_idea = BRA_Marquis_of_Olinda_adm
			check_variable = { current_reform_id = 0 }
			NOT = {
				OR = {
					BRA = { has_offensive_war_with = ENG }
					ENG = { has_offensive_war_with = BRA }
				}
			}
		}
		visible = {
			BRA = { has_completed_focus = BRA_1857_british_money  }
			#has_idea = BRA_Marquis_of_Olinda_adm
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.2 days = 1 }
		}
		ai_will_do = {
			base = 1000
		}
	}

	BRA_decision_medical_school_reform_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = { has_completed_focus = BRA_1857_medical_school_policy }
			#has_idea = BRA_Marquis_of_Olinda_adm
			check_variable = { current_reform_id = 0 }
			NOT = { has_idea = BRA_medical_school_reform }
		}
		visible = {
			has_completed_focus = BRA_1857_medical_school_policy
			#has_idea = BRA_Marquis_of_Olinda_adm
			NOT = { has_idea = BRA_medical_school_reform }
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.1 days = 1 }
		}
		ai_will_do = {
			base = 1000
		}
	}
	
	BRA_decision_livestock_regulation_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = { has_completed_focus = BRA_1857_livestock_regulation }
			#has_idea = BRA_Marquis_of_Olinda_adm
			check_variable = { current_reform_id = 0 }
			NOT = { has_idea = BRA_livestock_regulation }
		}
		visible = {
			has_completed_focus = BRA_1857_livestock_regulation
			#has_idea = BRA_Marquis_of_Olinda_adm
			NOT = { has_idea = BRA_livestock_regulation }
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.3 days = 1 }
		}
		ai_will_do = {
			base = 1000
		}
	}
	BRA_decision_court_police_corps_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = { has_completed_focus = BRA_1857_courts_police_force }
			#has_idea = BRA_Marquis_of_Olinda_adm
			check_variable = { current_reform_id = 0 }
			NOT = { has_idea = BRA_court_police_corps }
		}
		visible = {
			BRA = { has_completed_focus = BRA_1857_courts_police_force }
			#has_idea = BRA_Marquis_of_Olinda_adm
			NOT = { has_idea = BRA_court_police_corps }
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.4 days = 1 }
		}
		ai_will_do = {
			base = 1000
		}
	}
	BRA_decision_friendship_treaty_Brazil_Ottoman_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = { has_completed_focus = BRA_1857_friendship_treaty_with_ottoman }
			#has_idea = BRA_Marquis_of_Olinda_adm
			check_variable = { current_reform_id = 0 }
			NOT = {
				OR = {
					BRA = { has_offensive_war_with = OTO }
					OTO = { has_offensive_war_with = BRA }
					has_country_flag = ottoman_friendship_treaty
				}
			}
		}
		visible = {
			BRA = { has_completed_focus = BRA_1857_friendship_treaty_with_ottoman }
			#has_idea = BRA_Marquis_of_Olinda_adm
			NOT = {
				OR = {
					BRA = { has_offensive_war_with = OTO }
					OTO = { has_offensive_war_with = BRA }
					has_country_flag = ottoman_friendship_treaty
				}
			}
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.5 days = 1 }
		}
		ai_will_do = {
			base = 1000
		}
	}

	BRA_decision_trade_treaty_Brazil_Uruguay_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = { has_completed_focus = BRA_1857_trade_treaty_with_uruguay }
			#has_idea = BRA_Marquis_of_Olinda_adm
			check_variable = { current_reform_id = 0 }
			NOT = {
				OR = {
					BRA = { has_offensive_war_with = URG }
					URG = { has_offensive_war_with = BRA }
					has_country_flag = uruguay_friendship_treaty
				}
			}
		}
		visible = {
			BRA = { has_completed_focus = BRA_1857_trade_treaty_with_uruguay }
			#has_idea = BRA_Marquis_of_Olinda_adm
			NOT = {
				has_country_flag = uruguay_friendship_treaty
			}
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.6 days = 1 }
		}
		ai_will_do = {
			base = 1000
		}
	}

	BRA_decision_disputes_with_UK_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = { has_completed_focus = BRA_1857_disputes_with_UK }
			#has_idea = BRA_Marquis_of_Olinda_adm
			check_variable = { current_reform_id = 0 }
			NOT = {
				OR = {
					BRA = { has_offensive_war_with = ENG }
					ENG = { has_offensive_war_with = BRA }
					has_country_flag = britain_friendship_treaty
				}
			}
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1857_disputes_with_UK
				#has_idea = BRA_Marquis_of_Olinda_adm
				NOT = {
					has_country_flag = britain_friendship_treaty
				}
			}
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.7 days = 1 }
		}
		ai_will_do = {
			base = 1000
		}
	}

	BRA_decision_immigration_act_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = { has_completed_focus = BRA_1857_encourage_immigration }
			#has_idea = BRA_Marquis_of_Olinda_adm
			check_variable = { current_reform_id = 0 }
			NOT = { has_country_flag = BRA_passed_immigration_bill_1857 }
		}
		visible = {
			has_completed_focus = BRA_1857_encourage_immigration
			#has_idea = BRA_Marquis_of_Olinda_adm
			NOT = { has_country_flag = BRA_passed_immigration_bill_1857 }
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.8 days = 1 }
		}
	}

	BRA_decision_reformed_conscription_act_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			has_completed_focus = BRA_1857_recruitment_regulation
			NOT = { has_country_flag = BRA_reformed_conscription }
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			has_completed_focus = BRA_1857_recruitment_regulation
			NOT = { has_country_flag = BRA_reformed_conscription }
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.10 days = 1 }
		}
	}

	BRA_decision_navy_leader_promotion_act_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1857_promotion_naval_officers
				NOT = { has_country_flag = BRA_navy_leader_promotion }
				#has_idea = BRA_Marquis_of_Olinda_adm
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1857_promotion_naval_officers
				NOT = { has_country_flag = BRA_navy_leader_promotion }
				#has_idea = BRA_Marquis_of_Olinda_adm
			}
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.11 days = 1 }
		}
	}

	BRA_decision_army_discipline_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1857_improve_military_discipline
				NOT = { has_country_flag = BRA_reformed_conscription }
				#has_idea = BRA_Marquis_of_Olinda_adm
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1857_improve_military_discipline
				NOT = { has_country_flag = BRA_reformed_conscription }
				#has_idea = BRA_Marquis_of_Olinda_adm
			}
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.12 days = 1 }
		}
	}

	BRA_decision_improve_criminal_law_1857 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1857_improve_criminal_law
				NOT = { has_idea = BRA_improve_criminal_laws }
				#has_idea = BRA_Marquis_of_Olinda_adm
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1857_improve_criminal_law
				NOT = { has_idea = BRA_improve_criminal_laws }
				#has_idea = BRA_Marquis_of_Olinda_adm
			}
		}
		cost = 0
		complete_effect = {
			country_event = { id = brazil_votes.13 days = 1 }
		}
	}
	
	BRA_decision_gold_mines_1858 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1858_minning_gold
				NOT = { has_idea = BRA_1858_minas_gerais_gold }
				#has_idea = BRA_Marquis_of_Olinda_adm
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1858_minning_gold
				NOT = { has_idea = BRA_1858_minas_gerais_gold }
				#has_idea = BRA_Marquis_of_Olinda_adm
			}
		}
		cost = 0
		fire_only_once = yes
		complete_effect = {
			country_event = { id = brazil_votes.15 days = 1 }
		}
	}
	BRA_decision_national_bank_monopoly_1858 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1858_national_bank_monopoly
				NOT = { has_idea = BRA_1858_monopoly_on_issuing_money }
				#has_idea = BRA_Marquis_of_Olinda
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1858_national_bank_monopoly
				NOT = { has_idea = BRA_1858_monopoly_on_issuing_money }
			}
		}
		cost = 30
		fire_only_once = yes
		complete_effect = {
			add_ideas = BRA_1858_monopoly_on_issuing_money
		}
	}


	BRA_decision_ban_slave_trade_1858 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1858_ban_slave_trade
				NOT = { has_idea = BRA_1858_eusebio_de_queiros_law }
				#has_idea = BRA_eusebio_de_queiros_jugde
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1858_ban_slave_trade
				NOT = { has_idea = BRA_1858_eusebio_de_queiros_law }
				#has_idea = BRA_eusebio_de_queiros_jugde
			}
		}
		cost = 0
		fire_only_once = yes
		complete_effect = {
			country_event = { id = brazil_votes.17 days = 1 }
		}
	}

	BRA_decision_commerce_regulation_1858 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1858_commerce_regulation
				NOT = { has_idea = BRA_1858_commerce_code_law }
				#has_idea = BRA_eusebio_de_queiros_jugde
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1858_commerce_regulation
				NOT = { has_idea = BRA_1858_commerce_code_law }
				#has_idea = BRA_eusebio_de_queiros_jugde
			}
		}
		cost = 0
		fire_only_once = yes
		complete_effect = {
			country_event = { id = brazil_votes.18 days = 1 }
		}
	}

	BRA_decision_protectionist_fees_1858 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1858_protectionist_fees
				NOT = { has_idea = BRA_1858_alves_branco_law }
				has_idea = BRA_viscount_of_uruguay_foreign
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1858_protectionist_fees
				NOT = { has_idea = BRA_1858_alves_branco_law }
				#has_idea = BRA_viscount_of_uruguay_foreign
			}
		}
		cost = 0
		fire_only_once = yes
		complete_effect = {
			country_event = { id = brazil_votes.19 days = 1 }
		}
	}

	BRA_decision_land_law_1858 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1858_lands_law
				NOT = { has_idea = BRA_1858_land_law }
				#has_idea = BRA_eusebio_de_queiros_jugde
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1858_lands_law
				NOT = { has_idea = BRA_1858_land_law }
				#has_idea = BRA_eusebio_de_queiros_jugde
			}
		}
		cost = 0
		fire_only_once = yes
		complete_effect = {
			country_event = { id = brazil_votes.20 days = 1 }
		}
	}

	BRA_decision_navy_officer_promotion_1858 = {
		allowed = {
			original_tag = BRA
		}
		available = {
			BRA = {
				has_completed_focus = BRA_1858_navy_promotion
				NOT = { has_idea = BRA_1858_navy_officer_promotion }
				#has_idea = BRA_viscount_of_abaete_navy_chief
			}
			check_variable = { current_reform_id = 0 }
		}
		visible = {
			BRA = {
				has_completed_focus = BRA_1858_navy_promotion
				NOT = { has_idea = BRA_1858_navy_officer_promotion }
				#has_idea = BRA_viscount_of_abaete_navy_chief
			}
		}
		cost = 0
		fire_only_once = yes
		complete_effect = {
			country_event = { id = brazil_votes.21 days = 1 }
		}
	}

}
eoanb_category_economic = {
	BRA_decision_invest_caixa={
		available={
			tag = BRA
			has_country_flag = bra_create_caixa
			date > 1861.1.12
			date < 1864.1.1
		}
		allowed = { TAG = BRA }
		visible = {
			tag = BRA
			has_country_flag=bra_create_caixa
			date > 1861.1.12
		}
		fire_only_once = yes
		days_remove = 90
		cost = 100
		modifier ={
			civilian_factory_use = 1
		}
		remove_effect = {
			add_ideas = BRA_caixa
		}
		ai_will_do = {
			base = 1
		}
	}

	BRA_decision_amazon_development = {
		available = {
			BRA = {has_idea = BRA_amazon_colonization}
			tag = BRA
			date > 1862.7.11
		}
		allowed = { TAG = BRA }
		visible = {
			BRA = {has_idea = BRA_amazon_colonization}
			tag = BRA
		}
		is_good = yes
		days_remove = 70
		modifier = {
			#consumer_goods = 0.05
			civilian_factory_use = 2
		}
		fixed_random_seed = no
		remove_effect = {
			random_list={
				50={
					495={#Amazonas
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = farm
							level = 1
							instant_build = yes
						}
					}
				}
				25={
					495={#Amazonas
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = logging_camp
							level = 1
							instant_build = yes
						}
					}
				}
				15={
					495={#Amazonas
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = cotton_farm
							level = 1
							instant_build = yes
						}
					}
				}
				7={
					495={#Amazonas
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = coal_mine
							level = 1
							instant_build = yes
						}
					}
				}
				3={
					495={#Amazonas
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
				}
			}

			random_list={
				50={
					280={#MatoGrosso
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = farm
							level = 1
							instant_build = yes
						}
					}
				}
				25={
					280={#MatoGRosso
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = logging_camp
							level = 1
							instant_build = yes
						}
					}
				}
				15={
					280={#MatoGrosso
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = cotton_farm
							level = 1
							instant_build = yes
						}
					}
				}
				7={
					280={#MatoGrosso
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = coal_mine
							level = 1
							instant_build = yes
						}
					}
				}
				3={
					280={#MatoGrosso
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
				}
			}
			random_list={
				50={
					496={#Pará
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = farm
							level = 1
							instant_build = yes
						}
					}
				}
				25={
					496={#Pará
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = logging_camp
							level = 1
							instant_build = yes
						}
					}
				}
				15={
					496={#Pará
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = cotton_farm
							level = 1
							instant_build = yes
						}
					}
				}
				7={
					496={#Pará
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = coal_mine
							level = 1
							instant_build = yes
						}
					}
				}
				3={
					496={#Pará
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
				}
			}
			random_list={
				50={
					1323={#Amapá
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = farm
							level = 1
							instant_build = yes
						}
					}
				}
				25={
					1323={#Amapá
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = logging_camp
							level = 1
							instant_build = yes
						}
					}
				}
				15={
					1323={#Amapá
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = cotton_farm
							level = 1
							instant_build = yes
						}
					}
				}
				7={
					1323={#Amapá
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = coal_mine
							level = 1
							instant_build = yes
						}
					}
				}
				3={
					1323={#Amapá
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
				}
			}
		}
		ai_will_do = {
			base = 1
		}
	}
	BRA_decision_acquire_gold_from_mines = {
		available = {
			has_completed_focus = BRA_1858_minning_gold
		}
		visible = {
			has_completed_focus = BRA_1858_minning_gold
		}
		allowed = {
			original_tag = BRA
		}
		fire_only_once = yes
		days_remove = 70
		cost = 50
		modifier = {
			civilian_factory_use = 1
			weekly_manpower = -1001
		}
		remove_effect = {
			1038 = {
				add_manpower = 10010
				set_state_flag = minning_gold
			}
			add_ideas = BRA_1857_minas_gerais_gold
		}
	}

	#BRA_decision_develop_the_south = {
	#	icon = generic_factory
	#	available = {
	#		has_completed_focus = BRA_develop_the_south
	#		num_of_available_civilian_factories > 0
	#	}
	#	visible = { has_completed_focus = BRA_develop_the_south }
	#	days_remove = 360
	#	fire_only_once = yes
	#	allowed = { original_tag = BRA }
	#	cost = 100
	#	modifier = {
	#		civilian_factory_use = 1
	#	}
	#	remove_effect = {
	#		502 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 3
	#				instant_build = yes
	#			}
	#		}
	#		503 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 3
	#				instant_build = yes
	#			}
	#		}
	#		1064 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 3
	#				instant_build = yes
	#			}
	#		}
	#		1036 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 3
	#				instant_build = yes
	#			}
	#		}
	#		301 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 3
	#				instant_build = yes
	#			}
	#		}
	#	}
	#}

	#BRA_decision_early_industry_sao_paulo = {
	#	icon = generic_factory
	#	available = {
	#		has_completed_focus = BRA_southern_economic_innovation
	#		num_of_available_civilian_factories > 0
	#	}
	#	visible = { has_completed_focus = BRA_southern_economic_innovation }
	#	days_remove = 360
	#	fire_only_once = yes
	#	allowed = { original_tag = BRA }
	#	cost = 100
	#	modifier = {
	#		civilian_factory_use = 1
	#	}
	#	remove_effect = {
	#		501 = {
	#			add_building_construction = {
	#				type = industrial_complex
	#				level = 1
	#				instant_build = yes
	#			}
	#		}
	#	}
	#}

	#BRA_decision_early_industry_rio_grande_do_sul = {
	#	icon = generic_factory
	#	available = {
	#		has_completed_focus = BRA_southern_economic_innovation
	#		num_of_available_civilian_factories > 0
	#	}
	#	visible = { has_completed_focus = BRA_southern_economic_innovation }
	#	days_remove = 360
	#	fire_only_once = yes
	#	allowed = { original_tag = BRA }
	#	cost = 100
	#	modifier = {
	#		civilian_factory_use = 1
	#	}
	#	remove_effect = {
	#		502 = {
	#			add_building_construction = {
	#				type = industrial_complex
	#				level = 1
	#				instant_build = yes
	#			}
	#		}
	#	}
	#}
}

BRA_decision_category_coffee_economy={

	BRA_decision_coffee_economy_capital={
		icon = money
		available={
			1037 = {
				is_controlled_by = BRA
				NOT = {has_state_flag = coffee_economy}
			}
			has_completed_focus = BRA_expand_coffee_plantations_in_rio
		}
		visible={
			has_completed_focus = BRA_expand_coffee_plantations_in_rio
			tag = BRA
			1037 = {
				is_controlled_by = BRA
				NOT = {has_state_flag = coffee_economy}
			}
		}
		#allowed={ original_tag=BRA }
		cost=0

		ai_will_do = {
			base = 10
		}

		complete_effect={
			1037 ={
				add_building_construction={
					type=infrastructure
					level = 1
					instant_build=no
				}
				add_building_construction = {
					type = farm
					level = 1
					instant_build = no
				}
				set_state_flag={
					flag = coffee_economy
					days = 1600
					value = 1
				}
			}
			activate_mission = BRA_mission_coffee_economy_capital
			unlock_decision_tooltip = BRA_decision_coffee_economy_capital_free_workers
			unlock_decision_tooltip = BRA_decision_coffee_economy_capital_slave_workers
		}
	}

	BRA_decision_coffee_economy_capital_free_workers={
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			1037 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			1037 = {
				has_state_flag = coffee_economy
			}
		}
		state_target = yes
		targets = { 1037 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = coffee_economy
			}
		}
		cost = 75
		days_remove = 28
		days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1037={
				set_state_flag = coffee_economy_free_workers

				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	BRA_decision_coffee_economy_capital_slave_workers={
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			1037 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			1037 = {
				has_state_flag = coffee_economy
			}
		}
		state_target = yes
		targets = { 1037 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		cost = 50
		days_remove = 28
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.01
		}
		remove_effect={
			1037={
				set_state_flag = coffee_economy_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_mission_coffee_economy_capital={
		icon = railway
		days_mission_timeout = 1600
		allowed={ always = no}
		available={
			1037 = {
				infrastructure > 6
				farm > 0
			}
			owns_state = 1037
		}
		activation = { always = no }
		highlight_states={
			state = 1037
		}
		state_target = yes
		targets = { 1037 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		is_good=no
		selectable_mission=yes
		timeout_effect={
			1037 = {
				clr_state_flag = coffee_economy
				if={
					limit={ has_state_flag = coffee_economy_maua_company }
					clr_state_flag = coffee_economy_maua_company
				}
				else_if={
					limit={ has_state_flag = coffee_economy_slave_workers}
					clr_state_flag = coffee_economy_slave_workers
				}
				else_if={
					limit={ has_state_flag = coffee_economy_free_workers}
					clr_state_flag = coffee_economy_free_workers
				}
			}
			add_political_power= -100
			add_stability = -0.02
		}
		fixed_random_seed = no
		complete_effect={
			1037 = {
				add_extra_state_shared_building_slots = 2
			}
			add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
			random_list={
				48 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_capital_farm
					modifier = {
						add = 3
						1037 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -24
						1037 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -48
						1037 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1037={
						set_state_flag=coffee_economy_farm
					}
				}
				24 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_capital_cotton_farm
					modifier = {
						add = 3
						1037 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -12
						1037 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -18
						1037 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1037={
						set_state_flag=coffee_economy_cotton_farm
					}
				}
				12 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_capital_fabric_weavery
					modifier = {
						add = 0
						1037 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 12
						1037 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 15
						1037 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1037={
						set_state_flag=coffee_economy_fabric_weavery
					}
				}
				6 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_capital_steel_mill
					modifier = {
						add = 0
						1037 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 12
						1037 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 15
						1037 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1037={
						set_state_flag=coffee_economy_steel_mill
					}
				}
				4 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_capital_industrial_complex
					modifier = {
						add = -4
						1037 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 6
						1037 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 18
						1037 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1037={
						set_state_flag=coffee_economy_industrial_complex
					}
				}
				2 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_capital_arms_factory
					modifier = {
						add = -3
						1037 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 6
						1037 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 18
						1037 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1037={
						set_state_flag=coffee_economy_arms_factory
					}
				}
			}

			if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy
					add_idea = BRA_coffee_economy2
				}
				add_ideas = { BRA_coffee_barons }
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy2}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy2
					add_idea = BRA_coffee_economy3
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons
					add_idea = BRA_coffee_barons2
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy3}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy3
					add_idea = BRA_coffee_economy4
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons2
					add_idea = BRA_coffee_barons3
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy4}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy4
					add_idea = BRA_coffee_economy5
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons3
					add_idea = BRA_coffee_barons4
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy5}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy5
					add_idea = BRA_coffee_economy6
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons4
					add_idea = BRA_coffee_barons5
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy6}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy6
					add_idea = BRA_coffee_economy7
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons5
					add_idea = BRA_coffee_barons6
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy7}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy7
					add_idea = BRA_coffee_economy8
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons6
					add_idea = BRA_coffee_barons7
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy8}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy8
					add_idea = BRA_coffee_economy9
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons7
					add_idea = BRA_coffee_barons8
				}
			}
		}
	}

	BRA_mission_coffee_economy_capital_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1037={
				has_state_flag = coffee_economy_farm
			}
		}
		available={
			owns_state = 1037
			1037={
				has_state_flag = coffee_economy_farm
			}
		}
		highlight_states={
			state = 1037
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1037={
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
			}
		}
	}

	BRA_mission_coffee_economy_capital_cotton_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1037={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		available={
			owns_state = 1037
			1037={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		highlight_states={
			state = 1037
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1037={
				add_building_construction = {
					type = cotton_farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_capital_fabric_weavery={
		icon = generic_construction
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1037={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		available={
			owns_state = 1037
			1037={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		highlight_states={
			state = 1037
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1037={
				add_building_construction = {
					type = fabric_weavery
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_capital_steel_mill={
		icon = steel
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1037={
				has_state_flag=coffee_economy_steel_mill
			}
		}
		available={
			owns_state = 1037
			1037={
				has_state_flag=coffee_economy_steel_mill
			}
		}
		highlight_states={
			state = 1037
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1037={
				add_building_construction = {
					type = steel_mill
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_capital_industrial_complex={
		icon = generic_factory
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1037={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		available={
			owns_state = 1037
			1037={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		highlight_states={
			state = 1037
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1037={
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_capital_arms_factory={
		icon = generic_industry
		days_remove = 720
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1037={
				has_state_flag = coffee_economy_arms_factory
			}
		}
		available={
			owns_state = 1037
			1037={
				has_state_flag = coffee_economy_arms_factory
			}
		}
		highlight_states={
			state = 1037
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1037={
				add_building_construction = {
					type = arms_factory
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_decision_coffee_economy_rio_de_janeiro={
		icon = money
		available={
			500 = {is_controlled_by = BRA}
			500 = {
				NOT = {has_state_flag = coffee_economy}
			}
			has_completed_focus = BRA_expand_coffee_plantations_in_rio
		}
		visible={
			has_completed_focus = BRA_expand_coffee_plantations_in_rio
			tag = BRA
			500 = {
				NOT = {has_state_flag = coffee_economy}
			}
		}
		#allowed={ original_tag=BRA }
		cost=0

		ai_will_do = {
			base = 10
		}

		complete_effect={
			500 ={
				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = no
				}
				add_building_construction = {
					type = naval_base
					level = 1
					province = 10980
					instant_build = no
				}
				add_building_construction = {
					type = farm
					level = 1
					instant_build = no
				}
				set_state_flag={
					flag = coffee_economy
					days = 1600
					value = 1
				}
			}
			activate_mission = BRA_mission_coffee_economy_rio_de_janeiro
			unlock_decision_tooltip = BRA_decision_coffee_economy_rio_de_janeiro_free_workers
			unlock_decision_tooltip = BRA_decision_coffee_economy_rio_de_janeiro_slave_workers
		}
	}

	BRA_decision_coffee_economy_rio_de_janeiro_free_workers={
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			has_completed_focus = BRA_expand_coffee_plantations_in_rio
			set_temp_variable = {
				amount_of_money_to_check = 1
			}
		}
		visible = {
			has_completed_focus = BRA_expand_coffee_plantations_in_rio
		}
		state_target = yes
		targets = { 500 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = coffee_economy
			}
		}
		cost = 75
		days_remove = 28
		days_re_enable = 1600
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			500={
				set_state_flag=coffee_economy_free_workers

				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
						state_production_speed_naval_base_factor = 0.25
					}
				}
			}
		}
	}

	BRA_decision_coffee_economy_rio_de_janeiro_slave_workers={
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			#has_country_flag = brazil_coffee_economy_rio_de_janeiro
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			FROM = {
				has_state_flag = coffee_economy
			}
		}
		state_target = yes
		targets = { 500 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		cost = 50
		days_remove = 28
		days_re_enable = 1600
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.01
		}
		remove_effect={
			500={
				set_state_flag = coffee_economy_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
						state_production_speed_naval_base_factor = 0.15
					}
				}
			}
		}
	}

	BRA_mission_coffee_economy_rio_de_janeiro={
		icon = railway
		days_mission_timeout = 1600
		allowed={ always = no}
		available={
			500 = { infrastructure > 7 }
			500 = { naval_base > 5 }
			500 = { farm > 0 }
			owns_state = 500
		}
		activation = { always = no }
		highlight_states={
			state = 500
		}
		state_target = yes
		targets = { 500 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		is_good=no
		selectable_mission=yes
		timeout_effect={
			500 = {
				clr_state_flag = coffee_economy
				if={
					limit={ has_state_flag = coffee_economy_maua_company }
					clr_state_flag = coffee_economy_maua_company
				}
				else_if={
					limit={ has_state_flag = coffee_economy_slave_workers}
					clr_state_flag = coffee_economy_slave_workers
				}
				else_if={
					limit={ has_state_flag = coffee_economy_free_workers}
					clr_state_flag = coffee_economy_free_workers
				}
			}
			add_political_power= -100
			add_stability = -0.02
		}
		fixed_random_seed = no
		complete_effect={
			500 = {
				add_extra_state_shared_building_slots = 2
			}
			add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
			random_list={
				40 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_rio_de_janeiro_farm
					modifier = {
						add = 5
						500 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -20
						500 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -40
						500 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					500={
						set_state_flag=coffee_economy_farm
					}
				}
				20 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_rio_de_janeiro_cotton_farm
					modifier = {
						add = 5
						500 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -10
						500 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -15
						500 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					500={
						set_state_flag=coffee_economy_cotton_farm
					}
				}
				14 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_rio_de_janeiro_fabric_weavery
					500={
						set_state_flag=coffee_economy_fabric_weavery
					}
					modifier = {
						add = 0
						500 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 21
						500 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 12
						500 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
				}
				10 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_rio_de_janeiro_dockyard
					modifier = {
						add = 0
						500 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						500 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 10
						500 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					500={
						set_state_flag=coffee_economy_dockyard
					}
				}
				7 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_rio_de_janeiro_industrial_complex
					500={
						set_state_flag=coffee_economy_industrial_complex
					}
					modifier = {
						add = -7
						500 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						500 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 10
						500 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
				}
				4 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_rio_de_janeiro_arms_factory
					modifier = {
						add = -4
						500 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						500 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 10
						500 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					500={
						set_state_flag=coffee_economy_arms_factory
					}
				}
			}
			if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy
					add_idea = BRA_coffee_economy2
				}
				add_ideas = { BRA_coffee_barons }
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy2}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy2
					add_idea = BRA_coffee_economy3
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons
					add_idea = BRA_coffee_barons2
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy3}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy3
					add_idea = BRA_coffee_economy4
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons2
					add_idea = BRA_coffee_barons3
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy4}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy4
					add_idea = BRA_coffee_economy5
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons3
					add_idea = BRA_coffee_barons4
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy5}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy5
					add_idea = BRA_coffee_economy6
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons4
					add_idea = BRA_coffee_barons5
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy6}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy6
					add_idea = BRA_coffee_economy7
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons5
					add_idea = BRA_coffee_barons6
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy7}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy7
					add_idea = BRA_coffee_economy8
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons6
					add_idea = BRA_coffee_barons7
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy8}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy8
					add_idea = BRA_coffee_economy9
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons7
					add_idea = BRA_coffee_barons8
				}
			}
		}
	}

	BRA_mission_coffee_economy_rio_de_janeiro_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			500={
				has_state_flag=coffee_economy_farm
			}
		}
		available={
			owns_state = 500
			500={
				has_state_flag=coffee_economy_farm
			}
		}
		highlight_states={
			state = 500
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			500={
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_rio_de_janeiro_cotton_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			500={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		available={
			owns_state = 500
			500={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		highlight_states={
			state = 500
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			500={
				add_building_construction = {
					type = cotton_farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_rio_de_janeiro_fabric_weavery={
		icon = generic_construction
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			500={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		available={
			owns_state = 500
			500={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		highlight_states={
			state = 500
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			500={
				add_building_construction = {
					type = fabric_weavery
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_rio_de_janeiro_dockyard={
		icon = generic_naval
		fire_only_once = yes
		days_remove = 180
		#allowed={ original_tag=BRA }
		visible={
			500={
				has_state_flag = coffee_economy_dockyard
			}
		}
		available={
			owns_state = 500
			500={
				has_state_flag = coffee_economy_dockyard
			}
		}
		highlight_states={
			state = 500
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			500={
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_rio_de_janeiro_industrial_complex={
		icon = generic_factory
		fire_only_once = yes
		days_remove = 360
		#allowed={ original_tag=BRA }
		visible={
			500={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		available={
			owns_state = 500
			500={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		highlight_states={
			state = 500
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			500={
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_rio_de_janeiro_arms_factory={
		icon = generic_industry
		fire_only_once = yes
		days_remove = 720
		#allowed={ original_tag=BRA }
		visible={
			500={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		available={
			owns_state = 500
			500={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		highlight_states={
			state = 500
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			500={
				add_building_construction = {
					type = arms_factory
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_decision_coffee_economy_sao_paulo={
		icon = money
		available={
			501 = {is_controlled_by = BRA}
			501 = {
				NOT = {has_state_flag = coffee_economy}
			}
			has_completed_focus = BRA_expand_coffee_plantations_in_sao_paulo
		}
		visible={
			has_completed_focus = BRA_expand_coffee_plantations_in_sao_paulo
			tag = BRA
			1038 = {
				NOT = {has_state_flag = coffee_economy}
			}
		}
		#allowed={ original_tag=BRA }
		cost=0

		ai_will_do = {
			base = 10
		}

		complete_effect={
			501 ={
				add_building_construction={
					type=infrastructure
					level = 1
					instant_build=no
				}
				add_building_construction = {
					type = naval_base
					level = 1
					province = 5112
					instant_build = no
				}
				add_building_construction = {
					type = farm
					level = 2
					instant_build = no
				}
				set_state_flag={
					flag = coffee_economy
					days = 1600
					value = 1
				}
			}
			activate_mission = BRA_mission_coffee_economy_sao_paulo
			unlock_decision_tooltip = BRA_decision_coffee_economy_sao_paulo_free_workers
			unlock_decision_tooltip = BRA_decision_coffee_economy_sao_paulo_slave_workers
		}
	}

	BRA_decision_coffee_economy_sao_paulo_free_workers={
		icon = generic_civil_support
		#allowed={ original_tag=BRA }
		available = {
			501 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			501 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		state_target = yes
		targets = { 501 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = coffee_economy
			}
		}
		cost = 75
		days_remove = 28
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			501={
				set_state_flag=coffee_economy_free_workers

				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
						state_production_speed_naval_base_factor = 0.25
					}
				}
			}
		}
	}


	BRA_decision_coffee_economy_sao_paulo_slave_workers={
		icon = generic_independence
		#allowed={ original_tag=BRA }
		available = {
			#has_country_flag = brazil_coffee_economy_sao_paulo
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		state_target = yes
		targets = { 501 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		cost = 50
		days_remove = 28
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.01
		}
		remove_effect={
			501={
				set_state_flag = coffee_economy_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
						state_production_speed_naval_base_factor = 0.15
					}
				}
			}
		}
	}
	BRA_mission_coffee_economy_sao_paulo={
		icon = railway
		days_mission_timeout = 1600
		allowed={ always = no}
		available={
			501 = {infrastructure > 7}
			501 = {naval_base > 4}
			501 = { farm > 1 }
			owns_state = 501
		}
		activation = { always = no }
		highlight_states={
			state = 501
		}
		state_target = yes
		targets = { 501 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		is_good=no
		selectable_mission=yes
		timeout_effect={
			501 = {
				clr_state_flag = coffee_economy
				if={
					limit={ has_state_flag = coffee_economy_maua_company }
					clr_state_flag = coffee_economy_maua_company
				}
				else_if={
					limit={ has_state_flag = coffee_economy_slave_workers}
					clr_state_flag = coffee_economy_slave_workers
				}
				else_if={
					limit={ has_state_flag = coffee_economy_free_workers}
					clr_state_flag = coffee_economy_free_workers
				}
			}
			add_political_power= -100
			add_stability = -0.02
		}
		fixed_random_seed = no
		complete_effect={
			501 = {
				add_extra_state_shared_building_slots = 2
			}
			add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
			random_list={
				25 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_sao_paulo_farm
					modifier={
						add = 10
						501 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier={
						add = -12
						501 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -25
						501 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					501={
						set_state_flag = coffee_economy_farm
					}
				}
				20 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_sao_paulo_cotton_farm
					modifier={
						add = 8
						501 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier={
						add = -10
						501 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -20
						501 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					501={
						set_state_flag=coffee_economy_cotton_farm
					}
				}
				15 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_sao_paulo_fabric_weavery
					modifier={
						add = 0
						501 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier={
						add = 13
						501 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 15
						501 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					501={
						set_state_flag=coffee_economy_fabric_weavery
					}
				}
				15 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_sao_paulo_logging_camp
					modifier={
						add = 7
						501 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier={
						add = -3
						501 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -15
						501 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					501={
						set_state_flag=coffee_economy_logging_camp
					}
				}
				10 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_sao_paulo_dockyard
					modifier={
						add = -10
						501 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier={
						add = 4
						501 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 15
						501 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					501={
						set_state_flag=coffee_economy_dockyard
					}
				}
				10 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_sao_paulo_industrial_complex
					modifier={
						add = -10
						501 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier={
						add = 4
						501 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 15
						501 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					501={
						set_state_flag=coffee_economy_industrial_complex
					}
				}
				5 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_sao_paulo_arms_factory
					modifier={
						add = -5
						501 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier={
						add = 4
						501 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 15
						501 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					501={
						set_state_flag=coffee_economy_arms_factory
					}
				}
			}
			if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy
					add_idea = BRA_coffee_economy2
				}
				add_ideas = { BRA_coffee_barons }
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy2}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy2
					add_idea = BRA_coffee_economy3
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons
					add_idea = BRA_coffee_barons2
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy3}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy3
					add_idea = BRA_coffee_economy4
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons2
					add_idea = BRA_coffee_barons3
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy4}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy4
					add_idea = BRA_coffee_economy5
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons3
					add_idea = BRA_coffee_barons4
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy5}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy5
					add_idea = BRA_coffee_economy6
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons4
					add_idea = BRA_coffee_barons5
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy6}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy6
					add_idea = BRA_coffee_economy7
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons5
					add_idea = BRA_coffee_barons6
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy7}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy7
					add_idea = BRA_coffee_economy8
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons6
					add_idea = BRA_coffee_barons7
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy8}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy8
					add_idea = BRA_coffee_economy9
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons7
					add_idea = BRA_coffee_barons8
				}
			}
		}
	}

	BRA_mission_coffee_economy_sao_paulo_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			501={
				has_state_flag=coffee_economy_farm
			}
		}
		available={
			owns_state = 501
			501={
				has_state_flag=coffee_economy_farm
			}
		}
		highlight_states={
			state = 501
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			501={
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_sao_paulo_cotton_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			501={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		available={
			owns_state = 501
			501={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		highlight_states={
			state = 501
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			501={
				add_building_construction = {
					type = cotton_farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_sao_paulo_logging_camp={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			501={
				has_state_flag = coffee_economy_logging_camp
			}
		}
		available={
			owns_state = 501
			501={
				has_state_flag = coffee_economy_logging_camp
			}
		}
		highlight_states={
			state = 501
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			501={
				add_building_construction = {
					type = logging_camp
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_sao_paulo_fabric_weavery={
		icon = generic_construction
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			501={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		available={
			owns_state = 501
			501={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		highlight_states={
			state = 501
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			501={
				add_building_construction = {
					type = fabric_weavery
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_sao_paulo_dockyard={
		icon = generic_naval
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			501={
				has_state_flag=coffee_economy_dockyard
			}
		}
		available={
			owns_state = 501
			501={
				has_state_flag=coffee_economy_dockyard
			}
		}
		highlight_states={
			state = 501
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			501={
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_sao_paulo_industrial_complex={
		icon = generic_factory
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			501={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		available={
			owns_state = 501
			501={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		highlight_states={
			state = 501
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			501={
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_sao_paulo_arms_factory={
		icon = generic_industry
		days_remove = 720
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			501={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		available={
			owns_state = 501
			501={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		highlight_states={
			state = 501
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			501={
				add_building_construction = {
					type = arms_factory
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_decision_coffee_economy_parana={
		icon = money
		available={
			1036 = {is_controlled_by = BRA}
			1036 = {
				NOT = {has_state_flag = coffee_economy}
			}
			has_completed_focus = BRA_expand_coffee_plantations_in_parana
		}
		visible={
			has_completed_focus = BRA_expand_coffee_plantations_in_parana
			tag = BRA
			1036 = {
				NOT = {has_state_flag = coffee_economy}
			}
		}
		#allowed={ original_tag=BRA }
		cost=0

		ai_will_do = {
			base = 10
		}

		complete_effect={
			1036 ={
				add_building_construction={
					type=infrastructure
					level = 1
					instant_build = no
				}
				add_building_construction = {
					type = naval_base
					level = 1
					province = 14024
					instant_build = no
				}
				add_building_construction = {
					type = farm
					level = 1
					instant_build = no
				}
				set_state_flag={
					flag = coffee_economy
					days = 1600
					value = 1
				}
			}
			activate_mission = BRA_mission_coffee_economy_parana
			unlock_decision_tooltip = BRA_decision_coffee_economy_parana_free_workers
			unlock_decision_tooltip = BRA_decision_coffee_economy_parana_slave_workers
		}
	}

	BRA_decision_coffee_economy_parana_free_workers={
		icon = generic_civil_support
		#allowed={ original_tag=BRA }
		available = {
			1036 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			1036 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		state_target = yes
		targets = { 1036 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = coffee_economy
			}
		}
		cost = 75
		days_remove = 28
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1036={
				set_state_flag=coffee_economy_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
						state_production_speed_naval_base_factor = 0.25
					}
				}
			}
		}
	}

	BRA_decision_coffee_economy_parana_slave_workers={
		icon = generic_independence
		#allowed={ original_tag=BRA }
		available = {
			#has_country_flag = brazil_coffee_economy_parana
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		state_target = yes
		targets = { 1036 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		cost = 50
		days_remove = 28
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.01
		}
		remove_effect={
			1036={
				set_state_flag = coffee_economy_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
						state_production_speed_naval_base_factor = 0.15
					}
				}
			}
		}
	}

	BRA_mission_coffee_economy_parana={
		icon = railway
		days_mission_timeout = 1600
		allowed={ always = no}
		available={
			1036 = {
				infrastructure > 3
				naval_base > 0
				farm > 0
			}
			owns_state = 1036
		}
		activation = { always = no }
		highlight_states={
			state = 1036
		}
		state_target = yes
		targets = { 1036 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		is_good=no
		selectable_mission=yes
		timeout_effect={
			1036 = {
				clr_state_flag = coffee_economy
				if={
					limit={ has_state_flag = coffee_economy_maua_company }
					clr_state_flag = coffee_economy_maua_company
				}
				else_if={
					limit={ has_state_flag = coffee_economy_slave_workers}
					clr_state_flag = coffee_economy_slave_workers
				}
				else_if={
					limit={ has_state_flag = coffee_economy_free_workers}
					clr_state_flag = coffee_economy_free_workers
				}
			}
			add_political_power= -100
			add_stability = -0.02
		}
		fixed_random_seed = no
		complete_effect={
			1036 = {
				add_extra_state_shared_building_slots = 2
			}
			add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
			random_list={
				48 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_parana_farm
					modifier = {
						add = 4
						1036 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -24
						1036 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -48
						1036 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1036={
						set_state_flag=coffee_economy_farm
					}
				}
				24 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_parana_logging_camp
					modifier = {
						add = 4
						1036 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -12
						1036 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -18
						1036 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1036={
						set_state_flag=coffee_economy_logging_camp
					}
				}
				12={
					unlock_decision_tooltip = BRA_mission_coffee_economy_parana_coal_mine
					modifier = {
						add = 4
						1036 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -6
						1036 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -9
						1036 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1036={
						set_state_flag=coffee_economy_coal_mine
					}
				}
				6 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_parana_dockyard
					modifier = {
						add = -6
						1036 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 12
						1036 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 25
						1036 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1036={
						set_state_flag=coffee_economy_dockyard
					}
				}
				4 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_parana_industrial_complex
					modifier = {
						add = -4
						1036 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 10
						1036 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 25
						1036 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1036={
						set_state_flag=coffee_economy_industrial_complex
					}
				}
				2 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_parana_arms_factory
					modifier = {
						add = -2
						1036 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 12
						1036 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 25
						1036 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1036={
						set_state_flag=coffee_economy_arms_factory
					}
				}
			}
			if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy
					add_idea = BRA_coffee_economy2
				}
				add_ideas = { BRA_coffee_barons }
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy2}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy2
					add_idea = BRA_coffee_economy3
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons
					add_idea = BRA_coffee_barons2
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy3}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy3
					add_idea = BRA_coffee_economy4
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons2
					add_idea = BRA_coffee_barons3
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy4}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy4
					add_idea = BRA_coffee_economy5
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons3
					add_idea = BRA_coffee_barons4
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy5}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy5
					add_idea = BRA_coffee_economy6
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons4
					add_idea = BRA_coffee_barons5
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy6}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy6
					add_idea = BRA_coffee_economy7
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons5
					add_idea = BRA_coffee_barons6
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy7}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy7
					add_idea = BRA_coffee_economy8
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons6
					add_idea = BRA_coffee_barons7
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy8}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy8
					add_idea = BRA_coffee_economy9
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons7
					add_idea = BRA_coffee_barons8
				}
			}
		}
	}

	BRA_mission_coffee_economy_parana_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1036={
				has_state_flag=coffee_economy_farm
			}
		}
		available={
			owns_state = 1036
			1036={
				has_state_flag=coffee_economy_farm
			}
		}
		highlight_states={
			state = 1036
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1036={
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_parana_logging_camp={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1036={
				has_state_flag = coffee_economy_logging_camp
			}
		}
		available={
			owns_state = 1036
			1036={
				has_state_flag = coffee_economy_logging_camp
			}
		}
		highlight_states={
			state = 1036
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1036={
				add_building_construction = {
					type = logging_camp
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_parana_coal_mine={
		icon = coal
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1036={
				has_state_flag = coffee_economy_coal_mine
			}
		}
		available={
			owns_state = 1036
			1036={
				has_state_flag = coffee_economy_coal_mine
			}
		}
		highlight_states={
			state = 1036
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1036={
				add_building_construction = {
					type = coal_mine
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_parana_dockyard={
		icon = generic_naval
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1036={
				has_state_flag=coffee_economy_dockyard
			}
		}
		available={
			owns_state = 1036
			1036={
				has_state_flag=coffee_economy_dockyard
			}
		}
		highlight_states={
			state = 1036
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1036={
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_parana_industrial_complex={
		icon = generic_factory
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1036={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		available={
			owns_state = 1036
			1036={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		highlight_states={
			state = 1036
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1036={
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_parana_arms_factory={
		icon = generic_industry
		days_remove = 720
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1036={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		available={
			owns_state = 1036
			1036={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		highlight_states={
			state = 1036
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1036={
				add_building_construction = {
					type = arms_factory
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_decision_coffee_economy_minas_gerais={
		icon = money
		available={
			1038 = {is_controlled_by = BRA}
			1038 = {
				NOT = {has_state_flag = coffee_economy}
			}
			has_completed_focus = BRA_expand_coffee_plantations_in_minas_gerais
		}
		visible={
			has_completed_focus = BRA_expand_coffee_plantations_in_minas_gerais
			tag = BRA
			1038 = {
				NOT = {has_state_flag = coffee_economy}
			}
		}
		#allowed={ original_tag=BRA }
		cost=0

		ai_will_do = {
			base = 10
		}

		complete_effect={
			1038 ={
				add_building_construction={
					type=infrastructure
					level = 1
					instant_build=no
				}
				set_state_flag={
					flag = coffee_economy
					days = 1600
					value = 1
				}
				add_building_construction = {
					type = farm
					level = 2
					instant_build = no
				}
			}
			activate_mission = BRA_mission_coffee_economy_minas_gerais
			unlock_decision_tooltip = BRA_decision_coffee_economy_minas_gerais_free_workers
			unlock_decision_tooltip = BRA_decision_coffee_economy_minas_gerais_slave_workers
		}
	}

	BRA_decision_coffee_economy_minas_gerais_free_workers={
		icon = generic_civil_support
		#allowed={ original_tag=BRA }
		available = {
			1038 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			1038 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		state_target = yes
		targets = { 1038 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = coffee_economy
			}
		}
		cost = 75
		days_remove = 28
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1038={
				set_state_flag=coffee_economy_free_workers

				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	BRA_decision_coffee_economy_minas_gerais_slave_workers={
		icon = generic_independence
		#allowed={ original_tag=BRA }
		available = {
			#has_country_flag = brazil_coffee_economy_minas_gerais
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		state_target = yes
		targets = { 1038 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		cost = 50
		days_remove = 28
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.01
		}
		remove_effect={
			1038={
				set_state_flag = coffee_economy_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
						state_production_speed_naval_base_factor = 0.15
					}
				}
			}
		}
	}
	BRA_mission_coffee_economy_minas_gerais={
		icon = railway
		days_mission_timeout = 1600
		allowed={ always = no}
		available={
			1038 = {
				infrastructure > 4
				farm > 1
			}
			owns_state = 1038
		}
		activation = { always = no }
		highlight_states={
			state = 1038
		}
		state_target = yes
		targets = { 1038 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		is_good=no
		selectable_mission=yes
		timeout_effect={
			1038 = {
				clr_state_flag = coffee_economy
				if={
					limit={ has_state_flag = coffee_economy_maua_company }
					clr_state_flag = coffee_economy_maua_company
				}
				else_if={
					limit={ has_state_flag = coffee_economy_slave_workers}
					clr_state_flag = coffee_economy_slave_workers
				}
				else_if={
					limit={ has_state_flag = coffee_economy_free_workers}
					clr_state_flag = coffee_economy_free_workers
				}
			}
			add_political_power= -100
			add_stability = -0.02
		}
		fixed_random_seed = no
		complete_effect={
			1038 = {
				add_extra_state_shared_building_slots = 2
			}
			add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
			random_list={
				25 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_minas_gerais_farm
					modifier = {
						add = 2
						1038 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -12
						1038 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -25
						1038 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1038={
						set_state_flag=coffee_economy_farm
					}
				}
				20 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_minas_gerais_logging_camp
					modifier = {
						add = 1
						1038 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 10
						1038 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -15
						1038 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1038={
						set_state_flag=coffee_economy_logging_camp
					}
				}
				15={
					unlock_decision_tooltip = BRA_mission_coffee_economy_minas_gerais_coal_mine
					modifier = {
						add = 1
						1038 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -7
						1038 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -10
						1038 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1038={
						set_state_flag=coffee_economy_coal_mine
					}
				}
				15={
					unlock_decision_tooltip = BRA_mission_coffee_economy_minas_gerais_cotton_farm
					modifier = {
						add = 1
						1038 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -7
						1038 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -10
						1038 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1038={
						set_state_flag=coffee_economy_cotton_farm
					}
				}
				10 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_minas_gerais_steel_mill
					modifier = {
						add = 0
						1038 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						1038 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 12
						1038 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1038={
						set_state_flag=coffee_economy_steel_mill
					}
				}
				10 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_minas_gerais_fabric_weavery
					modifier = {
						add = 0
						1038 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						1038 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 12
						1038 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1038={
						set_state_flag=coffee_economy_fabric_weavery
					}
				}
				3 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_minas_gerais_industrial_complex
					modifier = {
						add = -3
						1038 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						1038 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 13
						1038 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1038={
						set_state_flag=coffee_economy_industrial_complex
					}
				}
				2 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_minas_gerais_arms_factory
					modifier = {
						add = -2
						1038 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						1038 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 13
						1038 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1038={
						set_state_flag=coffee_economy_arms_factory
					}
				}
			}
			if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy
					add_idea = BRA_coffee_economy2
				}
				add_ideas = { BRA_coffee_barons }
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy2}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy2
					add_idea = BRA_coffee_economy3
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons
					add_idea = BRA_coffee_barons2
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy3}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy3
					add_idea = BRA_coffee_economy4
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons2
					add_idea = BRA_coffee_barons3
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy4}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy4
					add_idea = BRA_coffee_economy5
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons3
					add_idea = BRA_coffee_barons4
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy5}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy5
					add_idea = BRA_coffee_economy6
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons4
					add_idea = BRA_coffee_barons5
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy6}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy6
					add_idea = BRA_coffee_economy7
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons5
					add_idea = BRA_coffee_barons6
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy7}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy7
					add_idea = BRA_coffee_economy8
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons6
					add_idea = BRA_coffee_barons7
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy8}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy8
					add_idea = BRA_coffee_economy9
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons7
					add_idea = BRA_coffee_barons8
				}
			}
		}
	}

	BRA_mission_coffee_economy_minas_gerais_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1038={
				has_state_flag=coffee_economy_farm
			}
		}
		available={
			owns_state = 1038
			1038={
				has_state_flag=coffee_economy_farm
			}
		}
		highlight_states={
			state = 1038
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1038={
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_minas_gerais_cotton_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1038={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		available={
			owns_state = 1038
			1038={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		highlight_states={
			state = 1038
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1038={
				add_building_construction = {
					type = cotton_farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_minas_gerais_logging_camp={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1038={
				has_state_flag = coffee_economy_logging_camp
			}
		}
		available={
			owns_state = 1038
			1038={
				has_state_flag = coffee_economy_logging_camp
			}
		}
		highlight_states={
			state = 1038
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1038={
				add_building_construction = {
					type = logging_camp
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_minas_gerais_coal_mine={
		icon = coal
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1038={
				has_state_flag = coffee_economy_coal_mine
			}
		}
		available={
			owns_state = 1038
			1038={
				has_state_flag = coffee_economy_coal_mine
			}
		}
		highlight_states={
			state = 1038
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1038={
				add_building_construction = {
					type = coal_mine
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_minas_gerais_fabric_weavery={
		icon = generic_construction
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1038={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		available={
			owns_state = 1038
			1038={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		highlight_states={
			state = 1038
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1038={
				add_building_construction = {
					type = fabric_weavery
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_minas_gerais_steel_mill={
		icon = steel
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1038={
				has_state_flag=coffee_economy_steel_mill
			}
		}
		available={
			owns_state = 1038
			1038={
				has_state_flag=coffee_economy_steel_mill
			}
		}
		highlight_states={
			state = 1038
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1038={
				add_building_construction = {
					type = steel_mill
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_minas_gerais_industrial_complex={
		icon = generic_factory
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1038={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		available={
			owns_state = 1038
			1038={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		highlight_states={
			state = 1038
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1038={
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_minas_gerais_arms_factory={
		icon = generic_industry
		days_remove = 720
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1038={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		available={
			owns_state = 1038
			1038={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		highlight_states={
			state = 1038
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1038={
				add_building_construction = {
					type = arms_factory
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_decision_coffee_economy_bahia={
		icon = money
		available={
			499 = {is_controlled_by = BRA}
			499 = {
				NOT = {has_state_flag = coffee_economy}
			}
			has_completed_focus = BRA_expand_coffee_plantations_in_bahia
		}
		visible={
			has_completed_focus = BRA_expand_coffee_plantations_in_bahia
			tag = BRA
			499 = {
				NOT = {has_state_flag = coffee_economy}
			}
		}
		#allowed={ original_tag=BRA }
		cost=0

		ai_will_do = {
			base = 10
		}

		complete_effect={
			499 ={
				add_building_construction={
					type=infrastructure
					level = 1
					instant_build=no
				}
				add_building_construction = {
					type = naval_base
					level = 1
					province = 10946
					instant_build = no
				}
				add_building_construction = {
					type = farm
					level = 1
					instant_build = no
				}
				set_state_flag={
					flag = coffee_economy
					days = 1600
					value = 1
				}
			}
			activate_mission = BRA_mission_coffee_economy_bahia
			unlock_decision_tooltip = BRA_decision_coffee_economy_bahia_free_workers
			unlock_decision_tooltip = BRA_decision_coffee_economy_bahia_slave_workers
		}
	}

	BRA_decision_coffee_economy_bahia_free_workers={
		icon = generic_civil_support
		#allowed={ original_tag=BRA }
		available = {
			499 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			499 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		state_target = yes
		targets = { 499 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = coffee_economy
			}
		}
		cost = 75
		days_remove = 28
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			499={
				set_state_flag=coffee_economy_free_workers

				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
						state_production_speed_naval_base_factor = 0.25
					}
				}
			}
		}
	}

	BRA_decision_coffee_economy_bahia_slave_workers={
		icon = generic_independence
		#allowed={ original_tag=BRA }
		available = {
			#has_country_flag = brazil_coffee_economy_bahia
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		state_target = yes
		targets = { 499 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		cost = 50
		days_remove = 28
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.01
		}
		remove_effect={
			499={
				set_state_flag = coffee_economy_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
						state_production_speed_naval_base_factor = 0.15
					}
				}
			}
		}
	}
	BRA_mission_coffee_economy_bahia={
		icon = railway
		days_mission_timeout = 1600
		allowed={ always = no}
		available={
			499 = {
				infrastructure > 3
				naval_base > 2
				farm > 1
			}
			owns_state = 499
		}
		activation = { always = no }
		highlight_states={
			state = 499
		}
		state_target = yes
		targets = { 499 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		is_good=no
		selectable_mission=yes
		timeout_effect={
			499 = {
				clr_state_flag = coffee_economy
				if={
					limit={ has_state_flag = coffee_economy_maua_company }
					clr_state_flag = coffee_economy_maua_company
				}
				else_if={
					limit={ has_state_flag = coffee_economy_slave_workers}
					clr_state_flag = coffee_economy_slave_workers
				}
				else_if={
					limit={ has_state_flag = coffee_economy_free_workers}
					clr_state_flag = coffee_economy_free_workers
				}
			}
			add_political_power= -100
			add_stability = -0.02
		}
		fixed_random_seed = no
		complete_effect={
			499 = {
				add_extra_state_shared_building_slots = 2
			}
			add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
			random_list={
				25 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_bahia_farm
					modifier = {
						add = 2
						499 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -12
						499 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -25
						499 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					499={
						set_state_flag=coffee_economy_farm
					}
				}
				20 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_bahia_logging_camp
					modifier = {
						add = 1
						499 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -10
						499 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -15
						499 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					499={
						set_state_flag=coffee_economy_logging_camp
					}
				}
				15={
					unlock_decision_tooltip = BRA_mission_coffee_economy_bahia_coal_mine
					modifier = {
						add = 1
						499 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -7
						499 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -10
						499 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					499={
						set_state_flag=coffee_economy_coal_mine
					}
				}
				20={
					unlock_decision_tooltip = BRA_mission_coffee_economy_bahia_cotton_farm
					modifier = {
						add = 1
						499 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -7
						499 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -10
						499 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					499={
						set_state_flag=coffee_economy_cotton_farm
					}
				}
				12 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_bahia_fabric_weavery
					modifier = {
						add = 0
						499 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						499 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 12
						499 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					499={
						set_state_flag=coffee_economy_fabric_weavery
					}
				}
				3 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_bahia_dockyard
					modifier = {
						add = 0
						499 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						499 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 12
						499 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					499={
						set_state_flag=coffee_economy_dockyard
					}
				}
				3 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_bahia_industrial_complex
					modifier = {
						add = -3
						499 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						499 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 13
						499 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					499={
						set_state_flag=coffee_economy_industrial_complex
					}
				}
				2 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_bahia_arms_factory
					modifier = {
						add = -2
						499 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 9
						499 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 13
						499 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					499={
						set_state_flag=coffee_economy_arms_factory
					}
				}
			}
			if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy
					add_idea = BRA_coffee_economy2
				}
				add_ideas = { BRA_coffee_barons }
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy2}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy2
					add_idea = BRA_coffee_economy3
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons
					add_idea = BRA_coffee_barons2
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy3}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy3
					add_idea = BRA_coffee_economy4
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons2
					add_idea = BRA_coffee_barons3
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy4}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy4
					add_idea = BRA_coffee_economy5
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons3
					add_idea = BRA_coffee_barons4
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy5}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy5
					add_idea = BRA_coffee_economy6
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons4
					add_idea = BRA_coffee_barons5
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy6}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy6
					add_idea = BRA_coffee_economy7
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons5
					add_idea = BRA_coffee_barons6
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy7}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy7
					add_idea = BRA_coffee_economy8
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons6
					add_idea = BRA_coffee_barons7
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy8}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy8
					add_idea = BRA_coffee_economy9
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons7
					add_idea = BRA_coffee_barons8
				}
			}
		}
	}

	BRA_mission_coffee_economy_bahia_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			499={
				has_state_flag=coffee_economy_farm
			}
		}
		available={
			owns_state = 499
			499={
				has_state_flag=coffee_economy_farm
			}
		}
		highlight_states={
			state = 499
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			499={
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_bahia_cotton_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			499={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		available={
			owns_state = 499
			499={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		highlight_states={
			state = 499
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			499={
				add_building_construction = {
					type = cotton_farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_bahia_logging_camp={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			499={
				has_state_flag = coffee_economy_logging_camp
			}
		}
		available={
			owns_state = 499
			499={
				has_state_flag = coffee_economy_logging_camp
			}
		}
		highlight_states={
			state = 499
		}
		#is_good=yes
		
		ai_will_do = {
			base = 5
		}
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			499={
				add_building_construction = {
					type = logging_camp
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_bahia_coal_mine={
		icon = coal
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			499={
				has_state_flag = coffee_economy_coal_mine
			}
		}
		available={
			owns_state = 499
			499={
				has_state_flag = coffee_economy_coal_mine
			}
		}
		highlight_states={
			state = 499
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			499={
				add_building_construction = {
					type = coal_mine
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_bahia_fabric_weavery={
		icon = generic_construction
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			499={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		available={
			owns_state = 499
			499={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		highlight_states={
			state = 499
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			499={
				add_building_construction = {
					type = fabric_weavery
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_bahia_dockyard={
		icon = generic_naval
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			499={
				has_state_flag=coffee_economy_dockyard
			}
		}
		available={
			owns_state = 499
			499={
				has_state_flag=coffee_economy_dockyard
			}
		}
		highlight_states={
			state = 499
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			499={
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_bahia_industrial_complex={
		icon = generic_factory
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			499={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		available={
			owns_state = 499
			499={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		highlight_states={
			state = 499
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			499={
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_bahia_arms_factory={
		icon = generic_industry
		days_remove = 720
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			499={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		available={
			owns_state = 499
			499={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		highlight_states={
			state = 499
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			499={
				add_building_construction = {
					type = arms_factory
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_decision_coffee_economy_espirito_santo={
		icon = money
		available={
			1039 = {is_controlled_by = BRA}
			1039 = {
				NOT = {has_state_flag = coffee_economy}
			}
			has_completed_focus = BRA_expand_coffee_plantations_in_espirito_santo
		}
		visible={
			has_completed_focus = BRA_expand_coffee_plantations_in_espirito_santo
			tag = BRA
			1039 = {
				NOT = {has_state_flag = coffee_economy}
			}
		}
		#allowed={ original_tag=BRA }
		cost=0

		ai_will_do = {
			base = 10
		}

		complete_effect={
			1039 ={
				add_building_construction={
					type=infrastructure
					level = 1
					instant_build = no
				}
				add_building_construction = {
					type = naval_base
					level = 1
					province = 10999
					instant_build = no
				}
				add_building_construction = {
					type = farm
					level = 1
					instant_build = no
				}
				set_state_flag={
					flag = coffee_economy
					days = 1600
					value = 1
				}
			}
			activate_mission = BRA_mission_coffee_economy_espirito_santo
			unlock_decision_tooltip = BRA_decision_coffee_economy_espirito_santo_free_workers
			unlock_decision_tooltip = BRA_decision_coffee_economy_espirito_santo_slave_workers
		}
	}

	BRA_decision_coffee_economy_espirito_santo_free_workers={
		icon = generic_civil_support
		#allowed={ original_tag=BRA }
		available = {
			1039 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			1039 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		state_target = yes
		targets = { 1039 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = coffee_economy
			}
		}
		cost = 75
		days_remove = 28
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1039={
				set_state_flag=coffee_economy_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
						state_production_speed_naval_base_factor = 0.25
					}
				}
			}
		}
	}

	BRA_decision_coffee_economy_espirito_santo_slave_workers={
		icon = generic_independence
		#allowed={ original_tag=BRA }
		available = {
			#has_country_flag = brazil_coffee_economy_espirito_santo
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			FROM = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		state_target = yes
		targets = { 1039 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		cost = 50
		days_remove = 28

		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.01
		}
		remove_effect={
			1039={
				set_state_flag = coffee_economy_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
						state_production_speed_naval_base_factor = 0.15
					}
				}
			}
		}
	}

	BRA_mission_coffee_economy_espirito_santo={
		icon = railway
		days_mission_timeout = 1600
		allowed={ always = no}
		available={
			1039 = {
				infrastructure > 3
				naval_base > 0
				farm > 0
			}
			owns_state = 1039
		}
		activation = { always = no }
		highlight_states={
			state = 1039
		}
		state_target = yes
		targets = { 1039 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		is_good=no
		selectable_mission=yes
		timeout_effect={
			1039 = {
				clr_state_flag = coffee_economy
				if={
					limit={ has_state_flag = coffee_economy_maua_company }
					clr_state_flag = coffee_economy_maua_company
				}
				else_if={
					limit={ has_state_flag = coffee_economy_slave_workers}
					clr_state_flag = coffee_economy_slave_workers
				}
				else_if={
					limit={ has_state_flag = coffee_economy_free_workers}
					clr_state_flag = coffee_economy_free_workers
				}
			}
			add_political_power= -100
			add_stability = -0.02
		}
		fixed_random_seed = no
		complete_effect={
			1039 = {
				add_extra_state_shared_building_slots = 2
			}
			add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
			random_list={
				48 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_espirito_santo_farm
					modifier = {
						add = 4
						1039 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -24
						1039 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -48
						1039 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1039={
						set_state_flag=coffee_economy_farm
					}
				}
				24 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_espirito_santo_logging_camp
					modifier = {
						add = 4
						1039 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -12
						1039 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -18
						1039 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1039={
						set_state_flag=coffee_economy_logging_camp
					}
				}
				12={
					unlock_decision_tooltip = BRA_mission_coffee_economy_espirito_santo_coal_mine
					modifier = {
						add = 4
						1039 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -6
						1039 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -9
						1039 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1039={
						set_state_flag=coffee_economy_coal_mine
					}
				}
				6 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_espirito_santo_dockyard
					modifier = {
						add = -6
						1039 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 12
						1039 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 25
						1039 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1039={
						set_state_flag=coffee_economy_dockyard
					}
				}
				4 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_espirito_santo_industrial_complex
					modifier = {
						add = -4
						1039 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 10
						1039 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 25
						1039 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1039={
						set_state_flag=coffee_economy_industrial_complex
					}
				}
				2 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_espirito_santo_arms_factory
					modifier = {
						add = -2
						1039 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 12
						1039 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 25
						1039 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					1039={
						set_state_flag=coffee_economy_arms_factory
					}
				}
			}
			if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy
					add_idea = BRA_coffee_economy2
				}
				add_ideas = { BRA_coffee_barons }
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy2}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy2
					add_idea = BRA_coffee_economy3
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons
					add_idea = BRA_coffee_barons2
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy3}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy3
					add_idea = BRA_coffee_economy4
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons2
					add_idea = BRA_coffee_barons3
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy4}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy4
					add_idea = BRA_coffee_economy5
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons3
					add_idea = BRA_coffee_barons4
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy5}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy5
					add_idea = BRA_coffee_economy6
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons4
					add_idea = BRA_coffee_barons5
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy6}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy6
					add_idea = BRA_coffee_economy7
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons5
					add_idea = BRA_coffee_barons6
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy7}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy7
					add_idea = BRA_coffee_economy8
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons6
					add_idea = BRA_coffee_barons7
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy8}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy8
					add_idea = BRA_coffee_economy9
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons7
					add_idea = BRA_coffee_barons8
				}
			}
		}
	}

	BRA_mission_coffee_economy_espirito_santo_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1039={
				has_state_flag=coffee_economy_farm
			}
		}
		available={
			owns_state = 1039
			1039={
				has_state_flag=coffee_economy_farm
			}
		}
		highlight_states={
			state = 1039
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1039={
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_espirito_santo_logging_camp={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1039={
				has_state_flag = coffee_economy_logging_camp
			}
		}
		available={
			owns_state = 1039
			1039={
				has_state_flag = coffee_economy_logging_camp
			}
		}
		highlight_states={
			state = 1039
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1039={
				add_building_construction = {
					type = logging_camp
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_espirito_santo_coal_mine={
		icon = coal
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1039={
				has_state_flag = coffee_economy_coal_mine
			}
		}
		available={
			owns_state = 1039
			1039={
				has_state_flag = coffee_economy_coal_mine
			}
		}
		highlight_states={
			state = 1039
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1039={
				add_building_construction = {
					type = coal_mine
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_espirito_santo_dockyard={
		icon = generic_naval
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1039={
				has_state_flag=coffee_economy_dockyard
			}
		}
		available={
			owns_state = 1039
			1039={
				has_state_flag=coffee_economy_dockyard
			}
		}
		highlight_states={
			state = 1039
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1039={
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_espirito_santo_industrial_complex={
		icon = generic_factory
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1039={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		available={
			owns_state = 1039
			1039={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		highlight_states={
			state = 1039
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1039={
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_espirito_santo_arms_factory={
		icon = generic_industry
		days_remove = 720
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			1039={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		available={
			owns_state = 1039
			1039={
				has_state_flag=coffee_economy_arms_factory
			}
		}
		highlight_states={
			state = 1039
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			1039={
				add_building_construction = {
					type = arms_factory
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}
	BRA_decision_coffee_economy_west_parana={
		icon = money
		available={
			301 = {is_controlled_by = BRA}
			301 = {
				NOT = {has_state_flag = coffee_economy}
			}
			has_completed_focus = BRA_expand_coffee_plantations_in_parana
		}
		visible={
			has_completed_focus = BRA_expand_coffee_plantations_in_parana
			tag = BRA
			301 = {
				NOT = {has_state_flag = coffee_economy}
			}
		}

		ai_will_do = {
			base = 10
		}

		#allowed={ original_tag=BRA }
		cost=0
		complete_effect={
			301 ={
				add_building_construction={
					type=infrastructure
					level = 1
					instant_build=no
				}
				add_building_construction = {
					type = farm
					level = 1
					instant_build = no
				}
				set_state_flag={
					flag = coffee_economy
					days = 1600
					value = 1
				}
			}
			activate_mission = BRA_mission_coffee_economy_west_parana
			unlock_decision_tooltip = BRA_decision_coffee_economy_west_parana_free_workers
			unlock_decision_tooltip = BRA_decision_coffee_economy_west_parana_slave_workers
		}
	}

	BRA_decision_coffee_economy_west_parana_free_workers={
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			301 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			301 = {
				has_state_flag = coffee_economy
			}
		}
		state_target = yes
		targets = { 301 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = coffee_economy
			}
		}
		cost = 75
		days_remove = 28
		days_re_enable = 1600

		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			301={
				set_state_flag = coffee_economy_free_workers

				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	BRA_decision_coffee_economy_west_parana_slave_workers={
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			301 = {
				has_state_flag = coffee_economy
				NOT = {
					OR={
						has_state_flag = coffee_economy_slave_workers
						has_state_flag = coffee_economy_free_workers
						has_state_flag = coffee_economy_maua_company
					}
				}
			}
		}
		visible = {
			301 = {
				has_state_flag = coffee_economy
			}
		}
		state_target = yes
		targets = { 301 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		cost = 50
		days_remove = 28

		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.01
		}
		remove_effect={
			301={
				set_state_flag = coffee_economy_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_mission_coffee_economy_west_parana={
		icon = railway
		days_mission_timeout = 1600
		allowed={ always = no}
		available={
			301 = {
				infrastructure > 2
				farm > 0
			}
			owns_state = 301
		}
		activation = { always = no }
		highlight_states={
			state = 301
		}
		state_target = yes
		targets = { 301 }
		target_trigger={
			FROM={
				has_state_flag = coffee_economy
				is_owned_by = ROOT
			}
		}
		is_good=no
		selectable_mission=yes
		timeout_effect={
			301 = {
				clr_state_flag = coffee_economy
				if={
					limit={ has_state_flag = coffee_economy_maua_company }
					clr_state_flag = coffee_economy_maua_company
				}
				else_if={
					limit={ has_state_flag = coffee_economy_slave_workers}
					clr_state_flag = coffee_economy_slave_workers
				}
				else_if={
					limit={ has_state_flag = coffee_economy_free_workers}
					clr_state_flag = coffee_economy_free_workers
				}
			}
			add_political_power= -100
			add_stability = -0.02
		}
		fixed_random_seed = no
		complete_effect={
			301 = {
				add_extra_state_shared_building_slots = 2
			}
			add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
			random_list={
				48 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_west_parana_farm
					modifier = {
						add = 3
						301 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -24
						301 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -48
						301 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					301={
						set_state_flag=coffee_economy_farm
					}
				}
				24 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_west_parana_cotton_farm
					modifier = {
						add = 3
						301 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = -12
						301 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = -18
						301 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					301={
						set_state_flag=coffee_economy_cotton_farm
					}
				}
				12 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_west_parana_fabric_weavery
					modifier = {
						add = 0
						301 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 12
						301 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 15
						301 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					301={
						set_state_flag=coffee_economy_fabric_weavery
					}
				}
				6 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_west_parana_steel_mill
					modifier = {
						add = 0
						301 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 12
						301 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 15
						301 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					301={
						set_state_flag=coffee_economy_steel_mill
					}
				}
				4 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_west_parana_industrial_complex
					modifier = {
						add = -4
						301 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 6
						301 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 18
						301 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					301={
						set_state_flag=coffee_economy_industrial_complex
					}
				}
				2 = {
					unlock_decision_tooltip = BRA_mission_coffee_economy_west_parana_arms_factory
					modifier = {
						add = -3
						301 = {
							has_state_flag = coffee_economy_slave_workers
						}
					}
					modifier = {
						add = 6
						301 = {
							has_state_flag = coffee_economy_free_workers
						}
					}
					modifier = {
						add = 18
						301 = {
							has_state_flag = coffee_economy_maua_company
						}
					}
					301={
						set_state_flag=coffee_economy_arms_factory
					}
				}
			}
			if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy
					add_idea = BRA_coffee_economy2
				}
				add_ideas = { BRA_coffee_barons }
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy2}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy2
					add_idea = BRA_coffee_economy3
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons
					add_idea = BRA_coffee_barons2
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy3}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy3
					add_idea = BRA_coffee_economy4
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons4
					add_idea = BRA_coffee_barons3
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy4}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy4
					add_idea = BRA_coffee_economy5
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons3
					add_idea = BRA_coffee_barons4
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy5}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy5
					add_idea = BRA_coffee_economy6
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons4
					add_idea = BRA_coffee_barons5
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy6}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy6
					add_idea = BRA_coffee_economy7
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons5
					add_idea = BRA_coffee_barons6
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy7}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy7
					add_idea = BRA_coffee_economy8
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons6
					add_idea = BRA_coffee_barons7
				}
			}
			else_if = {
				limit = {
					BRA = {has_idea=BRA_coffee_economy8}
				}
				swap_ideas = {
					remove_idea = BRA_coffee_economy8
					add_idea = BRA_coffee_economy9
				}
				swap_ideas = {
					remove_idea = BRA_coffee_barons7
					add_idea = BRA_coffee_barons8
				}
			}
		}
	}

	BRA_mission_coffee_economy_west_parana_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			301={
				has_state_flag = coffee_economy_farm
			}
		}
		available={
			owns_state = 301
			301={
				has_state_flag = coffee_economy_farm
			}
		}
		highlight_states={
			state = 301
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			301={
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_west_parana_cotton_farm={
		icon = generic_construction
		days_remove = 90
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			301={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		available={
			owns_state = 301
			301={
				has_state_flag = coffee_economy_cotton_farm
			}
		}
		highlight_states={
			state = 301
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			301={
				add_building_construction = {
					type = cotton_farm
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_west_parana_fabric_weavery={
		icon = generic_construction
		days_remove = 180
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			301={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		available={
			owns_state = 301
			301={
				has_state_flag = coffee_economy_fabric_weavery
			}
		}
		highlight_states={
			state = 301
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			301={
				add_building_construction = {
					type = fabric_weavery
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_west_parana_steel_mill={
		icon = steel
		fire_only_once = yes
		days_remove = 180
		#allowed={ original_tag=BRA }
		visible={
			301={
				has_state_flag = coffee_economy_steel_mill
			}
		}
		available={
			owns_state = 301
			301={
				has_state_flag = coffee_economy_steel_mill
			}
		}
		highlight_states={
			state = 301
		}
		#is_good=yes
		
		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			301={
				add_building_construction = {
					type = steel_mill
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_west_parana_industrial_complex={
		icon = generic_factory
		days_remove = 360
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			301={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		available={
			owns_state = 301
			301={
				has_state_flag=coffee_economy_industrial_complex
			}
		}
		highlight_states={
			state = 301
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			301={
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}

	BRA_mission_coffee_economy_west_parana_arms_factory={
		icon = generic_industry
		days_remove = 720
		fire_only_once = yes
		#allowed={ original_tag=BRA }
		visible={
			301={
				has_state_flag = coffee_economy_arms_factory
			}
		}
		available={
			owns_state = 301
			301={
				has_state_flag = coffee_economy_arms_factory
			}
		}
		highlight_states={
			state = 301
		}
		#is_good=yes

		ai_will_do = {
			base = 10
		}
		modifier = {
			civilian_factory_use = 1
		}
		remove_effect={
			301={
				add_building_construction = {
					type = arms_factory
					level = 1
					instant_build = yes
				}
			}
		}
		complete_effect = {
			add_political_power = -50
		}
	}
}

BRA_decision_category_modernize_the_empire = {

	BRA_decision_promote_shipbuilding_and_foundry = {
		available = {
			BRA = { has_completed_focus = BRA_dockyard_and_foundry_ponta_da_areia }
		}
		#allowed={ original_tag=BRA }
		visible = {
			BRA = { has_completed_focus = BRA_dockyard_and_foundry_ponta_da_areia }
		}

		fire_only_once = yes
		days_remove = 90
		cost = 100
		modifier = {
			civilian_factory_use = 2
		}

		complete_effect = {
			navy_experience = -20
		}

		remove_effect = {
			add_timed_idea = {
				idea = BRA_shipbuilding_and_foundry_ponta_da_areia
				days = 365
			}
			500 = {
				add_extra_state_shared_building_slots = 2
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
				add_building_construction = {
					type = steel_mill
					level = 1
					instant_build = yes
				}
				add_resource = {
					type = iron
					amount = 5
				}
			}
		}

		ai_will_do = {
			base = 1
		}
	}

	BRA_decision_expand_ipanema_foundry = {
		available = {
			BRA = { has_completed_focus = BRA_expand_ipanema_foundry }
		}
		#allowed={ original_tag=BRA }
		visible = {
			BRA = { has_completed_focus = BRA_expand_ipanema_foundry }
		}

		fire_only_once = yes
		days_remove = 60
		cost = 50
		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {

		}

		remove_effect = {
			501 = {
				add_building_construction = {
					type = steel_mill
					level = 1
					instant_build = yes
				}
				add_resource = {
					type = iron
					amount = 5
				}
			}
		}

		ai_will_do = {
			base = 1
		}
	}

	#BRA_decision_the_recife_and_sao_francisco_railroad = {
	#	icon = railway
	#	available = {
	#		1044 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_recife_and_sao_francisco_road
	#	}

	#	visible = {
	#		1044 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_recife_and_sao_francisco_road
	#	}

	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		1044 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 3
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_recife_and_sao_francisco_railroad
	#		unlock_decision_tooltip = BRA_decision_pernambuco_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_pernambuco_railway_slave_workers
	#	}
	#}

	BRA_decision_pernambuco_railway_slave_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			1044 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}  
				}
			}
		}
		visible = {
			1044 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 1044 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1044 = {
				set_state_flag = railway_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_decision_pernambuco_railway_free_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			1044 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			1044 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 1044 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1044 = {
				set_state_flag = railway_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	#BRA_mission_the_recife_and_sao_francisco_railroad = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		1044 = { infrastructure > 4 }
	#		owns_state = 1044
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 1044
	#	}
	#	state_target = yes
	#	targets = { 1044 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		1044 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 5168 5182 12961 10345 8227 }
	#			start_state = 1044
	#			target_state = 1044
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 8143 14031 }
	#			start_state = 1040
	#			target_state = 1040
	#		}
	#	}
	#	timeout_effect={
	#		1044 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_dom_pedro_ii_railway = {
	#	icon = railway
	#	available = {
	#		1037 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_dom_pedro_ii_railway
	#	}
	#
	#	visible = {
	#		1037 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_dom_pedro_ii_railway
	#	}

	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		1037 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_dom_pedro_ii_railway
	#		unlock_decision_tooltip = BRA_decision_capital_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_capital_railway_slave_workers
	#	}
	#}

	BRA_decision_capital_railway_slave_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			1037 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			1037 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 1037 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1037 = {
				set_state_flag = railway_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_decision_capital_railway_free_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			1037 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			1037 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 1037 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1037 = {
				set_state_flag = railway_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	#BRA_mission_the_dom_pedro_ii_railway = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		1037 = { infrastructure > 5 }
	#		owns_state = 1037
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 1037
	#	}
	#	state_target = yes
	#	targets = { 1037 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		1037 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 12466 14019 5172 13964 }
	#			start_state = 1037
	#			target_state = 500
	#		}
	#	}
	#	timeout_effect={
	#		1037 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_petropolis_road = {
	#	icon = railway
	#	available = {
	#		500 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_petropolis_road
	#	}
	#
	#	visible = {
	#		500 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_petropolis_road
	#	}
	#
	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		500 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_petropolis_road
	#		unlock_decision_tooltip = BRA_decision_rio_de_janeiro_railway_slave_workers
	#		unlock_decision_tooltip = BRA_decision_rio_de_janeiro_railway_free_workers
	#	}
	#}

	BRA_decision_rio_de_janeiro_railway_slave_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			500 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			500 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 500 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			500 = {
				set_state_flag = railway_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_decision_rio_de_janeiro_railway_free_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			500 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			500 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 500 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			500 = {
				set_state_flag = railway_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	#BRA_mission_the_petropolis_road = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		500 = { infrastructure > 3 }
	#		owns_state = 500
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 500
	#	}
	#	state_target = yes
	#	targets = { 500 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		500 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 12466 14019 10980 }
	#			start_state = 1037
	#			target_state = 500
	#		}
	#	}
	#	timeout_effect={
	#		500 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_tijuca_railway = {
	#	icon = railway
	#	available = {
	#		1037 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_tijuca_railway
	#	}
	#
	#	visible = {
	#		1037 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_tijuca_railway
	#	}
	#
	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		1037 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_tijuca_railway
	#		unlock_decision_tooltip = BRA_decision_capital_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_capital_railway_slave_workers
	#	}
	#}

	#BRA_mission_the_tijuca_railway = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		1037 = { infrastructure > 6 }
	#		owns_state = 1037
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 1037
	#	}
	#	state_target = yes
	#	targets = { 1037 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		1037 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 12466 14019 }
	#			start_state = 1037
	#			target_state = 500
	#		}
	#	}
	#	timeout_effect={
	#		1037 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	BRA_decision_the_sobral_railway = {
		icon = railway
		available = {
			1041 = { is_controlled_by = BRA }
			has_completed_focus = BRA_the_sobral_railway
		}

		visible = {
			1041 = { is_controlled_by = BRA }
			has_completed_focus = BRA_the_sobral_railway
		}
		
		ai_will_do = {
			base = 10
		}

		#allowed={ original_tag=BRA }
		fire_only_once = yes
		complete_effect = {
			1041 = {
				add_building_construction = {
					type = infrastructure
					level = 3
					instant_build = no
				}
				set_state_flag = {
					flag = railway
					days = 1600
					value = 1
				}
			}
			activate_mission = BRA_mission_the_sobral_railway
			unlock_decision_tooltip = BRA_decision_ceara_railway_free_workers
			unlock_decision_tooltip = BRA_decision_ceara_railway_slave_workers
		}
	}

	BRA_decision_ceara_railway_slave_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			1041 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			1041 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 1041 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1041 = {
				set_state_flag = railway_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_decision_ceara_railway_free_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			1041 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			1041 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 1041 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1041 = {
				set_state_flag = railway_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	BRA_mission_the_sobral_railway = {
		icon = railway
		days_mission_timeout = 1600
		allowed = { always = no }
		available = {
			1041 = { infrastructure > 5 }
			owns_state = 1041
		}
		activation = { always = no }
		highlight_states = {
			state = 1041
		}
		state_target = yes
		targets = { 1041 }
		target_trigger = {
			FROM={
				has_state_flag = railway
				is_owned_by = ROOT
			}
		}
		is_good = no
		selectable_mission = yes
		complete_effect = {
			add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
			1041 = {
				add_extra_state_shared_building_slots = 1
			}
			build_railway = {
				level = 1
				path = { 5107 8179 2164 }
				start_state = 1041
				target_state = 1041
			}
			build_railway = {
				level = 1
				path = { 2132 2178 5153 }
				start_state = 1041
				target_state = 504
			}
		}
		timeout_effect={
			1041 = {
				clr_state_flag = railway
				if = {
					limit = { has_state_flag = railway_free_workers }
					clr_state_flag = railway_free_workers
				}
				else_if = {
					limit = { has_state_flag = railway_slave_workers }
					clr_state_flag = railway_slave_workers
				}
			}
			add_political_power= -150
			add_stability = -0.01
		}
	}

	#BRA_decision_the_bahia_and_sao_francisco_railroad = {
	#	icon = railway
	#	available = {
	#		499 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_bahia_and_sao_francisco_railroad
	#	}
	#
	#	visible = {
	#		499 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_bahia_and_sao_francisco_railroad
	#	}
	#
	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		499 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_bahia_and_sao_francisco_railroad
	#		unlock_decision_tooltip = BRA_decision_bahia_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_bahia_railway_slave_workers
	#	}
	#}

	BRA_decision_bahia_railway_slave_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			499 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			499 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 499 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			499 = {
				set_state_flag = railway_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_decision_bahia_railway_free_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			499 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			499 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 499 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			499 = {
				set_state_flag = railway_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	#BRA_mission_the_bahia_and_sao_francisco_railroad = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		499 = { infrastructure > 3 }
	#		owns_state = 499
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 499
	#	}
	#	state_target = yes
	#	targets = { 499 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		499 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 10946 14027 14028 1430 4617 8242 }
	#			start_state = 499
	#			target_state = 499
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 10946 14029 14031 }
	#			start_state = 499
	#			target_state = 499
	#		}
	#	}
	#	timeout_effect={
	#		499 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_sao_paulo_railway = {
	#	icon = railway
	#	available = {
	#		501 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_sao_paulo_main_railway
	#	}
	#
	#	visible = {
	#		501 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_sao_paulo_main_railway
	#	}
	#
	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		501 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 2
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_sao_paulo_railway
	#		unlock_decision_tooltip = BRA_decision_sao_paulo_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_sao_paulo_railway_slave_workers
	#	}
	#}

	BRA_decision_sao_paulo_railway_slave_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			501 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			501 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 501 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			501 = {
				set_state_flag = railway_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_decision_sao_paulo_railway_free_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			501 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			501 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 501 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			501 = {
				set_state_flag = railway_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	#BRA_mission_the_sao_paulo_railway = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		501 = { infrastructure > 5 }
	#		owns_state = 501
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 501
	#	}
	#	state_target = yes
	#	targets = { 501 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		501 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 5112 10513 14042 10947 11003 1583 }
	#			start_state = 501
	#			target_state = 501
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 10513 14041 10360 12972 11003 10994 }
	#			start_state = 501
	#			target_state = 501
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 10513 14042 14056 11008 }
	#			start_state = 501
	#			target_state = 501
	#		}
	#	}
	#	timeout_effect={
	#		501 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_north_railroad = {
	#	icon = railway
	#	available = {
	#		501 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_north_railroad
	#	}

	#	visible = {
	#		501 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_north_railroad
	#	}

	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		501 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_north_railroad
	#		unlock_decision_tooltip = BRA_decision_sao_paulo_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_sao_paulo_railway_slave_workers
	#	}
	#}

	#BRA_mission_the_north_railroad = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		501 = { infrastructure > 3 }
	#		owns_state = 501
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 501
	#	}
	#	state_target = yes
	#	targets = { 501 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		501 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 14017 14016 14018 }
	#			start_state = 501
	#			target_state = 500
	#		}
	#	}
	#	timeout_effect={
	#		501 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_leopoldina_railway = {
	#	icon = railway
	#	available = {
	#		1038 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_leopoldina_railway
	#	}

	#	visible = {
	#		1038 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_leopoldina_railway
	#	}

	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		1038 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_leopoldina_railway
	#		unlock_decision_tooltip = BRA_decision_minas_gerais_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_minas_gerais_railway_slave_workers
	#	}
	#}

	BRA_decision_minas_gerais_railway_slave_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			1038 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			1038 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 1038 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1038 = {
				set_state_flag = railway_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_decision_minas_gerais_railway_free_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			1038 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			1038 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 1038 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1038 = {
				set_state_flag = railway_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	#BRA_mission_the_leopoldina_railway = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		1038 = { infrastructure > 2 }
	#		owns_state = 1038
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 1038
	#	}
	#	state_target = yes
	#	targets = { 1038 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		1038 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 12334  8226 7589 4570 }
	#			start_state = 1038
	#			target_state = 1038
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 12334 12996 }
	#			start_state = 1038
	#			target_state = 500
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 12996 13965 2153 4570}
	#			start_state = 1038
	#			target_state = 1039
	#		}
	#	}
	#	timeout_effect={
	#		1038 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_maua_railway = {
	#	icon = railway
	#	available = {
	#		500 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_maua_railway
	#	}

	#	visible = {
	#		500 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_maua_railway
	#	}

	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		500 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_maua_railway
	#		unlock_decision_tooltip = BRA_decision_rio_de_janeiro_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_rio_de_janeiro_railway_slave_workers
	#	}
	#}

	#BRA_mission_the_maua_railway = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		500 = { infrastructure > 4 }
	#		owns_state = 500
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 500
	#	}
	#	state_target = yes
	#	targets = { 500 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		500 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 12466 14019 10980 13983 5172 13964 }
	#			start_state = 1037
	#			target_state = 500
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 13964 12334 }
	#			start_state = 500
	#			target_state = 1038
	#		}
	#	}
	#	timeout_effect={
	#		500 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_paulista_railway = {
	#	icon = railway
	#	available = {
	#		501 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_paulista_railway
	#	}

	#	visible = {
	#		501 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_paulista_railway
	#	}

	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		501 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_the_paulista_railway
	#		unlock_decision_tooltip = BRA_decision_sao_paulo_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_sao_paulo_railway_slave_workers
	#	}
	#}

	#BRA_mission_the_the_paulista_railway = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		501 = { infrastructure > 6 }
	#		owns_state = 501
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 501
	#	}
	#	state_target = yes
	#	targets = { 501 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		501 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 10513 14041 10360 14040 12438 }
	#			start_state = 501
	#			target_state = 501
	#		}
	#	}
	#	timeout_effect={
	#		501 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_porto_alegre_and_new_hamburgo_railway = {
	#	icon = railway
	#	available = {
	#		502 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_porto_alegre_and_new_hamburgo_railway
	#	}
	#
	#	visible = {
	#		502 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_porto_alegre_and_new_hamburgo_railway
	#	}
	#
	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		502 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_porto_alegre_and_new_hamburgo_railway
	#		unlock_decision_tooltip = BRA_decision_rio_grande_do_sul_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_rio_grande_do_sul_railway_slave_workers
	#	}
	#}

	BRA_decision_rio_grande_do_sul_railway_slave_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			502 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			502 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 502 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			502 = {
				set_state_flag = railway_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_decision_rio_grande_do_sul_railway_free_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			502 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			502 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 502 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			502 = {
				set_state_flag = railway_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	#BRA_mission_the_porto_alegre_and_new_hamburgo_railway = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		502 = { infrastructure > 4 }
	#		owns_state = 502
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 502
	#	}
	#	state_target = yes
	#	targets = { 502 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		502 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 10447 14014 }
	#			start_state = 502
	#			target_state = 502
	#		}
	#
	#		build_railway = {
	#			level = 1
	#			path = { 4436 7594 14051 4586 }
	#			start_state = 502
	#			target_state = 502
	#		}
	#
	#		build_railway = {
	#			level = 1
	#			path = { 15221 4051 }
	#			start_state = 502
	#			target_state = 502
	#		}
	#
	#		build_railway = {
	#			level = 1
	#			path = { 1585 4575 }
	#			start_state = 502
	#			target_state = 502
	#		}
	#
	#		build_railway = {
	#			level = 1
	#			path = { 14012 7638 4604 }
	#			start_state = 502
	#			target_state = 502
	#		}
	#	}
	#	timeout_effect={
	#		502 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_paranagua_curitiba_railway = {
	#	icon = railway
	#	available = {
	#		1036 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_paranagua_curitiba_railway
	#	}

	#	visible = {
	#		1036 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_paranagua_curitiba_railway
	#	}
	#
	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		1036 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_paranagua_curitiba_railway
	#		unlock_decision_tooltip = BRA_decision_parana_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_parana_railway_slave_workers
	#	}
	#}

	BRA_decision_parana_railway_slave_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_independence
		available = {
			1036 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			1036 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 1036 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -520
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1036 = {
				set_state_flag = railway_slave_workers

				add_manpower = 2080
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.15
					}
				}
			}
		}
	}

	BRA_decision_parana_railway_free_workers = {
		#allowed={ original_tag=BRA }
		icon = generic_civil_support
		available = {
			1036 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_slave_workers
						has_state_flag = railway_free_workers
					}
				}
			}
		}
		visible = {
			1036 = {
				has_state_flag = railway
				NOT = {
					OR = {
						has_state_flag = railway_free_workers
						has_state_flag = railway_slave_workers
					}
				}
			}
		}
		state_target = yes
		targets = { 1036 }
		target_trigger={
			FROM={
				is_owned_by = ROOT
				has_state_flag = railway
			}
		}
		cost = 75
		days_remove = 28
		#days_re_enable = 1600
		
		ai_will_do = {
			base = 5
		}
		modifier = {
			weekly_manpower = -748
			consumer_goods_expected_value = 0.02
		}
		remove_effect={
			1036 = {
				set_state_flag = railway_free_workers
				add_manpower = 2992
				add_state_modifier = {
					modifier = {
						state_production_speed_infrastructure_factor = 0.25
					}
				}
			}
		}
	}

	#BRA_mission_the_paranagua_curitiba_railway = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		1036 = { infrastructure > 3 }
	#		owns_state = 1036
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 1036
	#	}
	#	state_target = yes
	#	targets = { 1036 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		1036 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 14024 8181 14055 }
	#			start_state = 1036
	#			target_state = 1036
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 8181 8239 }
	#			start_state = 1036
	#			target_state = 301
	#		}
	#		build_railway = {
	#			level = 1
	#			path = { 8181 5156 }
	#			start_state = 1036
	#			target_state = 301
	#		}
	#	}
	#	timeout_effect={
	#		1036 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	#BRA_decision_the_trams_in_niteroi = {
	#	icon = railway
	#	available = {
	#		500 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_trams_in_niteroi
	#	}
	#
	#	visible = {
	#		500 = { is_controlled_by = BRA }
	#		has_completed_focus = BRA_the_trams_in_niteroi
	#	}
	#
	#	#allowed={ original_tag=BRA }
	#	fire_only_once = yes
	#	complete_effect = {
	#		500 = {
	#			add_building_construction = {
	#				type = infrastructure
	#				level = 1
	#				instant_build = no
	#			}
	#			set_state_flag = {
	#				flag = railway
	#				days = 1600
	#				value = 1
	#			}
	#		}
	#		activate_mission = BRA_mission_the_trams_in_niteroi
	#		unlock_decision_tooltip = BRA_decision_rio_de_janeiro_railway_free_workers
	#		unlock_decision_tooltip = BRA_decision_rio_de_janeiro_railway_slave_workers
	#	}
	#}

	#BRA_mission_the_trams_in_niteroi = {
	#	icon = railway
	#	days_mission_timeout = 1600
	#	allowed = { always = no }
	#	available = {
	#		500 = { infrastructure > 6 }
	#		owns_state = 500
	#	}
	#	activation = { always = no }
	#	highlight_states = {
	#		state = 500
	#	}
	#	state_target = yes
	#	targets = { 500 }
	#	target_trigger = {
	#		FROM={
	#			has_state_flag = railway
	#			is_owned_by = ROOT
	#		}
	#	}
	#	is_good = no
	#	selectable_mission = yes
	#	complete_effect = {
	#		add_tech_bonus = { bonus = 0.25 uses = 1 category = transport_tech }
	#		500 = {
	#			add_extra_state_shared_building_slots = 1
	#		}
	#	}
	#	timeout_effect={
	#		500 = {
	#			clr_state_flag = railway
	#			if = {
	#				limit = { has_state_flag = railway_free_workers }
	#				clr_state_flag = railway_free_workers
	#			}
	#			else_if = {
	#				limit = { has_state_flag = railway_slave_workers }
	#				clr_state_flag = railway_slave_workers
	#			}
	#		}
	#		add_political_power= -150
	#		add_stability = -0.01
	#	}
	#}

	BRA_decision_rio_de_janeiro_industrial_complex = {
		icon = generic_factory
		available = {
			BRA = { has_completed_focus = BRA_construct_industrial_centers_in_rio_de_janeiro }
		}
		visible = {
			BRA = { has_completed_focus = BRA_construct_industrial_centers_in_rio_de_janeiro }
		}
		ai_will_do = {
			base = 10
		}

		#allowed={ original_tag=BRA }
		cost = 100
		fire_only_once = yes
		days_remove = 28
		modifier = {
			consumer_goods_expected_value = 0.05
			weekly_manpower = -1001
		}
		timeout_effect = {
			500 = {
				add_dynamic_modifier = {
					modifier = dynmod_BRA_industrial_complex_bonus
					days = 360
				}
				add_manpower = 4004
			}
		}
	}

	BRA_decision_sao_paulo_industrial_complex = {
		icon = generic_factory
		available = {
			BRA = { has_completed_focus = BRA_construct_industrial_centers_in_sao_paulo }
		}
		visible = {
			BRA = { has_completed_focus = BRA_construct_industrial_centers_in_sao_paulo }
		}
		#allowed={ original_tag=BRA }
		cost = 100
		fire_only_once = yes
		days_remove = 28
		ai_will_do = {
			base = 10
		}

		modifier = {
			consumer_goods_expected_value = 0.05
			weekly_manpower = -1001
		}
		timeout_effect = {
			501 = {
				add_dynamic_modifier = {
					modifier = dynmod_BRA_industrial_complex_bonus
					days = 360
				}
				add_manpower = 4004
			}
		}
	}

	BRA_maracana_river_canalization = {
		icon = generic_naval
		available = { BRA = {has_completed_focus = BRA_canalization_of_maracana_river } }
		visible = { BRA = { has_completed_focus = BRA_canalization_of_maracana_river } }
		cost = 50
		fire_only_once = yes
		days_remove = 180
		modifier = {
			production_speed_infrastructure_factor = -0.05
			industrial_capacity_dockyard = -0.05
		}
		complete_effect = {
			1037 = { add_building_construction = { type = infrastructure level = 1 instant_build = yes } }
		}
		highlight_states = {
			state = 1037
		}
		ai_will_do = {
			base = 1000
		}
	}

	BRA_amazon_steam_shipping_company = {
		icon = generic_naval
		available = { BRA = {has_completed_focus = BRA_steam_navegation_company_on_the_amazon_river } }
		visible = { BRA = { has_completed_focus = BRA_steam_navegation_company_on_the_amazon_river } }
		cost = 100
		fire_only_once = yes
		days_remove = 180
		modifier = {
			production_speed_infrastructure_factor = -0.05
			industrial_capacity_dockyard = -0.05
		}
		complete_effect = {
			every_owned_state = {
				limit = {
					OR = {
						state = 495
						state = 496
						state = 1323
					}
				}
				add_building_construction = { type = infrastructure level = 1 instant_build = yes }
			}
		}
		ai_will_do = {
			base = 1000
		}
	}
}

eoanb_category_military = {
}

BRA_BOP_decision_category = {
}

BHA_uprising_decision_category = {
	BHA_mission_recruit_in_Bahia = {
		icon = POL_looming_peasants_strike
		allowed = { 
			TAG = BHA 
		}

		available = {
			BHA = {
				owns_state = 499 
				controls_province = 14026
				controls_province = 14027
				controls_province = 14028 
			}
		}

		days_mission_timeout = 30

		visible = {
			AND = {
				TAG = BHA
				BRA = {
					has_country_flag = bahia_revolution
				}
			}
		}

		activation = { 
			BRA = {
				has_country_flag = bahia_revolution
			}
		}

		priority = 49
		complete_effect = {
			BHA = {
				country_event = {
					id = bahia.2 
					days = 0
				}
			}
		}

		cancel_trigger = {
        	BRA = {
				owns_state = 499
			}
    	}
	}

	Second_Males_Revolt_Peace_Treaty_Mission = {
		icon = generic_political_actions
		allowed = { always = no }
		activation = { always = no }

		is_good = no
		days_mission_timeout = 200

		available = {
			OR = {
				custom_trigger_tooltip = {
					tooltip = Second_Males_Revolt_Mission_Brazil_WIN
					# Victory Condition for X_country
					tag = BRA
					BRA = { controls_province = 10946 }
				}
				custom_trigger_tooltip = {
					tooltip = Second_Males_Revolt_Mission_Bahia_WIN
					# Victory Condition for Y_country
					tag = BHA
					BHA = { controls_province = 5168 }
				}
			}
		}

		complete_effect = {
			if = {
				limit = {
					tag = BRA
					# Victory Condition for X_country
					controls_province = 10946
				}
				# Peace Treaty Event for X_country victory
				BRA = { country_event = { id = bahia.3 } }
				
			}
			if = {
				limit = {
					tag = BHA
					# Victory Condition for Y_country
					controls_province = 5168
				}
				# Peace Treaty for Y_country victory
				BRA = { country_event = { id = bahia.4 } }
			}
		}

		timeout_effect = {
			if = {
				limit = {
					OR = {
						AND = {
							tag = BRA
							has_war_with = BHA
						}
						AND = {
							tag = BHA
							has_war_with = BRA
						}
					}
				}
				#date < 1857.11.27
				# Peace Treaty for Y_country victory
				BRA = { country_event = { id = bahia.5 } }
			}
		}
	}

}

BRA_platinean_diplomacy_category = {
#	BRA_mission_uruguay = {
#		fire_only_once = yes
#
#		allowed = {
#			original_tag = BRA
#		}
#
#		available = {
#			NO
#			#BRA = {
#				#has_completed_focus = BRA_diplomatic_mission_platinean
#			#}
#		}
#
#		visible = {
#			NO
#			#BRA = {
#				#has_completed_focus = BRA_diplomatic_mission_platinean
#			#}
#		}
#
#		priority = 50
#		cost = 0
#
#		complete_effect = {
#			add_opinion_modifier = {
#				target = URG
#				modifier = eoanb_minor_opinion_boost
#			}
#		}
#	}
#	BRA_mission_paraguay = {
#		fire_only_once = yes
#
#		allowed = {
#			original_tag = BRA
#		}
#
#		available = {
#			#BRA = {
#				#has_completed_focus = BRA_diplomatic_mission_platinean
#			#}
#		}
#
#		visible = {
#			#BRA = {
#				#has_completed_focus = BRA_diplomatic_mission_platinean
#			#}
#		}
#
#		priority = 50
#		cost = 0
#
#		complete_effect = {
#			add_opinion_modifier = {
#				target = PAR
#				modifier = eoanb_minor_opinion_boost
#			}
#		}
#	}
#	BRA_mission_argentina = {
#		fire_only_once = yes
#
#		allowed = {
#			original_tag = BRA
#		}
#
#		available = {
#			BRA = {
#				#has_completed_focus = BRA_diplomatic_mission_platinean
#			}
#		}
#
#		#visible = {			
#			BRA = {
#				#has_completed_focus = BRA_diplomatic_mission_platinean
#			}
#		}
#
#		priority = 50
#		cost = 0
#
#		complete_effect = {
#			country_event = {id = brazil.316 days = 0}
#		}
#	}
#	BRA_treaty_argentina = {
#		fire_only_once = yes
#
#		allowed = {
#			original_tag = BRA
#		}
#
#		available = {
#			BRA = {
#				AND = {
#					#has_completed_focus = BRA_diplomatic_mission_platinean
#					has_country_flag = BRA_supported_confederation
#				}
#			}
#		}
#
#		visible = {
#			BRA = {
#				AND = {
#					#has_completed_focus = BRA_diplomatic_mission_platinean
#					has_country_flag = BRA_supported_confederation
#				}
#			}
#		}
#
#		priority = 50
#		cost = 0
#		complete_effect = {
#			BRA = {
#				country_event = { id = brazil_votes.23 days = 0}
#			}
#		}
#	}
}

#BRA_decision_category_colonies = {
#	icon = generic_construction
#}
# Amazon basin colonization company
#