fate_of_georgia_category = {

	GEO_form_georgian_national_council = {

		icon = generic_nationalism

		available = {
			231 = { 
				owner = { 
					has_war_with = ROOT
					NOT = {
						original_tag = GEO
					}
				}
			}
			has_capitulated = no
		}

		cost = 75
		
		fire_only_once = yes
		
		days_remove = 30

		ai_will_do = {
			factor = 3
		}

		visible = {
			OR = {
				AND = {
					has_government = fascism
					NOT = {
						has_global_flag = georgian_national_council_fascist
					}
				}
				AND = {
					OR = {
						has_government = democratic
						has_government = neutrality
					}
					NOT = {
						has_global_flag = georgian_national_council_neutral_democratic
					}
				}				
			}
		}

		complete_effect = {
			
		}
		
		remove_effect = {
			if = {
				limit = {
					has_government = fascism
				}
				set_global_flag = georgian_national_council_fascist
				set_country_flag = georgian_national_council_fascist
			}
			if = {
				limit = {
					OR = {
						has_government = democratic
						has_government = neutrality
					}
				}
				set_global_flag = georgian_national_council_neutral_democratic
				set_country_flag = georgian_national_council_neutral_democratic
			}
		}		
	}
	GEO_establish_georgian_legion = {

		icon = generic_prepare_civil_war

		available = {
			231 = { 
				owner = { 
					has_war_with = ROOT
					surrender_progress > 0.15
				}
			}
			GEO = {
				exists = no
			}
			NOT = {
				has_global_flag = georgian_government
			}
			command_power > 24
			has_army_experience > 9
			has_political_power > 24
		}

		fire_only_once = yes
		
		custom_cost_text = GEO_establish_georgian_legion_cost
		custom_cost_trigger = {
			command_power > 24
			has_army_experience > 9
			has_political_power > 24			
		}
		
		days_remove = 90

		ai_will_do = {
			factor = 5
		}

		visible = {
			OR = {
				has_country_flag = georgian_national_council_neutral_democratic	
				has_country_flag = georgian_national_council_fascist		
			}
			
		}
		complete_effect = {
			army_experience = -10		
			add_political_power = -25
			add_command_power = -25
		}
		remove_effect = {
			division_template = {
				name = "Georgian Volunteers"				# georgian Volunteers
				is_locked = yes
				division_names_group = GEO_INF_01

				regiments = {
					infantry = { x = 0 y = 0 }
					infantry = { x = 0 y = 1 }
					infantry = { x = 0 y = 2 }
					infantry = { x = 1 y = 0 }
					infantry = { x = 1 y = 1 }
					infantry = { x = 1 y = 2 }
				}
				support = {
					recon = { x = 0 y = 0 }
					artillery = { x = 0 y = 1 }
				}	
			}				
			random_owned_controlled_state = {	
				create_unit = {
					division = "name = \"Georgian Legion\" division_template = \"Georgian Volunteers\" start_experience_factor = 1.0 start_equipment_factor = 0.01" 
					owner = ROOT
				}
			}
			set_country_flag = georgian_legion
							
		}
	}	
	GEO_establish_national_georgian_government = {

		icon = generic_independence

		available = {
			231 = { 
				owner = {
					has_war_with = ROOT
				}
			}
			231 = {
				owner = {
					AND = {
						OR = {
							original_tag = ROOT
							AND = { #can only form puppet inside faction territory if player, while controller isnt a player
								is_in_faction_with = ROOT
								is_ai = yes
								ROOT = {
									is_ai = no
								}
							}
						}
						has_full_control_of_state = 231
						NOT = {
							original_tag = TUR
						}
					}
				}
			}
			has_capitulated = no
		}

		cost = 100
		
		fire_only_once = yes
		
		days_remove = 15

		ai_will_do = {
			factor = 5
		}

		visible = {
			OR = {
				AND = {
					has_government = fascism
					has_global_flag = georgian_national_council_fascist
				}
				AND = {
					OR = {
						has_government = democratic
						has_government = neutrality
					}
					has_global_flag = georgian_national_council_neutral_democratic
				}				
			}
		}

		remove_effect = {
			ROOT = {
				set_country_flag = georgia_liberator
			}
			if = {
				limit = {
					has_government = fascism
					country_exists = GEO
				}
				hidden_effect = {
					GEO = {
						set_state_controller = 231
						set_state_owner = 231
					}
				}
				GEO = {
					start_civil_war = { ideology = fascism size = 1 }
				}
				random_country = {
					limit= {
						original_tag = GEO
						has_government = fascism
					}
					transfer_state = 231
					set_politics = {
						ruling_party = fascism
						elections_allowed = no
					}
					set_popularities = {
						democratic = 2
						fascism = 62
						communism = 30
						neutrality = 6
					}
				}
				ROOT = {
					puppet = GEO
				}
				
				set_global_flag = georgian_national_council_fascist
			}
			else_if = {
				limit = {
					has_government = fascism
				}
				hidden_effect = {
					GEO = {
						transfer_state = 231
						set_politics = {
							ruling_party = fascism
							elections_allowed = no
						}
						set_popularities = {
							democratic = 2
							fascism = 62
							communism = 30
							neutrality = 6
						}
					}
				}
				
				ROOT = {
					puppet = GEO
				}
				set_global_flag = georgian_national_council_fascist
			}			
			else_if = {
				limit = {
					has_government = neutrality
					country_exists = GEO
				}
				hidden_effect = {
					GEO = {
						set_state_controller = 231
						set_state_owner = 231
					}
				}
				GEO = {
					start_civil_war = { ideology = neutrality size = 1 }
				}
				random_country = {
					limit= {
						original_tag = GEO
						has_government = neutrality
					}
					set_state_controller = 231
					set_politics = {
						ruling_party = neutrality
						elections_allowed = no
					}
					set_popularities = {
						democratic = 12
						fascism = 3
						communism = 25
						neutrality = 60
					}
					ROOT = {give_guarantee = GEO}
				}
				set_global_flag = georgian_national_council_neutral
			}
			else_if = {
				limit = {
					has_government = neutrality
				}
				hidden_effect = {
					GEO = {
						transfer_state = 231
						set_politics = {
							ruling_party = neutrality
							elections_allowed = no				
						}
						set_popularities = {
							democratic = 12
							fascism = 3
							communism = 25
							neutrality = 60
						}
					}
					ROOT = {give_guarantee = GEO}
					set_global_flag = georgian_national_council_neutral
				}
			}
			#there may be a mistake here to test
			else_if = {
				limit = {
					has_government = democratic
					country_exists = GEO
				}
				hidden_effect = {
					GEO = {
						set_state_controller = 231
						set_state_owner = 231
						set_politics = {
							ruling_party = democratic
							elections_allowed = no
						}
						set_popularities = {
							democratic = 65
							fascism = 1
							communism = 34
						}
					}
				}
				GEO = {
					start_civil_war = { ideology = democratic size = 1 }
					ROOT = {give_guarantee = GEO}
				}
				
				set_global_flag = georgian_national_council_democratic
			}
			else_if = {
				limit = {
					has_government = democratic
				}
				hidden_effect = {
					GEO = {
						set_state_controller = 231
						set_state_owner = 231
					}
				}
				ROOT = {give_guarantee = GEO}
				
				set_global_flag = georgian_national_council_democratic
			}
			GEO = {
				add_opinion_modifier = { target = ROOT modifier = ARM_liberators } #FIX LATER?
			}	
		}
	}	
}