country_decisions = {

	andalusian_nation = {
		major = yes
		potential = {
			religion_group = muslim
			NOT = { tag = PAP }
			NOT = { tag = HLR }
			NOT = { tag = EUR }
			NOT = { tag = SPA }
			NOT = { tag = ADU }
			is_colonial_nation = no
			OR = {
				is_former_colonial_nation = no
				AND = {
					is_former_colonial_nation = yes
					ai = no
				}
			}
			OR = {
				primary_culture = andalucian
				culture_group = maghrebi
			}
			OR = {
				ai = no
				AND = {
					NOT = { exists = ADU }
					num_of_cities = 6
					any_owned_province = {
						region = andalusia
					}
				}
			}
		}
		allow = {
			NOT = { exists = ADU }
			is_subject = no
			is_at_war = no
			is_tribal = no
			owns_core_province = 221			# Murcia
			owns_core_province = 223			# Granada
			owns_core_province = 224			# Andalucia
			owns_core_province = 225			# Cordoba
			owns_core_province = 226			# Gibraltar
			owns_core_province = 1748			# Jaen
			owns_core_province = 1749			# Cadiz
			owns_core_province = 218			# Badajoz
			owns_core_province = 222			# Almeria
			OR = {
				AND = {
					owns_core_province = 230			# Algarve
					owns_core_province = 229			# Alentejo
				}
				AND = {
					owns_core_province = 1750			# Alicante
					owns_core_province = 220			# Valencia
				}
			}
		}
		effect = {
			change_tag = ADU
			if = {
				limit = {
					is_part_of_hre = yes
					is_elector = no
				}
				every_owned_province = {
					limit = {
						is_part_of_hre = yes
					}
					set_in_empire = no
				}
			}
			if = {
				limit = {
					NOT = { government_rank = 2 }
				}
				set_government_rank = 2
			}
			add_prestige = 25
			set_capital = 225 # Cordoba
			if = {
				limit = {
					NOT = { primary_culture = andalucian }
				}
				change_primary_culture = andalucian
			}
			#andalusia = {
			#	limit = {
			#		NOT = { owned_by = ROOT }
			#	}
			#	add_claim = ADU
			#}
		}
		ai_will_do = {
			factor = 400
		}
	}
}
