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

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

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


USA_marmon_herrington_organization = {
	include = generic_mobile_tank_organization
	icon = GFX_idea_marmon_herrington
	allowed = {	
		OR = {
			tag = USA
			AND = {
				tag = BRA
				has_dlc = "Trial of Allegiance"
			}
		}
	}
	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 = {	
		OR = {
			tag = USA 
			AND = {
				tag = MEX 
				has_dlc = "Man the Guns"
			}
			NOR_AAT = yes 
		}
	}

	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_manufacturer

		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 = {	
		tag = USA
	}

	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 = {	
		tag = USA
	}
	available = {
		FROM = { has_completed_focus = USA_main_battle_tanks }
	}

	initial_trait = {
		name = USA_mio_trait_dedicated_tank_factory
		
		equipment_bonus = {
			armor_value = -0.05
			defense =-0.05
			build_cost_ic = -0.02
		}

		production_bonus = {
			production_efficiency_gain_factor = 0.1
		}
	}

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

		position = { x=-1 y=1 }
		relative_position_id = generic_mio_trait_standardized_components

		all_parents = { generic_mio_trait_standardized_components }
		production_bonus = {
			production_efficiency_cap_factor = 0.1
		}
	}

}

USA_tank_destroyer_board_organization = {
	name = tank_destroyer_board
	include = generic_mobile_tank_organization
	icon = GFX_idea_usa_tank_destroyer_board
	allowed = {	
		tag = USA 
	}
	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_escort_ship_organization
	icon = GFX_idea_norfolk_naval_yard
	allowed = {	
		tag = USA 
	}

	add_trait = { 
		token = USA_mio_trait_shipyard_expansion
		name = USA_mio_trait_shipyard_expansion
		icon = GFX_generic_mio_trait_icon_production_capacity
		special_trait_background = yes

		position = { x=2 y=0 }

		production_bonus = {
			production_capacity_factor = 0.05
		}
	}

	add_trait = { 
		token = USA_mio_trait_naval_station_norfolk
		name = USA_mio_trait_naval_station_norfolk
		icon = GFX_generic_mio_trait_icon_naval_range
		special_trait_background = yes

		all_parents = { USA_mio_trait_shipyard_expansion }

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

		equipment_bonus = {
			reliability = 0.1
			naval_range = 0.1
		}
	}

}

USA_electric_boat_company_organization = {
	include = generic_submarine_organization
	icon = GFX_idea_electric_boat_company
	allowed = {	
		tag = USA 
	}

	add_trait = { 
		token = USA_mio_trait_gould_centrifugal_pump
		name = USA_mio_trait_gould_centrifugal_pump
		icon = GFX_generic_mio_trait_icon_sub_visibility
		special_trait_background = yes

		any_parent = { generic_mio_trait_efficient_fuel_engines generic_mio_trait_high_powered_engines }

		position = { x=-1 y=1 }
		relative_position_id = generic_mio_trait_efficient_fuel_engines

		equipment_bonus = {
			sub_visibility = -0.03
		}
	}

	add_trait = { 
		token = USA_mio_trait_radar_experimentation
		name = USA_mio_trait_radar_experimentation
		icon = GFX_generic_mio_trait_icon_surface_detection
		special_trait_background = yes

		all_parents = { generic_mio_trait_experimental_anechoic_tiles generic_mio_trait_improved_torpedo_detonators }

		available = {
			FROM = {
				has_tech = centimetric_radar
			}
		}

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

		equipment_bonus = {
			sub_visibility = -0.03
			surface_detection = 0.03
		}
	}

}

USA_brooklyn_naval_yard_organization = {
	include = generic_battle_line_ship_organization
	icon = GFX_idea_brooklyn_naval_yard
	allowed = {	
		tag = USA 
	}

	add_trait = { 
		token = USA_mio_trait_the_can_do_shipyard
		name = USA_mio_trait_the_can_do_shipyard
		icon = GFX_generic_mio_trait_icon_production_capacity
		special_trait_background = yes

		all_parents = {   }

		position = { x=3 y=0 }

		production_bonus = {
			production_capacity_factor = 0.05
		}
	}

	add_trait = { 
		token = USA_mio_trait_drydock_expansion
		name = USA_mio_trait_drydock_expansion
		icon = GFX_generic_mio_department_icon_ship_capital_ship_production
		special_trait_background = yes

		limit_to_equipment_type = {
			capital_ship
		}

		all_parents = { USA_mio_trait_the_can_do_shipyard }

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

		production_bonus = {
			production_capacity_factor = 0.05
		}
	}
}

USA_newport_news_shipbuilding_organization = {
	include = generic_task_force_ship_organization
	icon = GFX_idea_newport_news_shipbuilding
	allowed = {	
		OR = {
			tag = USA
			AND = {
				tag = BRA
				has_dlc = "Trial of Allegiance"
			}
		}
	}
	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
				}
			}
		}
	}

	initial_trait = {
		name = USA_mio_trait_carrier_specialists
		
		limit_to_equipment_type = { 
			carrier
		}
		
		production_bonus = {
			production_capacity_factor = 0.05
		}

	}

	add_trait = { 
		token = USA_mio_trait_north_carolina_shipbuilding_company
		name = USA_mio_trait_north_carolina_shipbuilding_company
		icon = GFX_generic_mio_department_icon_ship_screen_ship_production
		special_trait_background = yes

		limit_to_equipment_type = {
			screen_ship
		}

		all_parents = {  }

		position = { x=3 y=0 }

		production_bonus = {
			production_capacity_factor = 0.05
		}
	}

}

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

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

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

USA_north_american_aviation_organization = {
	include = generic_range_focused_aircraft_organization
	icon = GFX_idea_north_american_aviation
	
	allowed = {	
		OR = {
			tag = USA 
			AND = {
				tag = BRA
				has_dlc = "Trial of Allegiance"
			}
		}
	}

	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
				}
			}
		}
	}

	initial_trait = {
		name = USA_mio_trait_light_long_range_aircraft
	}
	
	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 = {	
		tag = USA 
	}
	
	equipment_type = {
		mio_cat_eq_all_medium_plane 
		transport_plane_equipment
	}
	
	initial_trait = {
		name = USA_mio_trait_medium_long_range_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 = {	
		tag = USA 
	}

	override_trait = {
		token = generic_mio_trait_low_altitude_attacks
		position = { x=3 y=0 }
	}

	add_trait = {
		token = USA_mio_trait_remote_controlled_turrets
		name = USA_mio_trait_remote_controlled_turrets
		icon = GFX_generic_mio_trait_icon_air_attack

		special_trait_background = yes
		
		position = { x=0 y=1 }  
		relative_position_id = generic_mio_trait_low_altitude_attacks
		
		available = {
			FROM = {
				has_tech = computing_machine
			}
		}

		any_parent = { generic_mio_trait_low_altitude_attacks }
			
		equipment_bonus = {
			air_attack = 0.1
		}
	}

	add_trait = {
		token = USA_mio_trait_specialist_nose_configurations
		name = USA_mio_trait_specialist_nose_configurations
		icon = GFX_generic_mio_department_icon_plane_cas_combat

		special_trait_background = yes
		
		position = { x=0 y=2 }  
		relative_position_id = generic_mio_trait_heavily_armed_aircraft

		any_parent = { generic_mio_trait_air_brakes generic_mio_trait_wingborne_fuel_tanks }
		any_parent = {generic_mio_trait_heavily_armed_aircraft }
			
		equipment_bonus = {
			air_ground_attack = 0.1
		}
	}

}

USA_boeing_organization = {
	include = generic_heavy_aircraft_organization
	icon = GFX_idea_boeing
	
	allowed = {	
		tag = USA 
	}
	
	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 = {	 
		tag = USA 
	}
	
	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 = {
				is_special_project_completed = sp:sp_air_jet_engine
			}
		}
		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 = {	 
		tag = USA 
	}
}

USA_ford_motor_company_organization = {
	include = generic_motorized_mechanized_organization
	icon = GFX_idea_ford_motor_company
	
	allowed = {	 
		OR = {
			tag = USA 
			AND = {
				tag = POL # If Poland sets up a local one
				OR = {
					has_dlc = "Poland: United and Ready"
					has_dlc = "No Step Back"
				}
			}
			AND = {
				tag = ROM
				has_dlc = "Death or Dishonor"
			}
			tag = MEX # Mexican Ford
			AND = {
				tag = GRE # Greek Ford
				has_dlc = "Battle for the Bosporus"
			}
			AND = {
				OR = {
					original_TAG = LAT
					original_TAG = LIT
					original_TAG = EST
				}
				has_dlc = "No Step Back"
			}
			AND = {
				original_TAG = BRA
				# TODO_JUNO: Add juno DLC name here!!
				has_dlc = "Arms Against Tyranny"
			}
		}
	}
	
	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 = {	 
		tag = USA 

	}
}

USA_sikorsky_organization = {
	include = generic_helicopter_organization
	icon = GFX_idea_generic_helicopter_1
	
	allowed = {	
		original_tag = USA 
		has_dlc = "Gotterdammerung"		
	}
}