generic_militia_category = {

	summon_peoples_militia = {
	
		icon = generic_military
		
		available = {
			any_owned_state = {
				impassable = no
				#is_in_home_area = yes
				NOT = { is_controlled_by = ROOT }
			}
			OR = {
				surrender_progress > 0.75
				capital_scope = {
					any_neighbor_state = {
						NOT = { is_controlled_by = ROOT }
					}
				}
			}
			custom_trigger_tooltip = {
				check_variable = { peoples_militia_var > 0 }
				tooltip = summon_peoples_militia_trigger_tt
			}
		}
		visible = {
		}
		
		fire_only_once = yes
		days_remove = 1
		
		remove_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): remove decision summon_peoples_militia"
			set_country_flag = summon_peoples_militia_flag
			if = {
				limit = { check_variable = { peoples_militia_var = 1 } }
				custom_effect_tooltip = summon_peoples_militia_tt
			}
			else = {
				custom_effect_tooltip = summon_peoples_militia_tt_many
			}
			give_actual_militia_template = yes
			set_temp_variable = { num_of_cycle = peoples_militia_var }
			while_loop_effect = {
				limit = { check_variable = { num_of_cycle > 0 } }
				add_to_temp_variable = { num_of_cycle = -1 }
				random_owned_state = {
					limit = {
						impassable = no
						#is_in_home_area = yes
						NOT = { is_controlled_by = ROOT }
					}
					create_unit = {
						division = "name = \"Peoples Militia\" division_template = \"Peoples Militia\" start_experience_factor = 0.2" 
						owner = ROOT
						count = 1
						allow_spawning_on_enemy_provs = yes
					}
				}
			}
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				add = 50
				ai_wants_divisions > 0
			}
			modifier = {
				add = 50
				enemies_strength_ratio > 1
			}
		}
	}
	
	train_peoples_militia = {
	
		icon = generic_prepare_civil_war
		
		available = {
			set_temp_variable = { need_manpower_temp = 1000 }
			set_temp_variable = { need_infantry_equipment_temp = 100 }
			multiply_temp_variable = { need_manpower_temp = peoples_militia_template_var }
			multiply_temp_variable = { need_infantry_equipment_temp = peoples_militia_template_var }
			has_manpower > need_manpower_temp
			has_equipment = { infantry_equipment > need_infantry_equipment_temp }
		}
		visible = {
		}
		cancel_trigger = {
			has_country_flag = summon_peoples_militia_flag
		}
		
		cost = 10
		days_remove = train_peoples_militia_time_var
		
		complete_effect = {
			set_temp_variable = { need_manpower_temp = -1000 }
			set_temp_variable = { need_infantry_equipment_temp = -100 }
			multiply_temp_variable = { need_manpower_temp = peoples_militia_template_var }
			multiply_temp_variable = { need_infantry_equipment_temp = peoples_militia_template_var }
			add_manpower > need_manpower_temp
			add_equipment_to_stockpile = { type = infantry_equipment amount = need_infantry_equipment_temp }
		}
		
		remove_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): remove decision train_peoples_militia"
			set_temp_variable = { peoples_militia_temp = 1 }
			add_to_variable = { peoples_militia_var = peoples_militia_temp }
			custom_effect_tooltip = train_peoples_militia_tt
		}
		
		ai_will_do = {
			factor = 15
		}
	}
	
	upgrade_peoples_militia = {
	
		icon = generic_police_action
		
		available = {
			if = {
				limit = { check_variable = { peoples_militia_var > 0 } }
				set_temp_variable = { need_manpower_temp = 1000 }
				set_temp_variable = { need_infantry_equipment_temp = 100 }
				multiply_temp_variable = { need_manpower_temp = peoples_militia_var }
				multiply_temp_variable = { need_infantry_equipment_temp = peoples_militia_var }
				has_manpower > need_manpower_temp
				has_equipment = { infantry_equipment > need_infantry_equipment_temp }
			}
		}
		visible = {
			check_variable = { peoples_militia_template_var < 10 }
		}
		
		cost = var:upgrade_peoples_militia_cost_var?20
		
		complete_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): complete decision upgrade_peoples_militia"
			if = {
				limit = { check_variable = { upgrade_peoples_militia_cost_var = 0 } }
				set_variable = { upgrade_peoples_militia_cost_var = 30 }
			}
			else = {
				add_to_variable = { upgrade_peoples_militia_cost_var = 10 }
			}
			add_to_variable = { peoples_militia_template_var = 1 }
			if = {
				limit = { check_variable = { peoples_militia_var > 0 } }
				set_temp_variable = { need_manpower_temp = -1000 }
				set_temp_variable = { need_infantry_equipment_temp = -100 }
				multiply_temp_variable = { need_manpower_temp = peoples_militia_var }
				multiply_temp_variable = { need_infantry_equipment_temp = peoples_militia_var }
				add_manpower = need_manpower_temp
				add_equipment_to_stockpile = { type = infantry_equipment amount = need_infantry_equipment_temp }
			}
			custom_effect_tooltip = upgrade_peoples_militia_tt
		}
		
		ai_will_do = {
			factor = 10
			modifier = {
				factor = 0
				check_variable = { peoples_militia_var < 5 }
			}
			modifier = {
				factor = 2
				check_variable = { peoples_militia_var > 10 }
			}
		}
	}
}



economy_decisions = {

	expand_trade_VER = {
	
		icon = gre_paying_ifc_debt
		available = {
			always = no
		}
		activation = {
			country_exists = VER
		}
		is_good = yes
		days_mission_timeout = 182
		
		timeout_effect = {
			effect_tooltip = {
				VER = {
					random_owned_state = {
						limit = { is_core_of = PREV }
						add_resource = { type = chromium amount = 2 }
						add_resource = { type = aluminium amount = 5 }
						add_resource = { type = steel amount = 5 }
						add_resource = { type = tungsten amount = 5 }
						add_resource = { type = oil amount = 10 }
						add_resource = { type = rubber amount = 5 }
					}
				}
			}
			hidden_effect = {
				if = {
					limit = {
						original_tag = VER
					}
					VER = {
						random_owned_state = {
							limit = { is_core_of = PREV }
							add_resource = { type = chromium amount = 2 }
							add_resource = { type = aluminium amount = 5 }
							add_resource = { type = steel amount = 5 }
							add_resource = { type = tungsten amount = 5 }
							add_resource = { type = oil amount = 10 }
							add_resource = { type = rubber amount = 5 }
						}
					}
				}
				activate_mission = expand_trade_VER
			}
		}
	}
	
	invest_in_economy_VER = {
	
		icon = hol_attract_foreign_investors
		
		highlight_states = {
			is_controlled_by = VER
			is_capital = yes
		}
		
		available = {
			has_active_mission = expand_trade_VER
		}
		visible = {
			country_exists = VER
			has_active_mission = expand_trade_VER
			OR = {
				original_tag = RED
				original_tag = BLU
				original_tag = GRN
				original_tag = ORG
			}
			NOT = { has_country_flag = { flag = expand_trade_VER_flag value > 0 } }
		}
		
		cost = 25
		
		complete_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): complete decision invest_in_economy_VER"
			set_country_flag = { flag = expand_trade_VER_flag days = 35 value = 1 }
			effect_tooltip = {
				add_days_mission_timeout = { mission = expand_trade_VER days = -35 }
			}
			hidden_effect = {
				every_country = {
					limit = {
						has_active_mission = expand_trade_VER
					}
					add_days_mission_timeout = { mission = expand_trade_VER days = -35 }
				}
			}
		}
	}
	
	undermine_trade_influence_VER = {
	
		icon = generic_break_treaty
		
		highlight_states = {
			is_controlled_by = VER
			is_capital = yes
		}
		
		available = {
			has_active_mission = expand_trade_VER
		}
		visible = {
			country_exists = VER
			has_active_mission = expand_trade_VER
			OR = {
				original_tag = RED
				original_tag = BLU
				original_tag = GRN
				original_tag = ORG
			}
			NOT = { has_country_flag = { flag = expand_trade_VER_flag value > 0 } }
		}
		
		cost = 25
		days_re_enable = 35
		
		complete_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): complete decision undermine_trade_influence_VER"
			set_country_flag = { flag = expand_trade_VER_flag days = 35 value = 1 }
			effect_tooltip = {
				add_days_mission_timeout = { mission = expand_trade_VER days = 35 }
			}
			hidden_effect = {
				every_country = {
					limit = {
						has_active_mission = expand_trade_VER
					}
					add_days_mission_timeout = { mission = expand_trade_VER days = 35 }
				}
			}
		}
	}
	
	
	expand_trade_SVE = {
	
		icon = gre_paying_ifc_debt
		available = {
			always = no
		}
		activation = {
			country_exists = SVE
		}
		is_good = yes
		days_mission_timeout = 182
		
		timeout_effect = {
			effect_tooltip = {
				SVE = {
					random_owned_state = {
						limit = { is_core_of = PREV }
						add_resource = { type = chromium amount = 3 }
						add_resource = { type = aluminium amount = 8 }
						add_resource = { type = steel amount = 10 }
						add_resource = { type = tungsten amount = 10 }
						add_resource = { type = oil amount = 15 }
						add_resource = { type = rubber amount = 10 }
					}
				}
			}
			hidden_effect = {
				if = {
					limit = {
						original_tag = SVE
					}
					SVE = {
						random_owned_state = {
							limit = { is_core_of = PREV }
							add_resource = { type = chromium amount = 3 }
							add_resource = { type = aluminium amount = 8 }
							add_resource = { type = steel amount = 10 }
							add_resource = { type = tungsten amount = 10 }
							add_resource = { type = oil amount = 15 }
							add_resource = { type = rubber amount = 10 }
						}
					}
				}
				activate_mission = expand_trade_SVE
			}
		}
	}
	
	invest_in_economy_SVE = {
	
		icon = hol_attract_foreign_investors
		
		highlight_states = {
			is_controlled_by = SVE
			is_capital = yes
		}
		
		available = {
			has_active_mission = expand_trade_SVE
		}
		visible = {
			country_exists = SVE
			has_active_mission = expand_trade_SVE
			OR = {
				original_tag = RED
				original_tag = BLU
				original_tag = GRN
				original_tag = ORG
			}
			NOT = { has_country_flag = { flag = expand_trade_SVE_flag value > 0 } }
		}
		
		cost = 25
		days_re_enable = 35
		
		complete_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): complete decision invest_in_economy_SVE"
			set_country_flag = { flag = expand_trade_SVE_flag days = 35 value = 1 }
			effect_tooltip = {
				add_days_mission_timeout = { mission = expand_trade_SVE days = -35 }
			}
			hidden_effect = {
				every_country = {
					limit = {
						has_active_mission = expand_trade_SVE
					}
					add_days_mission_timeout = { mission = expand_trade_SVE days = -35 }
				}
			}
		}
	}
	
	undermine_trade_influence_SVE = {
	
		icon = generic_break_treaty
		
		highlight_states = {
			is_controlled_by = SVE
			is_capital = yes
		}
		
		available = {
			has_active_mission = expand_trade_SVE
		}
		visible = {
			country_exists = SVE
			has_active_mission = expand_trade_SVE
			OR = {
				original_tag = RED
				original_tag = BLU
				original_tag = GRN
				original_tag = ORG
			}
			NOT = { has_country_flag = { flag = expand_trade_SVE_flag value > 0 } }
		}
		
		cost = 25
		days_re_enable = 35
		
		complete_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): complete decision undermine_trade_influence_SVE"
			set_country_flag = { flag = expand_trade_SVE_flag days = 35 value = 1 }
			effect_tooltip = {
				add_days_mission_timeout = { mission = expand_trade_SVE days = 35 }
			}
			hidden_effect = {
				every_country = {
					limit = {
						has_active_mission = expand_trade_SVE
					}
					add_days_mission_timeout = { mission = expand_trade_SVE days = 35 }
				}
			}
		}
	}
	
	
	expand_trade_SVD = {
	
		icon = gre_paying_ifc_debt
		available = {
			always = no
		}
		activation = {
			country_exists = SVD
		}
		is_good = yes
		days_mission_timeout = 182
		
		timeout_effect = {
			effect_tooltip = {
				SVD = {
					random_owned_state = {
						limit = { is_core_of = PREV }
						add_resource = { type = chromium amount = 3 }
						add_resource = { type = aluminium amount = 8 }
						add_resource = { type = steel amount = 10 }
						add_resource = { type = tungsten amount = 10 }
						add_resource = { type = oil amount = 15 }
						add_resource = { type = rubber amount = 10 }
					}
				}
			}
			hidden_effect = {
				if = {
					limit = {
						original_tag = SVD
					}
					SVD = {
						random_owned_state = {
							limit = { is_core_of = PREV }
							add_resource = { type = chromium amount = 3 }
							add_resource = { type = aluminium amount = 8 }
							add_resource = { type = steel amount = 10 }
							add_resource = { type = tungsten amount = 10 }
							add_resource = { type = oil amount = 15 }
							add_resource = { type = rubber amount = 10 }
						}
					}
				}
				activate_mission = expand_trade_SVD
			}
		}
	}
	
	invest_in_economy_SVD = {
	
		icon = hol_attract_foreign_investors
		
		highlight_states = {
			is_controlled_by = SVD
			is_capital = yes
		}
		
		available = {
			has_active_mission = expand_trade_SVD
		}
		visible = {
			country_exists = SVD
			has_active_mission = expand_trade_SVD
			OR = {
				original_tag = RED
				original_tag = BLU
				original_tag = GRN
				original_tag = ORG
			}
			NOT = { has_country_flag = { flag = expand_trade_SVD_flag value > 0 } }
		}
		
		cost = 25
		days_re_enable = 35
		
		complete_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): complete decision invest_in_economy_SVD"
			set_country_flag = { flag = expand_trade_SVD_flag days = 35 value = 1 }
			effect_tooltip = {
				add_days_mission_timeout = { mission = expand_trade_SVD days = -35 }
			}
			hidden_effect = {
				every_country = {
					limit = {
						has_active_mission = expand_trade_SVD
					}
					add_days_mission_timeout = { mission = expand_trade_SVD days = -35 }
				}
			}
		}
	}
	
	undermine_trade_influence_SVD = {
	
		icon = generic_break_treaty
		
		highlight_states = {
			is_controlled_by = SVD
			is_capital = yes
		}
		
		available = {
			has_active_mission = expand_trade_SVD
		}
		visible = {
			country_exists = SVD
			has_active_mission = expand_trade_SVD
			OR = {
				original_tag = RED
				original_tag = BLU
				original_tag = GRN
				original_tag = ORG
			}
			NOT = { has_country_flag = { flag = expand_trade_SVD_flag value > 0 } }
		}
		
		cost = 25
		days_re_enable = 35
		
		complete_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): complete decision undermine_trade_influence_SVD"
			set_country_flag = { flag = expand_trade_SVD_flag days = 35 value = 1 }
			effect_tooltip = {
				add_days_mission_timeout = { mission = expand_trade_SVD days = 35 }
			}
			hidden_effect = {
				every_country = {
					limit = {
						has_active_mission = expand_trade_SVD
					}
					add_days_mission_timeout = { mission = expand_trade_SVD days = 35 }
				}
			}
		}
	}
}


### DEBUG
debug_category = {

	summon_peoples_militia_debug = {
		name = summon_peoples_militia
	
		icon = generic_military
		
		available = {
			any_owned_state = {
				impassable = no
				#is_in_home_area = yes
				NOT = { is_controlled_by = ROOT }
			}
			custom_trigger_tooltip = {
				check_variable = { peoples_militia_var > 0 }
				tooltip = summon_peoples_militia_trigger_tt
			}
		}
		
		days_remove = 1
		
		remove_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): remove decision summon_peoples_militia"
			if = {
				limit = { check_variable = { peoples_militia_var = 1 } }
				custom_effect_tooltip = summon_peoples_militia_tt
			}
			else = {
				custom_effect_tooltip = summon_peoples_militia_tt_many
			}
			give_actual_militia_template = yes
			set_temp_variable = { num_of_cycle = peoples_militia_var }
			while_loop_effect = {
				limit = { check_variable = { num_of_cycle > 0 } }
				add_to_temp_variable = { num_of_cycle = -1 }
				random_owned_state = {
					limit = {
						impassable = no
						#is_in_home_area = yes
						NOT = { is_controlled_by = ROOT }
					}
					create_unit = {
						division = "name = \"Peoples Militia\" division_template = \"Peoples Militia\" start_experience_factor = 0.2" 
						owner = ROOT
						count = 1
						allow_spawning_on_enemy_provs = yes
					}
				}
			}
		}
	}
	
	train_peoples_militia_debug = {
		name = train_peoples_militia
		
		icon = generic_prepare_civil_war
		
		cost = 0
		days_remove = 1
		
		remove_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): remove decision train_peoples_militia"
			set_temp_variable = { peoples_militia_temp = 10 }
			add_to_variable = { peoples_militia_var = peoples_militia_temp }
			custom_effect_tooltip = train_peoples_militia_tt
		}
	}
	
	upgrade_peoples_militia_debug = {
		name = upgrade_peoples_militia
	
		icon = generic_police_action
		
		available = {
		}
		visible = {
			check_variable = { peoples_militia_template_var < 10 }
		}
		
		cost = 0
		
		complete_effect = {
			log = "[GetDateText]: [Root.GetName] ([Root.GetTag]): complete decision upgrade_peoples_militia"
			add_to_variable = { peoples_militia_template_var = 1 }
			custom_effect_tooltip = upgrade_peoples_militia_tt
		}
	}
}