SOV_postwar_land_integration = {

	SOV_unlock_ahistorical_integration = {
		icon = mission_icon
		cost = 0
		ai_will_do = {
			factor = 0
		}
		
		fire_only_once = yes
		
		allowed = {
			tag = SOV
		}
		
		available = {
			is_ai = no
		}
		
		visible = {
			always = yes
		}
		
		complete_effect = {
			custom_effect_tooltip = SOV_allow_ahistorical_integration_tt
			set_country_flag = SOV_allow_ahistorical_integration_flag
			354 = { set_state_flag = SOV_allow_ahistorical_integration_state_flag }
			800 = { set_state_flag = SOV_allow_ahistorical_integration_state_flag }
			419 = { set_state_flag = SOV_allow_ahistorical_integration_state_flag }
			420 = { set_state_flag = SOV_allow_ahistorical_integration_state_flag }
			hidden_effect = {	
				every_state = {
					limit = {
						OR = {
							is_core_of = FIN #In case previous focus was bypassed
						}
						NOT = { is_owned_by = ROOT }
					}
					set_state_flag = SOV_allow_ahistorical_integration_state_flag
				}
			}
		}
	}

	SOV_integrate_est = {
		icon = generic_form_nation
		cost = 50
		ai_will_do = {
			factor = 1
		}

		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 9
			and = {
				813 = { is_controlled_by_ROOT_or_subject = yes }
				191 = { is_controlled_by_ROOT_or_subject = yes }
				812 = { is_controlled_by_ROOT_or_subject = yes }
				13 = { is_controlled_by_ROOT_or_subject = yes }
				811 = { is_controlled_by_ROOT_or_subject = yes }
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 813
				state = 191
				state = 811
				state = 13
				state = 812
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			812 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		days_remove = 90
		modifier = {
			civilian_factory_use = 10
		}
		
		remove_effect = {
			custom_effect_tooltip = SOV_integrate_est_effect_tt
			
			hidden_effect = {
				SOV = {
					transfer_state = 813
					transfer_state = 191
					transfer_state = 812
					transfer_state = 13
					transfer_state = 811
				}
				813 = { add_core_of = SOV }
				191 = { add_core_of = SOV }
				812 = { add_core_of = SOV }
				13 = { add_core_of = SOV }
				811 = { add_core_of = SOV }
			}
		}
		
	}
	
	SOV_integrate_lat = {
		icon = generic_form_nation
		cost = 50
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 9
			and = {
				810 = { is_controlled_by_ROOT_or_subject = yes }
				12 = { is_controlled_by_ROOT_or_subject = yes }
				808 = { is_controlled_by_ROOT_or_subject = yes }
				809 = { is_controlled_by_ROOT_or_subject = yes }
				190 = { is_controlled_by_ROOT_or_subject = yes }
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 810
				state = 12
				state = 808
				state = 809
				state = 190
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			808 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		days_remove = 90
		modifier = {
			civilian_factory_use = 10
		}
		
		remove_effect = {
			custom_effect_tooltip = SOV_integrate_lat_effect_tt
			hidden_effect = {
				SOV = {
					transfer_state = 810
					transfer_state = 12
					transfer_state = 808
					transfer_state = 809
					transfer_state = 190
				}
			
				810 = { add_core_of = SOV }
				12 = { add_core_of = SOV }
				808 = { add_core_of = SOV }
				809 = { add_core_of = SOV }
				190 = { add_core_of = SOV }
			}
		}
		
	}
	
	SOV_integrate_lit = {
		icon = generic_form_nation
		cost = 50
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 9
			and = {
				784 = { is_controlled_by_ROOT_or_subject = yes }
				11 = { is_controlled_by_ROOT_or_subject = yes }
				815 = { is_controlled_by_ROOT_or_subject = yes }
				189 = { is_controlled_by_ROOT_or_subject = yes }
				814 = { is_controlled_by_ROOT_or_subject = yes }
				188 = { is_controlled_by_ROOT_or_subject = yes }
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 784
				state = 11
				state = 815
				state = 189
				state = 814
				state = 188
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			11 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		days_remove = 90
		modifier = {
			civilian_factory_use = 10
		}
		
		remove_effect = {
			custom_effect_tooltip = SOV_integrate_lit_effect_tt 
			
			hidden_effect = {
			SOV = {
				transfer_state = 784
				transfer_state = 11
				transfer_state = 815
				transfer_state = 189
				transfer_state = 814
				transfer_state = 188
			}
				784 = { add_core_of = SOV }
				11 = { add_core_of = SOV }
				815 = { add_core_of = SOV }
				189 = { add_core_of = SOV }
				814 = { add_core_of = SOV }
				188 = { add_core_of = SOV }
			}
		}
		
	}
	
	SOV_integrate_blr_pol = {
		icon = generic_form_nation
		cost = 40
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 5
			and = {
				96 = { is_controlled_by_ROOT_or_subject = yes }
				95 = { is_controlled_by_ROOT_or_subject = yes }
				94 = { is_controlled_by_ROOT_or_subject = yes }
			}
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			95 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 96
				state = 95
				state = 94
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 60
		modifier = {
			civilian_factory_use = 6
		}
		
		remove_effect = {	
			SOV = {
				transfer_state = 96
				transfer_state = 95
				transfer_state = 94
			}
			96 = { add_core_of = SOV }
			95 = { add_core_of = SOV }
			94 = { add_core_of = SOV }
		}
		
	}
	
	SOV_integrate_ukr_pol = {
		icon = generic_form_nation
		cost = 50
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 7
			and = {
				93 = { is_controlled_by_ROOT_or_subject = yes }
				91 = { is_controlled_by_ROOT_or_subject = yes }
				89 = { is_controlled_by_ROOT_or_subject = yes }
			}
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			91 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 91
				state = 93
				state = 89
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 80
		modifier = {
			civilian_factory_use = 8
		}
		
		remove_effect = {
			SOV = {
				transfer_state = 93
				transfer_state = 91
				transfer_state = 89
			}
			93 = { add_core_of = SOV }
			91 = { add_core_of = SOV }
			89 = { add_core_of = SOV }
		}
		
	}
	
	SOV_integrate_rom = {
		icon = generic_form_nation
		cost = 30
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 5
			and = {
				80 = { is_controlled_by_ROOT_or_subject = yes }
				78 = { is_controlled_by_ROOT_or_subject = yes }
				766 = { is_controlled_by_ROOT_or_subject = yes }
			}
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			78 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 78
				state = 80
				state = 766
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 45
		modifier = {
			civilian_factory_use = 6
		}
		
		remove_effect = {
			SOV = {
				transfer_state = 80
				transfer_state = 78
				transfer_state = 766
			}
			80 = { add_core_of = SOV }
			78 = { add_core_of = SOV }
			766 = { add_core_of = SOV }
			hidden_effect = {
				80 = { add_core_of = UKR }
			}
		}
		
	}
	
	SOV_integrate_tur_armenia = {
		icon = generic_form_nation
		cost = 80
		ai_will_do = {
			factor = 0
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 14
			354 = { is_controlled_by_ROOT_or_subject = yes }
			800 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			has_country_flag = SOV_allow_ahistorical_integration_flag
			354 = { is_controlled_by_ROOT_or_subject = yes }
		} 
		
		highlight_states = {
			highlight_state_targets = {
				state = 354
				state = 800
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 120
		modifier = {
			civilian_factory_use = 15
		}
		
		remove_effect = {
			SOV = {
				transfer_state = 354
				transfer_state = 800
			}
			354 = { add_core_of = SOV }
			800 = { add_core_of = SOV }
			hidden_effect = {
				354 = { add_core_of = ARM }
				800 = { add_core_of = ARM }
				354 = { remove_core_of = TUR }
				800 = { remove_core_of = TUR }
			}
		}
	}
	
	SOV_integrate_iran_azerbaijan = {
		icon = generic_form_nation
		cost = 40
		ai_will_do = {
			factor = 0
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 6
			and = {
				419 = { is_controlled_by_ROOT_or_subject = yes }
				420 = { is_controlled_by_ROOT_or_subject = yes }
			}
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			has_country_flag = SOV_allow_ahistorical_integration_flag
			419 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 419
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 60
		modifier = {
			civilian_factory_use = 7
		}
		
		remove_effect = {					
			SOV = {
				transfer_state = 419
				transfer_state = 420
			}
			419 = { add_core_of = SOV }
			420 = { add_core_of = SOV }
			hidden_effect = {
				419 = { remove_core_of = PER }
				420 = { remove_core_of = PER }
			}
		}
		
	}
	
	SOV_integrate_fin = {
		icon = generic_form_nation
		cost = 100
		ai_will_do = {
			factor = 0
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 19
			every_state = {
				limit = {
					is_core_of = FIN
				}
				is_controlled_by_ROOT_or_subject = yes
			}
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			has_country_flag = SOV_allow_ahistorical_integration_flag
			111 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = { 
			highlight_state_targets = {
				state = 111
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 150
		modifier = {
			civilian_factory_use = 20
		}
		
		remove_effect = {
			custom_effect_tooltip = SOV_integrate_fin_effect_tt
			hidden_effect = {
				every_state = {
					limit = {
						is_core_of = FIN
					}
					add_core_of = SOV
					transfer_state_to = SOV
				}
			}
		}
		
	}

	SOV_integrate_konigsberg = {
		icon = GFX_decision_eng_trade_unions_demand
		cost = 20
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 3
			763 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			763 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 763
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 30
		modifier = {
			civilian_factory_use = 4
		}
		
		remove_effect = {
			SOV = {
				transfer_state = 763
			}
			763 = { add_core_of = SOV }
		}
		
	}

	SOV_integrate_zakarpattia = {
		icon = GFX_decision_eng_trade_unions_demand
		cost = 10
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 1
			73 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			73 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 73
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 20
		modifier = {
			civilian_factory_use = 2
		}
		
		remove_effect = {
			SOV = {
				transfer_state = 73
			}
			73 = { add_core_of = SOV }
			hidden_effect = {
				73 = { add_core_of = UKR }
			}
		}
		
	}
	
	SOV_integrate_karjala = {
		icon = GFX_decision_eng_trade_unions_demand
		cost = 20
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 2
			146 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			146 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 146
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 25
		modifier = {
			civilian_factory_use = 3
		}
		
		remove_effect = {			
			SOV = {
				transfer_state = 146
			}
			146 = { add_core_of = SOV }
		}
		
	}
	
	SOV_integrate_salla = {
		icon = GFX_decision_eng_trade_unions_demand
		cost = 5
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 0
			147 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			147 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 147
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 10
		modifier = {
			civilian_factory_use = 1
		}
		
		remove_effect = {				
			SOV = {
				transfer_state = 147
			}
			147 = { add_core_of = SOV }
		}
		
	}
	
	SOV_integrate_petsamo = {
		icon = GFX_decision_eng_trade_unions_demand
		cost = 5
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 0
			722 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			722 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 722
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 10
		modifier = {
			civilian_factory_use = 1
		}
		
		remove_effect = {					
			SOV = {
				transfer_state = 722
			}
			722 = { add_core_of = SOV }
		}
		
	}
	
	SOV_integrate_south_sakhalin = {
		icon = GFX_decision_eng_trade_unions_demand
		cost = 10
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 0
			537 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			537 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 537
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 10
		modifier = {
			civilian_factory_use = 1
		}
		
		remove_effect = {					
			SOV = {
				transfer_state = 537
			}
			537 = { add_core_of = SOV }
		}
		
	}
	
	SOV_integrate_kuril_islands = {
		icon = GFX_decision_eng_trade_unions_demand
		cost = 10
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		
		allowed = { 
			tag = SOV
		}
		
		available = {
			num_of_civilian_factories_available_for_projects > 0
			555 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		visible = {
			has_completed_focus = SOV_restoration_and_development
			555 = { is_controlled_by_ROOT_or_subject = yes }
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 555
			}
		}
		
		on_map_mode = map_and_decisions_view
		
		days_remove = 10
		modifier = {
			civilian_factory_use = 1
		}
		
		remove_effect = {			
			SOV = {
				transfer_state = 555
			}
			555 = { add_core_of = SOV }
		}
		
	}
}