@cooldown = 3600

research_pact_no = {
	potential = { always = yes }
	allow = {
		custom_tooltip = {
			NOT = {
				AND = {
					NOT = { has_federation_law = research_pact_no }
					has_modifier = federation_law_category_research_pact_cooldown
					has_any_federation_law_in_category = law_category_research_pact
				}
			}
		}
	}
	# Baseline option, also the auto-assigned default. Kept benign (no cohesion cost, no cooldown) so the
	# default assignment at federation creation is harmless.
	on_enact = {
		set_federation_settings = {
			research_agreement = no
		}
	}

	ai_weight = {
		base = 10
	}
}

research_pact_yes = {
	potential = {
		NOT = { has_federation_flag = special_federation }
	}
	allow = {
		custom_tooltip = {
			NOT = {
				AND = {
					NOT = { has_federation_law = research_pact_yes }
					has_modifier = federation_law_category_research_pact_cooldown
					has_any_federation_law_in_category = law_category_research_pact
				}
			}
		}
	}
	required_centralization = {
		base = 5
		# The Galactic Union (default) unlocks the law one centralization tier earlier than other federation types.
		modifier = {
			add = -1
			has_federation_type = default_federation
		}
	}
	on_enact = {
		set_federation_settings = {
			research_agreement = yes
		}
		if = {
			limit = { has_federation_flag = enable_federation_cooldowns }
			add_modifier = {
				modifier = federation_law_category_research_pact_cooldown
				days = @cooldown
			}
		}
		add_cohesion = -5
	}

	ai_weight = {
		base = 0

		#Ethics
		modifier = {
			desc = federation_acceptance_materialist
			add = 25
			is_materialist = yes
		}
		modifier = {
			desc = federation_acceptance_xenophobe
			add = -15
			is_xenophobe = yes
		}

		#Personalities
		modifier = {
			desc = federation_acceptance_erudite_explorers
			add = 25
			has_ai_personality = erudite_explorers
		}

		#Civics
		modifier = {
			desc = federation_acceptance_technocracy
			add = 15
			has_civic = civic_technocracy
		}
		modifier = {
			desc = gal_com_supporting_civics
			add = 25
			OR = {
				is_eager_explorer_empire = yes
				has_civic = civic_hive_natural_neural_network
				has_civic = civic_hive_pooled_knowledge
				has_civic = civic_machine_introspective
				has_civic = civic_machine_predictive_analysis
			}
		}

		#Origins
		modifier = {
			desc = gal_com_supporting_origin
			add = 15
			OR = {
				has_origin = origin_shoulders_of_giants
				has_origin = origin_remnants
			}
		}
	}
}
