extends Node2D

@onready var game_time = get_node("/root/GameTimer")
@onready var player_vars = get_node("/root/PlayerVariables")
@onready var teacher_manager = get_node("/root/Main/ClassTeachers")
@onready var name_gen = get_node("/root/NameGenerator")
@onready var registers = get_node("/root/Registers")

var teacher_happiness : int
var teacher_academic_rating : int
var teacher_report_card : int
var teacher_gender : bool
var teacher_name : String
var teacher_first_name : String
var teacher_last_name : String
var teacher_in_game : int
var teacher_joined_this_season : bool
var teacher_id : int


func _ready():
	randomize()
	game_time.connect("heartbeat", Callable(self, "teacher_on_heartbeat"))
	game_time.connect("month_heartbeat", Callable(self, "teacher_on_month_heartbeat"))
	teacher_joined_this_season = true
	player_vars.teacher_baseid += 1
	teacher_gender = (randi() & 1)
	teacher_last_name = name_gen.last_name[randi() % name_gen.last_name.size()]
	if teacher_gender == true:
		teacher_first_name = name_gen.boy_first_name[randi() % name_gen.boy_first_name.size()]
	if teacher_gender == false:
		teacher_first_name = name_gen.girl_first_name[randi() % name_gen.girl_first_name.size()]
	teacher_id = player_vars.teacher_baseid
	teacher_name = teacher_first_name + " " + teacher_last_name
	registers.TeacherRegister.append(teacher_name)

func teacher_on_heartbeat():
	teacher_in_game += 1
	player_vars.salary_cost += (player_vars.cteacher_salary / 20)

	# StaffTracker stuff
	teacher_manager.sa_pool += 1
	teacher_manager.se_pool += 1
	teacher_manager.sw_pool += 1
	
	if teacher_in_game == 60:
		teacher_joined_this_season = false

func teacher_on_month_heartbeat():
	pass
