EAI_mexico_join_allies = {
	name = "join allies"
	desc = ""

	enable = {
		original_tag = MEX
		has_dlc = "Man the Guns"
		OR = {
			AND = {
				is_historical_focus_on = yes
				has_game_rule = {
					rule = MEX_ai_behavior
					option = DEFAULT
				}
			}
			has_country_flag = MEX_AI_SECULAR_REPUBLIC 
			has_game_rule = {
				rule = MEX_ai_behavior
				option = SECULAR_REPUBLIC
			}
		}

		date > 1942.1.1

		NOT = { has_completed_focus = MEX_focus_liberty_and_justice_for_all }

		USA = { has_war_with = GER }

		NOT = {
			USA = { has_capitulated = yes }
			GER = { has_capitulated = yes }
		}
	}
	abort = {
		OR = {
			has_war_with = USA
			has_government = fascism
			has_government = communism

			AND = {
				NOT = {
					AND = {
						date > 1942.1.1

						NOT = { has_completed_focus = MEX_focus_liberty_and_justice_for_all }

						USA = { has_war_with = GER }

						NOT = {
							USA = { has_capitulated = yes }
							GER = { has_capitulated = yes }
						}
					}
				}
			}
		}
	}

	ai_national_focuses = {
		MEX_focus_liberty_and_justice_for_all # Requests to join America's faction
	}
	focus_factors = {
		MEX_focus_liberty_and_justice_for_all = 10000
	}
}

mexico_historical = {
	name = "Mexican Secular Republic"
	desc = "The trend towards moderate secularism and the rule of law will be strengthened in Mexico, with the country aligning itself towards America."

	allowed = {
		original_tag = MEX
		has_dlc = "Man the Guns"
	}
	enable = {
		OR = {
			AND = {
				is_historical_focus_on = yes
				has_game_rule = {
					rule = MEX_ai_behavior
					option = DEFAULT
				}
			}
			has_country_flag = MEX_AI_SECULAR_REPUBLIC 
			has_game_rule = {
				rule = MEX_ai_behavior
				option = SECULAR_REPUBLIC
			}
		}
		NOT = {
			AND = {
				date > 1942.1.1

				NOT = { has_completed_focus = MEX_focus_liberty_and_justice_for_all }

				USA = { has_war_with = GER }

				NOT = {
					USA = { has_capitulated = yes }
					GER = { has_capitulated = yes }
				}
			}
		}
	}
	abort = {
		OR = {
			has_war_with = USA
			has_government = fascism
			has_government = communism

			AND = {
				date > 1942.1.1

				NOT = { has_completed_focus = MEX_focus_liberty_and_justice_for_all }

				USA = { has_war_with = GER }
		
				NOT = {
					USA = { has_capitulated = yes }
					GER = { has_capitulated = yes }
				}
			}
		}
	}

	ai_national_focuses = {
		MEX_focus_plan_of_agua_prieta
		MEX_focus_exile_calles
		MEX_focus_control_the_army
		MEX_focus_repeal_the_calles_law # Increase Church Power (3)
		MEX_focus_ban_political_militias # Lower Caudillo Tensions
		MEX_focus_revolutionary_women
		MEX_focus_depoliticised_army # Lower Caudillo Tensions
		MEX_focus_abolish_capital_punishment
		MEX_focus_state_education # 3rd research slot
		MEX_focus_professional_army # Lower Caudillo Tensions
		
		MEX_focus_purge_the_bureaucracy
		MEX_focus_institutional_revolution # Go Democratic
		MEX_focus_arrest_general_cedillo # Prevent rebellion
		
		MEX_focus_national_bank
		MEX_focus_agricultural_credit_bank
		MEX_focus_confederation_of_mexican_workers # Decrease Church Power (2)
		MEX_focus_rent_freeze
		MEX_focus_ejido_worker_militias # Communist drift
		MEX_focus_womens_suffrage # Increase Church Power(3), Democratic drift
				
		MEX_focus_spanish_civil_war_refugees
		MEX_focus_support_spains_loyalists # Decrease Church Power (2)
		MEX_focus_realpolitik
		
		MEX_focus_rural_infrastructure
		MEX_focus_peripheral_infrastructure
		MEX_focus_rural_schools # 4th research slot
		
		MEX_focus_oil_field_expansion
		MEX_focus_nationalize_the_oil_fields
		MEX_focus_compensation
		# MEX_focus_liberty_and_justice_for_all # Requests to join America's faction
		MEX_focus_aztec_eagles
		MEX_focus_international_peacekeepers # Democratic drift
				
		MEX_focus_northern_steel_plants
		MEX_focus_engineering_school
		MEX_focus_television_innovators # 5th research slot
		MEX_focus_xefo
		MEX_focus_law_on_industrial_promotion
		MEX_focus_nafinsa
		MEX_focus_oil_revenue_reinvestment
		# Economic and political stuff is complete at this point, AI will pick military NFs from here on
	}
	ideas = {
		MEX_bartolome_garcia_correa = 10
	}
	focus_factors = {
		MEX_focus_liberty_and_justice_for_all = 0 #EAI
	}
}

mexico_social_catholicism = {
	name = "Mexican Social Catholicism"
	desc = "Moderate reformers within the Catholic Church will create a new concordat within Mexico, bringing an end to the social strife of totalitarianism and aligning Mexico towards Britain."

	allowed = {
		original_tag = MEX
		has_dlc = "Man the Guns"
	}
	enable = {
		OR = {
			has_country_flag = MEX_AI_SOCIAL_CATHOLICISM 
			has_game_rule = {
				rule = MEX_ai_behavior
				option = SOCIAL_CATHOLICISM
			}
		}
	}

	ai_national_focuses = {
		MEX_focus_plan_of_agua_prieta
		MEX_focus_exile_calles
		MEX_focus_control_the_army
		MEX_focus_repeal_the_calles_law # Increase Church Power
		
		MEX_focus_antidisestablishmentarianism # Go religious as soon as possible
		MEX_focus_rewrite_the_constitution
		MEX_focus_knights_of_columbus # Democratic drift
		MEX_focus_catholic_politics # Go Democratic as soon as possible
		MEX_focus_church_schools # 3rd research slot
		
		MEX_focus_purge_the_bureaucracy
		MEX_focus_arrest_general_cedillo # Prevent rebellion
		
		MEX_focus_ban_political_militias # Lower Caudillo Tensions
		MEX_focus_revolutionary_women
		MEX_focus_womens_suffrage # Increase Church Power, Democratic drift
		
		MEX_focus_depoliticised_army
		MEX_focus_abolish_capital_punishment
		MEX_focus_professional_army
		
		MEX_focus_national_bank
		MEX_focus_liberalize_the_banking_sector
		MEX_focus_strike_breaking
		MEX_focus_urban_development
		MEX_focus_cientifico_camarilla # 4th research slot
		
		MEX_focus_spanish_civil_war_refugees
		MEX_focus_falangist_veterans # Increase Church Power
		MEX_focus_realpolitik
		
		MEX_focus_oil_field_expansion
		MEX_focus_royal_dutch_shell
		MEX_focus_community_of_nations # Join Britain's faction
		MEX_focus_purchase_belize
		MEX_focus_international_peacekeepers # Democratic drift
		
		MEX_focus_northern_steel_plants
		MEX_focus_engineering_school
		MEX_focus_television_innovators # 5th research slot

		MEX_focus_oil_revenue_reinvestment
		
		MEX_focus_social_catholicism
		MEX_focus_synarchist_communes
		MEX_focus_reform_the_cristero_guard
		
		MEX_focus_end_land_reform
		MEX_focus_privatization
		MEX_focus_caudillo_private_armies
		
		MEX_focus_military_budget_review
		MEX_focus_heroic_military_college
	}
	ideas = {
		MEX_bartolome_garcia_correa = 10
	}
}

mexico_fascist_axis = {
	name = "Mexican Fascist Dictatorship"
	desc = "Plutarco Calles, Saturnino Cedillo and the other military strongmen will abort Mexico's nascent attempts at democracy, aligning towards Germany."

	allowed = {
		original_tag = MEX
		has_dlc = "Man the Guns"
	}
	enable = {
		OR = {
			has_country_flag = MEX_AI_FASCIST_DICTATORSHIP 
			has_game_rule = {
				rule = MEX_ai_behavior
				option = FASCIST_DICTATORSHIP
			}
			AND = {
				is_historical_focus_on = yes
				has_government = fascism
			}
		}
	}

	ai_national_focuses = {
		MEX_focus_plan_of_agua_prieta
		MEX_focus_legacy_of_revolution
		MEX_focus_the_gold_shirts # Fascist drift
		MEX_focus_revanchist_revolution # Go Fascist as soon as possible. Calles or Cedillo will lead.
		
		MEX_focus_jefe_maximo # Calles potential country leader
		
		MEX_focus_national_bank
		MEX_focus_liberalize_the_banking_sector
		MEX_focus_end_land_reform
		MEX_focus_privatization
		MEX_focus_caudillo_private_armies
		MEX_focus_support_general_cedillo # Cedillo potential country leader
		
		MEX_focus_control_the_army
		MEX_focus_enforce_the_calles_law
		MEX_focus_triumph_over_the_cristeros
		MEX_focus_state_education # 3rd research slot
		
		MEX_focus_strike_breaking
		MEX_focus_urban_development
		MEX_focus_cientifico_camarilla # 4th research slot
		
		MEX_focus_military_budget_review # American threats mean more emphasis on the army
		MEX_focus_heroic_military_college
		
		MEX_focus_oil_field_expansion
		MEX_focus_nationalize_the_oil_fields
		MEX_focus_german_resource_exchange
		MEX_focus_new_world_order # Join Germany's faction
		
		MEX_focus_interior_defence_plan
		MEX_focus_march_southwards # Begin attacking the South
		
		MEX_focus_northern_steel_plants
		
		MEX_focus_revolutionary_women
		MEX_focus_soldaderas
		
		MEX_focus_engineering_school
		MEX_focus_television_innovators # 5th research slot
		
		MEX_focus_international_struggle
		MEX_focus_hispanic_culture
		
		MEX_focus_spanish_civil_war_refugees
		MEX_focus_falangist_veterans
		
		MEX_focus_hispanic_alliance # If they weren't accepted by Germany, they should create their own faction...
		MEX_focus_coastal_defence_plan
		MEX_focus_realpolitik # ...else they should get bonuses
		
		MEX_focus_unify_centroamerica
		MEX_focus_integrate_the_south
		MEX_focus_push_past_the_darien_gap
	}
	
	ideas = {
		MEX_jose_vasconcelos = 10
	}
}

mexico_fascist_latin_american_order = {
	name = "Mexican Theocratic Order"
	desc = "The Synarchists and Cristeros will take power in Mexico, creating a new Latin American order to purge the continent of heretics."

	allowed = {
		original_tag = MEX
		has_dlc = "Man the Guns"
	}
	enable = {
		OR = {
			has_country_flag = MEX_AI_THEOCRATIC_ORDER 
			has_game_rule = {
				rule = MEX_ai_behavior
				option = THEOCRATIC_ORDER
			}
		}
	}

	ai_national_focuses = {
		MEX_focus_plan_of_agua_prieta
		MEX_focus_exile_calles
		MEX_focus_control_the_army
		MEX_focus_repeal_the_calles_law # Increase Church Power
		
		MEX_focus_antidisestablishmentarianism # Go religious as soon as possible
		MEX_focus_rewrite_the_constitution
		MEX_focus_legion_of_christ # Fascist drift
		MEX_focus_crusade_against_atheism # Go Fascist as soon as possible
		MEX_focus_church_schools # 3rd research slot

		MEX_focus_purge_the_bureaucracy
		MEX_focus_arrest_general_cedillo # Prevent rebellion
		
		MEX_focus_triumph_of_synarchism
		MEX_focus_reform_the_cristero_guard
				
		MEX_focus_legacy_of_revolution
		MEX_focus_the_gold_shirts # Fascist drift
		
		MEX_focus_revolutionary_women
		MEX_focus_womens_suffrage # Increase Church Power, Democratic drift
		MEX_focus_soldaderas
		
		MEX_focus_international_struggle
		MEX_focus_hispanic_culture
		MEX_focus_spanish_civil_war_refugees
		MEX_focus_falangist_veterans
		MEX_focus_hispanic_alliance # Create faction
		MEX_focus_invite_brazil
		
		MEX_focus_national_bank
		MEX_focus_liberalize_the_banking_sector
		MEX_focus_strike_breaking
		MEX_focus_urban_development
		MEX_focus_cientifico_camarilla # 4th research slot
		
		MEX_focus_oil_field_expansion
		MEX_focus_nationalize_the_oil_fields
		MEX_focus_german_resource_exchange
		MEX_focus_new_world_order # Should be bypassed but just in case
		
		MEX_focus_coastal_defence_plan
		MEX_focus_march_southwards
		
		MEX_focus_military_budget_review # American threats mean more emphasis on the army
		MEX_focus_heroic_military_college

		MEX_focus_unify_centroamerica # Get access to Panama Canal
		
		MEX_focus_interior_defence_plan
		
		MEX_focus_seize_the_panama_canal # Attack America
		MEX_focus_rescind_the_mexican_cession # Good luck with that
		MEX_focus_redeem_aztlan
		
		MEX_focus_northern_steel_plants
		MEX_focus_engineering_school
		MEX_focus_television_innovators # 5th research slot
		
		MEX_focus_end_land_reform
		MEX_focus_privatization
		MEX_focus_caudillo_private_armies
	}
	
	ideas = {
		MEX_jose_vasconcelos = 10
	}
}

mexico_communism_ussr = {
	name = "Mexican Soviet Republic"
	desc = "Mexico will align itself towards the Soviet Union, spreading the Revolution into Latin America at the tip of a bayonet."

	allowed = {
		original_tag = MEX
		has_dlc = "Man the Guns"
	}
	enable = {
		OR = {
			has_country_flag = MEX_AI_SOVIET_REPUBLIC 
			has_game_rule = {
				rule = MEX_ai_behavior
				option = SOVIET_REPUBLIC
			}
			AND = {
				is_historical_focus_on = yes
				has_government = communism
			}
		}
	}
	ai_national_focuses = {
		MEX_focus_plan_of_agua_prieta
		MEX_focus_legacy_of_revolution
		MEX_focus_the_red_shirts # Communist drift
		MEX_focus_communist_revolution # Go Communist as soon as possible
		
		MEX_focus_exile_calles
		MEX_focus_purge_the_bureaucracy
		MEX_focus_arrest_general_cedillo # Prevent rebellion
		MEX_focus_control_the_army
		
		MEX_focus_enforce_the_calles_law # Decrease Church Power
		MEX_focus_triumph_over_the_cristeros
		MEX_focus_state_education # 3rd research slot
		
		MEX_focus_national_bank
		MEX_focus_agricultural_credit_bank
		MEX_focus_confederation_of_mexican_workers # Decrease Church Power
		MEX_focus_rent_freeze
		MEX_focus_ejido_worker_militias # Communist drift
		
		MEX_focus_rural_infrastructure
		MEX_focus_peripheral_infrastructure
		MEX_focus_rural_schools # 4th research slot
		
		MEX_focus_oil_field_expansion
		MEX_focus_nationalize_the_oil_fields
		MEX_focus_oppose_yanqui_imperialism
		MEX_focus_international_proletarianism # Join USSR's faction
		
		MEX_focus_interior_defence_plan
		MEX_focus_march_southwards # Attack south
		
		MEX_focus_northern_steel_plants
		MEX_focus_engineering_school
		MEX_focus_television_innovators # 5th research slot
		
		MEX_focus_unify_centroamerica
		MEX_focus_integrate_the_south
		
		MEX_focus_revolutionary_women
		MEX_focus_soldaderas
		MEX_focus_xefo
		MEX_focus_law_on_industrial_promotion
		MEX_focus_nafinsa
		
		MEX_focus_spanish_civil_war_refugees
		MEX_focus_support_spains_loyalists # Decrease Church Power
		
		MEX_focus_bolivarian_alliance # If they weren't accepted by Russia, they should create their own faction...
		MEX_focus_coastal_defence_plan
		MEX_focus_realpolitik # ...else they should get bonuses
		
		MEX_focus_push_past_the_darien_gap
	}
	ideas = {
		MEX_vicente_lombardo = 10
	}
}

mexico_communism_bolivarian = {
	name = "Cárdenismo"
	desc = "Lázaro Cárdenas and his left-wing successors will create a Bolivarian Alliance and strike at the Yanqui imperialists."

	allowed = {
		original_tag = MEX
		has_dlc = "Man the Guns"
	}
	enable = {
		OR = {
			has_country_flag = MEX_AI_CARDENISMO 
			has_game_rule = {
				rule = MEX_ai_behavior
				option = CARDENISMO
			}
		}
	}
	ai_national_focuses = {
		MEX_focus_plan_of_agua_prieta
		MEX_focus_legacy_of_revolution
		MEX_focus_the_red_shirts # Communist drift

		MEX_focus_exile_calles
		MEX_focus_purge_the_bureaucracy
		MEX_focus_arrest_general_cedillo # Prevent rebellion

		MEX_focus_national_bank
		MEX_focus_agricultural_credit_bank
		MEX_focus_confederation_of_mexican_workers # Decrease Church Power
		MEX_focus_rent_freeze
		MEX_focus_ejido_worker_militias # Communist drift
		MEX_focus_party_of_the_revolution # Go Communist as soon as possible
		
		MEX_focus_repeal_the_calles_law # Increase Church Power
		MEX_focus_abolish_capital_punishment
		MEX_focus_state_education # 3rd research slot
		
		MEX_focus_rural_infrastructure
		MEX_focus_peripheral_infrastructure
		MEX_focus_rural_schools # 4th research slot
		
		MEX_focus_revolutionary_women
		MEX_focus_soldaderas
		
		MEX_focus_spanish_civil_war_refugees
		MEX_focus_support_spains_loyalists # Decrease Church Power
		
		MEX_focus_bolivarian_alliance # Create own faction
		MEX_focus_liberate_the_antilles
		
		MEX_focus_coastal_defence_plan
		MEX_focus_march_southwards
		
		MEX_focus_oil_field_expansion
		MEX_focus_nationalize_the_oil_fields
		MEX_focus_oppose_yanqui_imperialism
		MEX_focus_international_proletarianism # Should be bypassed but just in case
		
		MEX_focus_unify_centroamerica # Get access to Panama Canal
		MEX_focus_integrate_the_south
		
		MEX_focus_military_budget_review
		MEX_focus_heroic_military_college
		
		MEX_focus_interior_defence_plan
		
		MEX_focus_seize_the_panama_canal # Attack America
		MEX_focus_rescind_the_mexican_cession # Good luck with that
		MEX_focus_redeem_aztlan
		
		MEX_focus_weapons_modernisation
		MEX_focus_aviation_workshops
		MEX_focus_tank_workshops
		MEX_focus_military_aviation_specialists
		MEX_focus_army_expansion_programme
		MEX_focus_heavy_artillery
		
		MEX_focus_smash_the_bureaucrats
		
		MEX_focus_gulf_coast_naval_yards
		MEX_focus_pacific_coast_naval_yards
		MEX_focus_brown_water_navy
		MEX_focus_blue_water_navy
		
		MEX_focus_one_world_government
	}
	ideas = {
		MEX_vicente_lombardo = 10
	}
}
