# -*- ck2.landed_titles -*-

d_sunni = { # The Sunni Caliphate
	color = { 40 160 40 }
	color2 = { 220 220 0 }
	capital = 693 # Baghdad
	creation_requires_capital = no
	dignity = 100 # Counted as having this many more counties than it does
	title = CALIPH
	title_female = CALIPHA
	foa = CALIPH_FOA
	short_name = yes
	religion = sunni
	# Controls a religion
	controls_religion = sunni
	caliphate = yes
	coat_of_arms = {
		data = { 0 0 0 3 0 2 2 }
		religion = sunni
	}
	allow = {
		OR = {
			trait = mirza
			trait = sayyid
			piety = 1000
		}
		trigger_if = {
			limit = {
				NOT = {
					has_alternate_start_parameter = {
						key = religion_names
						value = random
					}
				}
			}
			custom_tooltip = {
				text = sunni_creation_independent
				hidden_tooltip = {
					in_revolt = no
					OR = {
						independent = yes
						NOT = {
							any_liege = {
								OR = {
									in_revolt = yes
									NOT = { religion = sunni }
								}
							}
						}
					}
				}
			}
			OR = {
				AND = {
					trait = sayyid
					piety = 1000
				}
				trigger_if = {
					limit = { NOT = { has_global_flag = destroyed_caliphates } }
					custom_tooltip = {
						text = controls_mecca_medina
						hidden_tooltip = {
							c_mecca = { owner_under_ROOT = yes }
							c_medina = { owner_under_ROOT = yes }
						}
					}
				}
				custom_tooltip = {
					text = controls_jerusalem_damascus_baghdad
					hidden_tooltip = {
						c_jerusalem = { owner_under_ROOT = yes }
						c_damascus = { owner_under_ROOT = yes }
						c_baghdad = { owner_under_ROOT = yes }
					}
				}
			}
		}
		trigger_else = {
			custom_tooltip = {
				text = THREE_HOLY_SITES_TT
				hidden_tooltip = {
					any_realm_title = {
						count = 3
						is_holy_site = ROOT
					}
				}
			}
		}
		trigger_if = {
			limit = { has_global_flag = destroyed_caliphates }
			custom_tooltip = {
				text = controls_mecca_medina
				hidden_tooltip = {
					c_mecca = { owner_under_ROOT = yes }
					c_medina = { owner_under_ROOT = yes }
				}
			}
		}
	}
} # end d_sunni
