on_actions = {
	on_capitulation = {
	
		effect = {
		#Победа России - фины
			if = {
				limit = {
					ROOT = {
						OR = {
							original_tag = FIN
						}
					}
					FROM = {
						OR = {
							original_tag = SBI
						}
					}
				}
				ROOT = {
					white_peace = FROM
					leave_faction = yes
				}
				
				every_state = {
					limit = {
						OR = {
							state = 213
							state = 215
							state = 722
							state = 147
							state = 146
							state = 216
						}
					}

					SBI = {
						transfer_state = PREV
						add_state_core = PREV
					}
				}
			}
			
		#Победа Германии
		
			if = {
				limit = {
					ROOT = {
						OR = {
							original_tag = SBI
						}
					}
					FROM = {
						OR = {
							original_tag = GER
						}
					}
				}
				FROM = {
					white_peace = ROOT
				}
				
				if = {
					limit = {
						country_exists = FIN
					}
					every_state = {
						limit = {
							OR = {
								state = 213
								state = 215
								state = 722
								state = 147
								state = 146
								state = 216
							}
						}

						FIN = {
							transfer_state = PREV
							add_state_core = PREV
						}
					}
				}
				
					
				SBI = {
					country_event = SBI.10100
				}
			}
			
		#Победа России - Германия
			
			if = {
				limit = {
					ROOT = {
						OR = {
							original_tag = GER
						}
					}
					FROM = {
						OR = {
							original_tag = SBI
						}
					}
				}
				FROM = {
					white_peace = ROOT
				}
				
				every_state = {
					limit = {
						is_core_of = SOV
						owner = {
							OR = {
								tag = GER
								tag = QZQ
								is_subject_of = GER
							}
						}
					}
					SBI = {
						transfer_state = PREV
						add_state_core = PREV
					}
				}
				
				if = {
					limit = {
						country_exists = FIN
					}
					every_state = {
						limit = {
							OR = {
								state = 213
								state = 215
								state = 722
								state = 147
								state = 146
								state = 216
							}
						}

						SBI = {
							transfer_state = PREV
							add_state_core = PREV
						}
					}
				}
				
				every_state = {
					limit = {
						owner = {
							OR = {
								tag = GER
								tag = POL
								is_ally_with = GER
							}
						}
						OR = {
							state = 94
							state = 93
							state = 91
							state = 89
							state = 80
							state = 78
							state = 766
							state = 192
							state = 834
							state = 95
							state = 784
							state = 96
							state = 814
							state = 763
							state = 188
							state = 189
							state = 190
							state = 809
							state = 815
							state = 808
							state = 11
							state = 12
							state = 810
							state = 13
							state = 811
							state = 812
							state = 813
							state = 191
						}
					}

					SBI = {
						transfer_state = PREV
					}
				}
				
				every_country = {
					limit = {
						has_war_with = SBI
					}
					
					diplomatic_relation = {
						country = SBI
						relation = non_aggression_pact
						active = yes
					}
					
					white_peace = SBI
				}
				
				SBI = {
					if = {
						limit = {
							has_country_flag = SBI_KANARIS_STAGE_3
						}
						set_country_flag = SBI_KANARIS_STAGE_4
						load_focus_tree = SBI_Kanaris_tree_4
					}
					else = {
						set_country_flag = SBI_Regime_Stage_FINAL
						load_focus_tree = SBI_Pasternak_tree_5
					}
					
					mark_focus_tree_layout_dirty = yes
					diplomatic_relation = {
						country = GER
						relation = puppet
						active = yes 
					}
					country_event = SBI.4204
					
				}
				every_state = {
					limit = {
						OR = {
							state = 66
							state = 67
							state = 68
							state = 88
							state = 86
							state = 87
							state = 98
							state = 97
							state = 762
							state = 85
							state = 807
							state = 90
							state = 92
							state = 10
							state = 63
							state = 5
						}
					}

					POL = {
						transfer_state = PREV
					}
				}
				every_country = {
					limit = { has_country_flag = sbi_will_declare_war }
					release = CZE
					release = AUS
					release = HUN
					release = ROM
					release = YUG
					release = BUL
					release = ENG
					release = FRA
					release = BEL
					release = HOL
					release = LUX
					release = DEN
					release = NOR
					release = SWE
					release = TUR
					release = AUS
					release = IRE
					release = USA
					release = PER
					release = CAN
					release = SWI
					SBI = {
						diplomatic_relation = {
							country = PREV
							relation = puppet
							active = yes 
						}
					}
				}
				SBI = {
					diplomatic_relation = {
						country = POL
						relation = puppet
						active = yes 
					}
				}
				SBI = {
					diplomatic_relation = {
						country = CZE
						relation = puppet
						active = yes 
					}
					if = {
						limit = { has_country_flag = WRS_SBI_UNIFIED_PEACE }
						news_event = SBI_NEWS.11
					}
					else_if = {
						limit = { has_cosmetic_tag = SBI_POKRYSHKIN_RUSSIA }
						news_event = SBI_NEWS.12
					}
					else_if = {
						limit = { has_cosmetic_tag = SBI_PASTERNAK_RUSSIA }
						news_event = SBI_NEWS.13
					}
					else_if = {
						limit = { has_country_flag = SBI_Harms_Regime_Stage_2 }
						news_event = SBI_NEWS.14
					}
					else_if = {
						limit = { has_country_flag = SBI_KANARIS_STAGE_3 }
						news_event = SBI_NEWS.19
					}
				}
			}
		}
	}
}
