﻿republic_government_obligations = {
	display_mode = radiobutton
	is_shown = {
		scope:subject.primary_title.tier >= tier_county
	}
	obligation_levels = {
		republic_administrative_province_standard = {
			default = yes
			position = { 0 0 }
			icon = "gfx/interface/icons/celestial_administration_types/icon_standard_republic_administration.dds"
			gui_tags = { civilian }
			
			ai_liege_desire = {
				value = 0
				if = {
					limit = {
						scope:subject = { is_ai = yes }
					}
					add = 1
					
					# Cautious AI should tend to have a minor bias towards the default
					if = {
						limit = {
							scope:liege = { ai_has_cautious_personality = yes }
						}
						add = 1
					}
				}
			}
			ai_subject_desire = 0
			
			score = 0
			color = { 0.7 0.7 0.7 1.0 }
			
			enable_title_maa = no
			
			flag = japan_administrative_province_standard
		}
		republic_administrative_province_trade = {
			position = { 1 0 }
			icon = "gfx/interface/icons/celestial_administration_types/icon_industrial_republic_administration.dds"
			gui_tags = { civilian }
			
			ai_liege_desire = {
				value = 0
				if = {
					limit = {
						scope:subject = {
							is_ai = yes
							OR = {
								has_trait = education_stewardship
								stewardship >= very_high_skill_rating
							}
						}
					}
					add = 2
					
					# Economical AI wants more of civic vassals
					if = {
						limit = {
							scope:liege = { ai_has_builder_or_pious_builder_personality = yes }
						}
						add = 1
					}
				}
			}
			ai_subject_desire = 0
			
			score = 0
			color = { 0.2 0.2 0.7 1.0 }
			
			is_valid = {
				trigger_if = {
					limit = { exists = this }
					# Only for direct vassals of the top liege
					scope:liege.top_liege = this
				}
				# There can only be a limited number of industries at a time
				custom_tooltip = {
					text = japan_administrative_province_trade_amount_desc
					OR = {
						scope:liege = {
							any_vassal = {
								count < japan_administrative_province_trade_max_value
								vassal_contract_has_flag = japan_administrative_province_trade
							}
						}
						scope:subject = {
							OR = {
								vassal_contract_has_flag = japan_administrative_province_trade
								any_sub_realm_county = { is_coastal_county = yes } # Is a coastal province
							}
						}
					}
				}
			}

			tax_factor = 0.25
			enable_title_maa = no

			subject_modifier = {
				development_growth_factor = 0.15
				build_gold_cost = -0.1
				build_speed = -0.2
			}
			
			flag = admin_ai_is_builder
			flag = japan_administrative_province_trade
			flag = obligation_high_taxes
		}
		republic_administrative_province_military = {
			position = { 0 1 }
			icon = "gfx/interface/icons/celestial_administration_types/icon_military_republic_administration.dds"
			gui_tags = { military }
			
			ai_liege_desire = {
				value = 0
				if = {
					limit = {
						scope:subject = {
							is_ai = yes
							OR = {
								has_trait = education_martial
								martial >= very_high_skill_rating
								primary_title = {
									any_owned_title_maa_regiment = { count >= 3 }
								}
								any_sub_realm_county = { # Is a border province
									any_neighboring_county = { holder.top_liege != scope:subject.top_liege }
								}
							}
						}
					}
					add = 2
					
					# Preference for vassals along the border
					if = {
						limit = {
							scope:subject = {
								any_sub_realm_county = {
									any_neighboring_county = { holder.top_liege != scope:subject.top_liege }
								}
							}
						}
						add = 3
					}
					
					# Warlike AI wants more military vassals
					if = {
						limit = {
							scope:liege = { ai_has_warlike_personality = yes }
						}
						add = 1
					}
				}
			}
			ai_subject_desire = 0
			
			score = 0
			color = { 0.7 0.2 0.2 1.0 }
			
			is_valid = {
				trigger_if = {
					limit = { exists = this }
					# Only for direct vassals of the top liege
					scope:liege.top_liege = this
				}
				# There can only be a limited number of militaries at a time
				custom_tooltip = {
					text = japan_administrative_province_military_amount_desc
					OR = {
						scope:liege = {
							any_vassal = {
								count < japan_administrative_province_military_max_value
								vassal_contract_has_flag = japan_administrative_province_military
							}
						}
						scope:subject = { vassal_contract_has_flag = japan_administrative_province_military }
					}
				}
			}

			levies_factor = 0.5
			
			subject_modifier = {
				development_growth_factor = -0.2
				monthly_county_control_growth_factor = 0.1
				fort_level = 1
				defender_advantage = 2
				men_at_arms_maintenance = -0.15
			}
			
			flag = japan_administrative_province_military
			flag = japan_administrative_military_appointment
			flag = obligation_high_levies
		}
	}
}
