#####################

###  ##  #  # # #  ## 
 #  #  # ## # # # #   
 #  #### # ## ##   #  
 #  #  # #  # # #   # 
 #  #  # #  # # # ## 

 #################### 


USA_marmon_herrington_organization = {
	include = generic_mobile_tank_organization
	icon = GFX_idea_marmon_herrington
 	allowed = {	
 		always = no
 	}
	available = {
		IF = {
			limit = {
				FROM = { NOT = { original_tag = USA } }
			}
			FROM = { NOT = { has_war_with = USA } }
		}
		IF = {
			limit = { FROM = { original_tag = BRA } }
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_completed_focus = BRA_invite_foreign_companies
					has_country_flag = has_marmon_herrington_mio_flag
				}
			}
		}
	}
}

USA_chrysler_organization = {
	include = generic_medium_tank_organization
	icon = GFX_idea_chrysler
	
 	allowed = {	
 		always = no
 	}

	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = USA } }
			}
			FROM = { NOT = { has_war_with = USA } }
		}

		if = {
			limit = {
				FROM = { tag = MEX }
			}
			FROM = { is_in_faction_with = USA }
		} 
		else_if = {
			limit = {
				FROM = { tag = NOR }
			}
			FROM = { 
				has_completed_focus = NOR_invite_transnational_manufacturers
			}
		}
	}

	initial_trait = {
		name = USA_mio_trait_medium_tank_organization

		limit_to_equipment_type = { mio_cat_eq_all_medium_tank }

		equipment_bonus = {
			reliability = 0.1
			soft_attack = 0.02
			hard_attack = 0.03
			defense = -0.15
		}
	}

	add_trait = { 
		token = USA_mio_trait_strict_design_specifications
		name = USA_mio_trait_strict_design_specifications
		icon = GFX_generic_mio_trait_icon_reliability
		special_trait_background = yes

		position = { x=2 y=1 }
		relative_position_id = generic_mio_trait_simplified_turret_design

		all_parents = { generic_mio_trait_simplified_turret_design generic_mio_trait_armor_steel_working }
		limit_to_equipment_type = { mio_cat_eq_all_medium_tank }

		equipment_bonus = {
			reliability = 0.1
		}
	}

	add_trait = { 
		token = USA_mio_trait_expanded_production_facilities
		name = USA_mio_trait_expanded_production_facilities
		icon = GFX_generic_mio_trait_icon_build_cost_ic
		special_trait_background = yes

		position = { x=0 y=1 }
		relative_position_id = USA_mio_trait_strict_design_specifications

		all_parents = { USA_mio_trait_strict_design_specifications }
		production_bonus = {
			production_cost_factor = -0.1
			production_capacity_factor = 0.05
		}
	}
}

USA_army_ordnance_department_organization = {
	include = generic_medium_tank_organization
	icon = GFX_idea_army_ordnance_department
	
 	allowed = {	
 		always = no
 	}

	add_trait = { 
		token = USA_mio_trait_periscope_sights
		name = USA_mio_trait_periscope_sights
		icon = GFX_generic_mio_department_icon_tank_medium_tank_armor
		special_trait_background = yes

		position = { x=1 y=1 }
		relative_position_id = generic_mio_trait_all_round_cupola

		all_parents = { generic_mio_trait_all_round_cupola }
		equipment_bonus = {
			breakthrough = 0.1
			defense = 0.05
		}
	}

	add_trait = { 
		token = USA_mio_trait_mass_production_of_armor
		name = USA_mio_trait_mass_production_of_armor
		icon = GFX_generic_mio_department_icon_tank_medium_tank_line_efficiency
		special_trait_background = yes

		position = { x=2 y=1 }
		relative_position_id = generic_mio_trait_simplified_turret_design

		all_parents = { generic_mio_trait_simplified_turret_design generic_mio_trait_armor_steel_working }
		production_bonus = {
			production_efficiency_cap_factor = 0.05
			production_efficiency_gain_factor = 0.1
		}
	}
}

USA_detroit_arsenal_organization = {
	name = detroit_arsenal
	include = generic_tank_organization
	icon = GFX_idea_generic_industrial_concern_1
 	allowed = {	
 		always = no
 	}
	available = {
		FROM = { has_completed_focus = USA_main_battle_tanks }
	}
}

USA_tank_destroyer_board_organization = {
	name = tank_destroyer_board
	include = generic_mobile_tank_organization
	icon = GFX_idea_usa_tank_destroyer_board
 	allowed = {	
 		always = no
 	}
	available = {
		FROM = { has_completed_focus = USA_tank_destroyer_doctrine }
	}
	initial_trait = {
		name = ROM_mio_trait_mobile_tank_destroyers
		
		limit_to_equipment_type = { 
			mio_cat_eq_all_tank_destroyers
		}
		
		equipment_bonus = {
			reliability = 0.05
			hard_attack = 0.05
			ap_attack = 0.05
		}
	}

	override_trait = {
		token = generic_mio_enlarged_breech
		limit_to_equipment_type = { 
			mio_cat_eq_all_tank_destroyers
		}
		equipment_bonus = {
			hard_attack = 0.05
			ap_attack = 0.1
		}
		special_trait_background = yes
	}
}




#####################

 ## #  # ### ###   ## 
#   #  #  #  #  # #   
 #  ####  #  ###   #  
  # #  #  #  #      # 
##  #  # ### #    ##  
 
#####################


USA_norfolk_naval_yard_organization = {
	include = generic_battle_line_ship_organization
	icon = GFX_idea_norfolk_naval_yard
 	allowed = {	
 		always = no
 	}
}

USA_electric_boat_company_organization = {
	include = generic_raider_ship_organization
	icon = GFX_idea_electric_boat_company
 	allowed = {	
 		always = no
 	}
}

USA_brooklyn_naval_yard_organization = {
	include = generic_escort_ship_organization
	icon = GFX_idea_brooklyn_naval_yard
 	allowed = {	
 		always = no
 	}
}

USA_newport_news_shipbuilding_organization = {
	include = generic_task_force_ship_organization
	icon = GFX_idea_newport_news_shipbuilding
 	allowed = {	
 		always = no
 	}
	available = {
		IF = {
			limit = {
				FROM = { NOT = { original_tag = USA } }
			}
			FROM = { NOT = { has_war_with = USA } }
		}
		IF = {
			limit = { FROM = { original_tag = BRA } }
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_completed_focus = BRA_invite_foreign_companies
					has_country_flag = has_newport_news_shipbuilding_mio_flag
				}
			}
		}
	}
}

###########################

###  #    ##  #  # ###  ## 
#  # #   #  # ## # #   #   
###  #   #### # ## ##   #  
#    #   #  # #  # #     # 
#    ### #  # #  # ### ##  

###########################

USA_north_american_aviation_organization = {
	include = generic_range_focused_aircraft_organization
	icon = GFX_idea_north_american_aviation
	
 	allowed = {	
 		always = no
 	}

	available = {
		IF = {
			limit = {
				FROM = { NOT = { original_tag = USA } }
			}
			FROM = { NOT = { has_war_with = USA } }
		}
		IF = {
			limit = { FROM = { original_tag = BRA } }
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_completed_focus = BRA_invite_foreign_companies
					has_country_flag = has_invited_north_american_aviation_mio_flag
				}
			}
		}
	}
	
	add_trait = {
		token = USA_mio_trait_outsourced_engines
		name = USA_mio_trait_outsourced_engines
		icon = GFX_generic_mio_trait_icon_air_agility
		special_trait_background = yes
		
		position = { x=0 y=1 }  
		relative_position_id = generic_mio_trait_advanced_production_techniques
		
		any_parent = { generic_mio_trait_advanced_production_techniques }
		
		limit_to_equipment_type = { mio_cat_eq_all_small_plane }

		available = {
			FROM = {
				is_in_faction_with = ENG	
			}
		}
		
		equipment_bonus = {
			air_agility = 0.05
			maximum_speed = 0.05
		}
	}

	add_trait = {
		token = USA_mio_trait_light_aircraft_development
		name = USA_mio_trait_light_aircraft_development
		icon = GFX_generic_mio_department_icon_plane_light_combat
		special_trait_background = yes
		
		position = { x=0 y=1 }  
		relative_position_id = generic_mio_trait_strafing_techniques
		
		any_parent = { generic_mio_trait_strafing_techniques }
		
		limit_to_equipment_type = { mio_cat_eq_all_small_plane }

		equipment_bonus = {
			air_agility = 0.05
			air_ground_attack = 0.05
			air_attack = 0.02
		}
	}
}

USA_lockheed_organization = {
	include = generic_medium_aircraft_organization
	icon = GFX_idea_lockheed
	
 	allowed = {	
 		always = no
 	}
	
	equipment_type = {
		mio_cat_eq_all_small_plane
		mio_cat_eq_all_medium_plane 
		transport_plane_equipment
	}
	
	initial_trait = {
		name = USA_mio_trait_lockeed_aircraft
		limit_to_equipment_type = { mio_cat_eq_all_medium_plane }

		equipment_bonus = {
			air_range = 0.15
			air_attack = 0.05
		}
	}
	
	add_trait = {
		token = USA_mio_trait_mechanized_production
		name = USA_mio_trait_mechanized_production
		icon = GFX_generic_mio_department_icon_plane_medium_technology
		special_trait_background = yes
		
		position = { x=0 y=1 }  
		relative_position_id = generic_mio_trait_narrow_build
		
		any_parent = { generic_mio_trait_narrow_build }
		
		limit_to_equipment_type = { mio_cat_eq_all_medium_plane }
		
		production_bonus = {
			production_efficiency_cap_factor = 0.05
		} 
	}
	
	override_trait = {
		token = generic_mio_trait_heavy_fighter_specialization
		equipment_bonus = {
			air_range = 0.1
			air_attack = 0.05
		}
	}
}

USA_douglas_aircraft_company_organization = {
	include = generic_cas_aircraft_organization
	icon = GFX_idea_douglas_aircraft_company
	
 	allowed = {	
 		always = no
 	}
}

USA_boeing_organization = {
	include = generic_heavy_aircraft_organization
	icon = GFX_idea_boeing
	
 	allowed = {	
 		always = no
 	}
	
	override_trait = {
		token = generic_mio_trait_flying_fortress
		position = { x=-1 y=1 }
	}
	
	override_trait = {
		token = generic_mio_trait_advanced_instruments
		position = { x=1 y=1 }
	}
	
	add_trait = {
		token = USA_mio_trait_superfortress
		name = USA_mio_trait_superfortress
		icon = GFX_generic_mio_department_icon_plane_general_engine
		special_trait_background = yes
		
		position = { x=0 y=1 }  
		relative_position_id = generic_mio_trait_flying_fortress
		
		any_parent = { generic_mio_trait_flying_fortress }
		limit_to_equipment_type = { large_plane_airframe large_plane_maritime_patrol_plane_airframe }
			
		equipment_bonus = {
			air_defence = 0.1
			air_range = 0.1
			air_agility = -0.05
			fuel_consumption = 0.05
		}
	}
}

USA_grumman_organization = {
	include = generic_naval_aircraft_organization
	icon = GFX_idea_grumman
	
 	allowed = {	
 		always = no
 	}
	
	add_trait = {
		token = USA_mio_trait_smooth_finish
		name = USA_mio_trait_smooth_finish
		icon = GFX_generic_mio_trait_icon_air_agility
		special_trait_background = yes
		
		position = { x=2 y=1 }  
		relative_position_id = generic_mio_trait_reinforced_fuselage
		
		any_parent = { generic_mio_trait_reinforced_fuselage }
		limit_to_equipment_type = { mio_cat_eq_all_cv_aircraft small_plane_naval_bomber_airframe }
			
		equipment_bonus = {
			air_agility = 0.05
			maximum_speed = 0.05
		}
	}
	
	override_trait = {
		token = generic_mio_advanced_materials
		position = { x=-1 y=1 }
	}
	
	add_trait = {
		token = USA_mio_trait_jet_fighter_design
		name = USA_mio_trait_jet_fighter_design
		icon = GFX_generic_mio_trait_icon_maximum_speed
		special_trait_background = yes

		available = {
			FROM = {
				has_tech = jet_engines
			}
		}
		position = { x=1 y=1 }  
		relative_position_id = generic_mio_water_injection
		
		any_parent = { generic_mio_water_injection }
		limit_to_equipment_type = { mio_cat_eq_all_cv_aircraft }
			
		equipment_bonus = {
			maximum_speed = 0.1
		}
	}
}


################################### 

#   #  ##  ### ### ###  ### ### #   
## ## #  #  #  #   #  #  #  #   #   
# # # ####  #  ##  ###   #  ##  #   
#   # #  #  #  #   #  #  #  #   #   
#   # #  #  #  ### #  # ### ### ### 


###################################

USA_springfield_armory_organization = {
	include = generic_infantry_equipment_organization
	icon = GFX_idea_springfield_armory
	
 	allowed = {	
 		always = no
 	}
}

USA_ford_motor_company_organization = {
	include = generic_motorized_mechanized_organization
	icon = GFX_idea_ford_motor_company
	
 	allowed = {	
 		always = no
 	}
	
	visible = {
		IF = { 
			limit = {
				FROM = { tag = POL }
			}
			FROM = {
				has_country_flag = POL_ford_motors
			}
		}
		IF = { 
			limit = {
				FROM = { tag = BRA }
			}
			FROM = {
				has_country_flag = BRA_toa_DLC
			}
		}
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = USA } }
			}
			FROM = { NOT = { has_war_with = USA } }
		}

		IF = {
			limit = { FROM = { original_tag = ROM } }
			FROM = { has_country_flag = USA_mot_chosen }
		}
		if = {
			limit = {
				FROM = {
					OR = {
						original_TAG = LAT
						original_TAG = LIT
						original_TAG = EST
					}
				}
			}
			FROM = {
				has_completed_focus = BALTIC_ford_motors
			}
		}
		IF = {
			limit = {
				FROM = {
					original_TAG = BRA
				}
			}
			FROM = {
				has_completed_focus = BRA_expand_fordlandia
			}
		}
	}
	
	initial_trait = {
		equipment_bonus = {
			build_cost_ic = -0.05
		}
	}
}



USA_rock_island_arsenal_organization = {
	include = generic_artillery_organization
	icon = GFX_idea_rock_island_arsenal
	
 	allowed = {	
 		always = no
 	}
}