﻿# Italian Senate offices use the native council-position lifecycle. Roman
# restoration adds Works and one charter-selected War or Justice portfolio.
aureliani_presiding_senator = {
	skill = diplomacy
	name = aureliani_presiding_senator
	tooltip = aureliani_presiding_senator_desc
	auto_fill = no
	inherit = no
	can_fire = yes
	can_reassign = yes

	# Unavailable portfolios must not count as empty native council slots.
	valid_position = {
		aureliani_senate_visible_trigger = yes
		house:house_aureliani = { has_variable = aureliani_senate_stage }
	}
	valid_character = { aureliani_senate_office_native_candidate_trigger = { OFFICE_VAR = aureliani_office_presiding } }
	on_get_position = {
		aureliani_senate_office_charge_appointment_effect = { OFFICE_VAR = aureliani_office_presiding }
		house:house_aureliani = { set_variable = { name = aureliani_office_presiding value = root } }
		got_council_position_effect = yes
		start_default_task = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	on_lose_position = {
		if = {
			limit = {
				OR = {
					AND = { scope:councillor_liege = house:house_aureliani.house_head scope:councillor_liege = { is_alive = yes } }
					aureliani_senate_office_succession_holder_trigger = no
				}
			}
			house:house_aureliani = { if = { limit = { exists = var:aureliani_office_presiding var:aureliani_office_presiding = root } remove_variable = aureliani_office_presiding } }
		}
		aureliani_senate_offices_update_view_effect = yes
	}
	on_fired_from_position = {
		house:house_aureliani = { if = { limit = { exists = var:aureliani_office_presiding var:aureliani_office_presiding = root } remove_variable = aureliani_office_presiding } }
		fired_from_council_position_effect = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	portrait_animation = page_flipping
}

aureliani_senate_treasurer = {
	skill = stewardship
	name = aureliani_senate_treasurer
	tooltip = aureliani_senate_treasurer_desc
	auto_fill = no
	inherit = no
	can_fire = yes
	can_reassign = yes

	# Unavailable portfolios must not count as empty native council slots.
	valid_position = {
		aureliani_senate_visible_trigger = yes
		house:house_aureliani = { has_variable = aureliani_senate_stage }
	}
	valid_character = { aureliani_senate_office_native_candidate_trigger = { OFFICE_VAR = aureliani_office_treasurer } }
	on_get_position = {
		aureliani_senate_office_charge_appointment_effect = { OFFICE_VAR = aureliani_office_treasurer }
		house:house_aureliani = { set_variable = { name = aureliani_office_treasurer value = root } }
		got_council_position_effect = yes
		start_default_task = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	on_lose_position = {
		if = {
			limit = {
				OR = {
					AND = { scope:councillor_liege = house:house_aureliani.house_head scope:councillor_liege = { is_alive = yes } }
					aureliani_senate_office_succession_holder_trigger = no
				}
			}
			house:house_aureliani = { if = { limit = { exists = var:aureliani_office_treasurer var:aureliani_office_treasurer = root } remove_variable = aureliani_office_treasurer } }
		}
		aureliani_senate_offices_update_view_effect = yes
	}
	on_fired_from_position = {
		house:house_aureliani = { if = { limit = { exists = var:aureliani_office_treasurer var:aureliani_office_treasurer = root } remove_variable = aureliani_office_treasurer } }
		fired_from_council_position_effect = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	portrait_animation = happy_teacher
}

aureliani_keeper_of_records = {
	skill = learning
	name = aureliani_keeper_of_records
	tooltip = aureliani_keeper_of_records_desc
	auto_fill = no
	inherit = no
	can_fire = yes
	can_reassign = yes

	# Unavailable portfolios must not count as empty native council slots.
	valid_position = {
		aureliani_senate_visible_trigger = yes
		house:house_aureliani = { has_variable = aureliani_senate_stage }
	}
	valid_character = { aureliani_senate_office_native_candidate_trigger = { OFFICE_VAR = aureliani_office_records } }
	on_get_position = {
		aureliani_senate_office_charge_appointment_effect = { OFFICE_VAR = aureliani_office_records }
		house:house_aureliani = { set_variable = { name = aureliani_office_records value = root } }
		got_council_position_effect = yes
		start_default_task = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	on_lose_position = {
		if = {
			limit = {
				OR = {
					AND = { scope:councillor_liege = house:house_aureliani.house_head scope:councillor_liege = { is_alive = yes } }
					aureliani_senate_office_succession_holder_trigger = no
				}
			}
			house:house_aureliani = { if = { limit = { exists = var:aureliani_office_records var:aureliani_office_records = root } remove_variable = aureliani_office_records } }
		}
		aureliani_senate_offices_update_view_effect = yes
	}
	on_fired_from_position = {
		house:house_aureliani = { if = { limit = { exists = var:aureliani_office_records var:aureliani_office_records = root } remove_variable = aureliani_office_records } }
		fired_from_council_position_effect = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	portrait_animation = page_flipping
}

aureliani_minister_works = {
	skill = stewardship
	name = aureliani_minister_works
	tooltip = aureliani_minister_works_desc
	auto_fill = no
	inherit = no
	can_fire = yes
	can_reassign = yes

	# Unavailable portfolios must not count as empty native council slots.
	valid_position = {
		aureliani_senate_visible_trigger = yes
		house:house_aureliani = { has_variable = aureliani_senate_stage var:aureliani_senate_stage ?= 2 }
	}
	valid_character = {
		house:house_aureliani = { has_variable = aureliani_senate_stage var:aureliani_senate_stage ?= 2 }
		aureliani_senate_office_native_candidate_trigger = { OFFICE_VAR = aureliani_office_works }
	}
	on_get_position = {
		aureliani_senate_office_charge_appointment_effect = { OFFICE_VAR = aureliani_office_works }
		house:house_aureliani = { set_variable = { name = aureliani_office_works value = root } }
		got_council_position_effect = yes
		start_default_task = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	on_lose_position = {
		if = {
			limit = {
				OR = {
					AND = { scope:councillor_liege = house:house_aureliani.house_head scope:councillor_liege = { is_alive = yes } }
					aureliani_senate_office_succession_holder_trigger = no
				}
			}
			house:house_aureliani = { if = { limit = { exists = var:aureliani_office_works var:aureliani_office_works = root } remove_variable = aureliani_office_works } }
		}
		aureliani_senate_offices_update_view_effect = yes
	}
	on_fired_from_position = {
		house:house_aureliani = { if = { limit = { exists = var:aureliani_office_works var:aureliani_office_works = root } remove_variable = aureliani_office_works } }
		fired_from_council_position_effect = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	portrait_animation = minister_works
}

aureliani_minister_war = {
	skill = martial
	name = aureliani_minister_war
	tooltip = aureliani_minister_war_desc
	auto_fill = no
	inherit = no
	can_fire = yes
	can_reassign = yes

	# Unavailable portfolios must not count as empty native council slots.
	valid_position = {
		aureliani_senate_visible_trigger = yes
		house:house_aureliani = { has_variable = aureliani_senate_stage var:aureliani_senate_stage ?= 2 has_variable = aureliani_senate_roman_portfolio var:aureliani_senate_roman_portfolio ?= 1 }
	}
	valid_character = {
		house:house_aureliani = { has_variable = aureliani_senate_stage var:aureliani_senate_stage ?= 2 has_variable = aureliani_senate_roman_portfolio var:aureliani_senate_roman_portfolio ?= 1 }
		aureliani_senate_office_native_candidate_trigger = { OFFICE_VAR = aureliani_office_fifth }
	}
	on_get_position = {
		aureliani_senate_office_charge_appointment_effect = { OFFICE_VAR = aureliani_office_fifth }
		house:house_aureliani = { set_variable = { name = aureliani_office_fifth value = root } }
		got_council_position_effect = yes
		start_default_task = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	on_lose_position = {
		if = {
			limit = {
				OR = {
					AND = { scope:councillor_liege = house:house_aureliani.house_head scope:councillor_liege = { is_alive = yes } }
					aureliani_senate_office_succession_holder_trigger = no
				}
			}
			house:house_aureliani = { if = { limit = { exists = var:aureliani_office_fifth var:aureliani_office_fifth = root } remove_variable = aureliani_office_fifth } }
		}
		aureliani_senate_offices_update_view_effect = yes
	}
	on_fired_from_position = {
		house:house_aureliani = { if = { limit = { exists = var:aureliani_office_fifth var:aureliani_office_fifth = root } remove_variable = aureliani_office_fifth } }
		fired_from_council_position_effect = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	portrait_animation = grand_marshal
}

aureliani_minister_justice = {
	skill = learning
	name = aureliani_minister_justice
	tooltip = aureliani_minister_justice_desc
	auto_fill = no
	inherit = no
	can_fire = yes
	can_reassign = yes

	# Unavailable portfolios must not count as empty native council slots.
	valid_position = {
		aureliani_senate_visible_trigger = yes
		house:house_aureliani = { has_variable = aureliani_senate_stage var:aureliani_senate_stage ?= 2 has_variable = aureliani_senate_roman_portfolio var:aureliani_senate_roman_portfolio ?= 2 }
	}
	valid_character = {
		house:house_aureliani = { has_variable = aureliani_senate_stage var:aureliani_senate_stage ?= 2 has_variable = aureliani_senate_roman_portfolio var:aureliani_senate_roman_portfolio ?= 2 }
		aureliani_senate_office_native_candidate_trigger = { OFFICE_VAR = aureliani_office_fifth }
	}
	on_get_position = {
		aureliani_senate_office_charge_appointment_effect = { OFFICE_VAR = aureliani_office_fifth }
		house:house_aureliani = { set_variable = { name = aureliani_office_fifth value = root } }
		got_council_position_effect = yes
		start_default_task = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	on_lose_position = {
		if = {
			limit = {
				OR = {
					AND = { scope:councillor_liege = house:house_aureliani.house_head scope:councillor_liege = { is_alive = yes } }
					aureliani_senate_office_succession_holder_trigger = no
				}
			}
			house:house_aureliani = { if = { limit = { exists = var:aureliani_office_fifth var:aureliani_office_fifth = root } remove_variable = aureliani_office_fifth } }
		}
		aureliani_senate_offices_update_view_effect = yes
	}
	on_fired_from_position = {
		house:house_aureliani = { if = { limit = { exists = var:aureliani_office_fifth var:aureliani_office_fifth = root } remove_variable = aureliani_office_fifth } }
		fired_from_council_position_effect = yes
		aureliani_senate_offices_update_view_effect = yes
	}
	portrait_animation = page_flipping
}
