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

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

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

JAP_osaka_army_arsenal_organization = {
	include = generic_tank_organization
	icon = GFX_idea_osaka_army_arsenal
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
} 

JAP_mitsubishi_tanks_organization = {
	name = JAP_mitsubishi_organization
	include = generic_mobile_tank_organization
	icon = GFX_idea_mitsubishi
	allowed = {	
		tag = JAP
	}
}

JAP_kobe_seiko_sho_organization = {
	include = generic_medium_tank_organization
	icon = GFX_idea_jap_kobe_seiko_sho
	allowed = {	
		tag = JAP
	}
}

JAP_hino_motors_organization = {
	include = generic_heavy_tank_organization
	icon = GFX_idea_jap_hino_motors
	allowed = {	
		tag = JAP
	}
}



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

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


JAP_kure_naval_arsenal_organization = {
	include = generic_battle_line_ship_organization
	icon = GFX_idea_kure_naval_arsenal
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
	
	trait = {
        token = JAP_mio_trait_battleship_building_program
        name = JAP_mio_trait_battleship_building_program
        icon = GFX_generic_mio_department_icon_ship_capital_ship_production
        special_trait_background = yes
		available = {
			OR = {
				FROM = { has_completed_focus = JAP_the_ultimate_battleship }
				FROM = { has_war = yes }
			}
		}

        position = { x=3 y=0 }
		
		production_bonus = {
			production_capacity_factor = 0.15
		}
    }
}

JAP_yokosuka_naval_arsenal_organization = {
	include = generic_task_force_ship_organization
	icon = GFX_idea_yokosuka_naval_arsenal
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
	
	trait = {
        token = JAP_mio_trait_quality_carriers
        name = JAP_mio_trait_quality_carriers
        icon = GFX_generic_mio_department_icon_ship_carrier_quality
        special_trait_background = yes
		any_parent = { generic_mio_trait_flight_deck_edge_aa_mounts }

        position = { x=3 y=2 }
		
		limit_to_equipment_type = { mio_cat_eq_all_carrier }
		
		equipment_bonus = {
			armor_value = 0.05
			anti_air_attack = 0.05
			naval_range = 0.1
		}
    }
}

JAP_maizuru_naval_arsenal_organization = {
	include = generic_escort_ship_organization
	icon = GFX_idea_maizuru_naval_arsenal
	
	allowed = {	 
		OR = {
			tag = JAP 
			AND = {
				tag = ETH
				has_dlc = "By Blood Alone"
			}
		}
	}
	
	visible = {
		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}

		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_JAP_maizuru_naval_arsenal_organization_flag
				}
			}
		}
	}
	
	trait = {
        token = JAP_mio_trait_expand_the_arsenal
        name = JAP_mio_trait_expand_the_arsenal
        icon = GFX_generic_mio_trait_icon_production_capacity
        special_trait_background = yes

        position = { x=3 y=0 }
		
		production_bonus = {
			production_capacity_factor = 0.1
		}
		
		organization_modifier = {
			military_industrial_organization_funds_gain = 0.1
		}
    }
}

JAP_sasebo_naval_arsenal_organization = {
	include = generic_raider_ship_organization
	icon = GFX_idea_sasebo_naval_arsenal
	allowed = {	 
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
}

JAP_mitsubishi_shipyard_organization = {
	name = JAP_mitsubishi_organization
	include = generic_refurbishment_repair_organization
	icon = GFX_idea_mitsubishi
	allowed = {	 
		tag = JAP
	}
}

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

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

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


JAP_mitsubishi_organization = {
	include = generic_general_aircraft_organization
	icon = GFX_idea_mitsubishi
	
	allowed = {	 
		OR = {
			tag = JAP 
			AND = {
				tag = ETH
				has_dlc = "By Blood Alone"
			}
		}
	}
	
	visible = {
		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}

		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_JAP_mitsubishi_organization_flag
				}
			}
		}
	}
	
	trait = {
        token = JAP_mio_trait_extra_super_duralumin
        name = JAP_mio_trait_extra_super_duralumin
        icon = GFX_generic_mio_department_icon_plane_fighter_production
        special_trait_background = yes
		any_parent = { generic_mio_trait_conservative_designs }

        position = { x=5 y=0 }
		
		equipment_bonus = {
			air_agility = 0.1
			air_range = 0.05
			reliability = -0.03
		}
    }
	
	trait = {
        token = JAP_mio_trait_the_zero
        name = JAP_the_zero
        icon = GFX_generic_mio_department_icon_plane_cv_fighter_quality
        special_trait_background = yes
		any_parent = { generic_mio_trait_fighter_aircraft_specialists }
		available = { FROM = { has_completed_focus = JAP_the_zero } }

        position = { x=2 y=1 }
		
		limit_to_equipment_type = { mio_cat_eq_all_small_plane }
		
		equipment_bonus = {
			air_agility = 0.15
			air_range = 0.1
		}
    }
} 

JAP_kawanishi_organization = {
	include = generic_high_agility_fighter_aircraft_organization
	icon = GFX_idea_jap_kawanishi
	allowed = {	
		tag = JAP
	}
	equipment_type = {
		mio_cat_eq_all_small_plane
	}
}

JAP_aichi_organization = {
	include = generic_cas_aircraft_organization
	icon = GFX_idea_aichi
	allowed = {	
		tag = JAP
	}
}

JAP_kawasaki_organization = {
	include = generic_multi_role_aircraft_organization
	icon = GFX_idea_kawasaki
	allowed = {	
		tag = JAP
	}
}

JAP_nakajima_organization = {
	include = generic_heavy_aircraft_organization
	icon = GFX_idea_nakajima
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
}

JAP_yokosuka_organization = {
	include = generic_naval_aircraft_organization 
	icon = GFX_idea_yokosuka
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
	
	trait = {
        token = JAP_mio_trait_hiro_naval_arsenal
        name = JAP_mio_trait_hiro_naval_arsenal
        icon = GFX_generic_mio_department_icon_facilities
        special_trait_background = yes

        position = { x=2 y=0 }
		
		production_bonus = {
			production_capacity_factor = 0.05
			production_efficiency_cap_factor = 0.1
		}
    }
	
	trait = {
        token = JAP_mio_trait_torpedo_anti_rolling_controller
        name = JAP_mio_trait_torpedo_anti_rolling_controller
        icon = GFX_generic_mio_trait_icon_naval_strike_attack
        special_trait_background = yes
		any_parent = { generic_mio_trait_navigation_equipment }

        position = { x=6 y=1 }
		
		limit_to_equipment_type = { small_plane_naval_bomber_airframe cv_small_plane_cas_airframe cv_small_plane_naval_bomber_airframe }
		
		equipment_bonus = {
			naval_strike_attack = 0.1
			naval_strike_targetting = 0.1
		}
    }
}

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

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


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

JAP_kokura_arsenal_organization = {
	include = generic_infantry_equipment_organization
	icon = GFX_idea_tokyo_arsenal
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
	
	trait = {
        token = JAP_mio_trait_chrome_lined_barrels
        name = JAP_mio_trait_chrome_lined_barrels
        icon = GFX_generic_mio_department_icon_infantry_quality
        special_trait_background = yes
		any_parent = { generic_mio_trait_drum_pattern_sights }

        position = { x=0 y=1 }
		
		equipment_bonus = {
			reliability = 0.1
		}
    }
}

JAP_nagoya_arsenal_organization = {
	include = generic_support_equipment_organization
	icon = GFX_idea_jap_nagoya_arsenal
	allowed = {	
		tag = JAP
	}
}

JAP_osaka_army_arsenal_artillery_organization = {
	include = generic_artillery_organization
	icon = GFX_idea_osaka_army_arsenal
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
	trait = {
        token = JAP_mio_trait_establish_the_research_institute
        name = JAP_mio_trait_establish_the_research_institute
        icon = GFX_generic_mio_department_icon_facilities
        special_trait_background = yes

        position = { x=3 y=0 }
		
		organization_modifier = {
			military_industrial_organization_research_bonus = 0.07
			military_industrial_organization_design_team_assign_cost = -0.33
		}
    }
} 

JAP_nissan_organization = { # not actually nissan but I'm not gonna change anything because of other mechanics
	name = JAP_isuzu_organization
	include = generic_motorized_mechanized_organization 
	icon = GFX_idea_jap_isuzu
	allowed = {	 
		OR = {
			tag = JAP 
			AND = {
				tag = ETH
				has_dlc = "By Blood Alone"
			}
		}
	}
	
	visible = {
		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}

		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_JAP_nissan_organization_flag
				}
			}
		}
	}
	
	trait = {
        token = JAP_mio_trait_reorganize_the_company
        name = JAP_mio_trait_reorganize_the_company
        icon = GFX_generic_mio_department_icon_facilities
        special_trait_background = yes

        position = { x=3 y=0 }
		
		organization_modifier = {
			military_industrial_organization_research_bonus = 0.07
			military_industrial_organization_funds_gain = 0.2
		}
		
		production_bonus = {
			production_efficiency_gain_factor = 0.1
		}
		
		on_complete = {
			mio:JAP_nissan_organization = {
				set_mio_name_key = JAP_tokyo_automobile_industries
			}
		}
    }
}

JAP_ishikawajima_motorcar_factory_organization = {
	include = generic_armored_car_organization
	icon = GFX_idea_jap_ishikawajima_motorcar_factory
	allowed = {	
		tag = JAP
	}
}

JAP_kayaba_organization = {
	include = generic_helicopter_organization
	icon = GFX_idea_jap_kayaba
	
	allowed = {	
		original_tag = JAP
	}
}