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

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

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

NOR_thunes_mekaniske_verksted_organization = {
    include = generic_infantry_tank_organization
    icon = GFX_idea_NOR_thunes_mekaniske_vaerksted
    allowed = { 
        tag = NOR
        has_dlc = "Arms Against Tyranny"
    }

    equipment_type = {  
        armor
        train_equipment
    }

    research_categories = { 
        armor
        train_tech
    }

    initial_trait = {
        name = NOR_mio_initial_trait_mechanical_workshop
        
        limit_to_equipment_type = { 
            train_equipment
        }
        equipment_bonus = {
            build_cost_ic = -0.07
            armor_value = 0.02
        }
    }
}

### SOV_morozov_design_bureau_organization -> see SOV_organizations.txt 

### GER_porsche_organization -> see SOV_organizations.txt 

### USA_chrysler_organization -> see USA_organizations.txt


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

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

NOR_akers_mekaniske_verksted_organization = {
    include = generic_escort_ship_organization
    icon = GFX_idea_NOR_akers_mekaniske_verksted
    allowed = { 
        NOR_AAT = yes 
    }

    equipment_type = {  
        screen_ship
        convoy_1
    }

    initial_trait = {
        name = NOR_mio_initial_trait_convoy_and_escort_fleet

        organization_modifier = {
            military_industrial_organization_research_bonus = 0.05
        }

        production_bonus = {
            production_capacity_factor = 0.07
        }
    }

    trait = {
        token = generic_mio_trait_submarine_hunters
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = generic_mio_trait_high_speed_mine_hunting_equipment
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = generic_mio_trait_advanced_hydrodynamic_design
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = generic_mio_trait_fleet_escorts
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = generic_mio_trait_anti_air_ships
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = generic_mio_trait_escort_in_force
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = generic_mio_trait_anti_air_layout
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = generic_mio_trait_gyro_stabilized_mounts
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = generic_mio_trait_improved_anti_air_gun_mounting
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = generic_mio_trait_mass_production
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = generic_mio_trait_improved_light_gun_mounting
        limit_to_equipment_type = { screen_ship }
    }

    trait = {
        token = NOR_mio_trait_convoy_production
        name = NOR_shipping_capitalist
        icon = GFX_generic_mio_trait_icon_supply_consumption
        special_trait_background  = yes

        position = { x=0 y=0 }
        limit_to_equipment_type = { convoy }
        
        production_bonus = {
            production_capacity_factor = 0.1
        }   

        available = {
            FROM = {
                NOR_johan_ludwig_mowinckel = {
                    is_political_advisor = yes 
                }
            }
        }
    }
}

NOR_karljohansvern_verft_organization = {
    include = generic_battle_line_ship_organization
    icon = GFX_idea_NOR_karljohansvern_verft
    allowed = { 
        tag = NOR
        has_dlc = "Arms Against Tyranny"
    } 

    trait = {
        token = NOR_mio_trait_forsvarets_forskningsinstitutt
        name = NOR_mio_trait_forsvarets_forskningsinstitutt
        icon = GFX_generic_mio_department_icon_facilities
        special_trait_background  = yes

        position = { x = 9 y = 0 }
        
        production_bonus = {
        }   

        organization_modifier = {
            military_industrial_organization_research_bonus = 0.1
        }

        available = {
            FROM = {
                has_completed_focus = NOR_the_royal_norwegian_navy
            }
        }
    }

    trait = {
        token = NOR_mio_trait_trondhjems_mekaniske_vaerksted
        name = NOR_mio_trait_trondhjems_mekaniske_vaerksted
        icon = GFX_generic_mio_department_icon_ship_general_production
        special_trait_background  = yes

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

        organization_modifier = {
        }

        available = {
            FROM = {
                controls_state = 143
            }
        }
    }

    trait = {
        token = NOR_mio_trait_cruiser_specialization
        name = NOR_mio_trait_cruiser_specialization
        icon = GFX_generic_mio_department_icon_ship_screen_ship_offense
        special_trait_background  = yes

        limit_to_equipment_type = { mio_cat_eq_all_cruiser }

        position = { x = 3 y = 1 }

        any_parent = { NOR_mio_trait_trondhjems_mekaniske_vaerksted }
        
        production_bonus = {
        }   

        organization_modifier = {
        }

        equipment_bonus = {
            lg_attack = 0.1
            max_strength = 0.05
            armor_value = 0.02
        }

        available = {
            FROM = {
                controls_state = 143
            }
        }
    }
}

### SOV_rubin_design_bureau_organization -> see SOV_organizations.txt 


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

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

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

NOR_marinens_flyvebaatfabrikk_organization = {
    include = generic_naval_aircraft_organization
    icon = GFX_idea_NOR_marinens_flyvebaatfabrikk
    allowed = { 
        tag = NOR
        has_dlc = "Arms Against Tyranny"
    }

    initial_trait = {
        equipment_bonus = {
            naval_strike_attack = 0.07
        }
    }

    add_trait = { 
        token = DEN_mio_trait_standardized_production_flyvertroppernes
        name = generic_mio_initial_trait_standardized_production
        icon = GFX_generic_mio_department_icon_plane_general_line_efficiency
        special_trait_background = yes

        position = { x=9 y=0 }
        
        available = {
            FROM = {
                has_completed_focus = NOR_increase_air_production
            }
        }

        production_bonus = {
            production_capacity_factor = 0.05
            production_efficiency_cap_factor = 0.05
            production_efficiency_gain_factor = 0.05
        }
    }        
}

### GER_messerschmitt_organization -> see GER_organizations.txt 

### GER_heinkel_organization -> see GER_organizations.txt 

### ENG_de_havilland_organization -> see ENG_organizations.txt


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

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


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

NOR_raufoss_ammunisjonsfabrikker_organization = {
    include = generic_artillery_organization
    icon = GFX_idea_NOR_raufoss_ammunisjonsfabrikker
    allowed = { 
        tag = NOR
        has_dlc = "Arms Against Tyranny"
    }  

    trait = { 
        token = SWE_bofors_fly_swatter
        name = SWE_bofors_fly_swatter
        icon = GFX_generic_mio_department_icon_anti_air
        special_trait_background  = yes
        position = { x=1 y=0 }
        relative_position_id = generic_mio_trait_improved_hydraulic_recoil_system

        all_parents = { generic_mio_trait_improved_hydraulic_recoil_system }
        available = {
            NOR = { has_completed_focus = NOR_buy_aa_from_sweden }
        }

        limit_to_equipment_type = {
            anti_air_equipment
        }

        equipment_bonus = {
            air_attack = 0.1
            ap_attack = 0.05
        }
    }
}

NOR_kongsberg_vaapenfabrikk_organization = {
    include = generic_infantry_equipment_organization
    icon = GFX_idea_NOR_kongsberg_vaapenfabrikk
    allowed = { 
        tag = NOR
        has_dlc = "Arms Against Tyranny"
    }
    initial_trait = {
        
        production_bonus = {
            production_efficiency_cap_factor = 0.03
            production_resource_need_factor = -0.05
        }

        equipment_bonus = {
            soft_attack = 0.03
            breakthrough = 0.02
        }
    }
}

NOR_norsk_spraengstofindustri_organization = {
    include = generic_support_equipment_organization
    icon = GFX_idea_NOR_norsk_Spraengstofindustri
    allowed = { 
        tag = NOR
        has_dlc = "Arms Against Tyranny"  
    }  
}

NOR_cadillac_organization = { #TODO_Manu: This is a perfect candidate to become a new USA MIO and be treated completely as a foreign MIO in NOR, in the future :D
    include = generic_motorized_mechanized_organization
    icon = GFX_idea_NOR_cadillac
    allowed = { 
        tag = NOR
        has_dlc = "Arms Against Tyranny"  
    }  
    available = {
        FROM = { NOT = { has_war_with = USA } } #This is a bit weird since the MIO does not exist in USA, but consistent with other foreign MIOs requisites
        FROM = { has_completed_focus = NOR_invite_cadillac_to_norway }
    }

    initial_trait = {
        production_bonus = {
            production_cost_factor = 0.1
            production_resource_need_factor = -0.15
        }

        organization_modifier = {
            military_industrial_organization_research_bonus = 0.05
        }

        equipment_bonus = {
            reliability = 0.05
        }
    }
}

### SOV_gaz_organization -> see SOV_organizations.txt
