Question about OOD - Call Center (Python)

Context

Hi!
I am trying to study Object Oriented Design questions. I'm developing them in Python and I have a question about the implementation.

I am currently developing a solution for the problem "Design a Call Center":
"Imagine you have a call center with three levels of employees: respondent, manager, and director. An incoming telephone call must be first allocated to a respondent who is free. If the respondent can't handle the call, he or she must escalate the call to a manager. If the manager is not free or not able to handle it, then the call should be escalated to a director. Design the classes and data structures for this problem. Implement a method dispatchCall() which assigns a call to the first available employee".

To provide some context, I've designed different classes for this problem:

class Rank(Enum):
    Respondent = 0
    Manager = 1
    Director = 2

class Call:
    def assign_handler(self, employee):
        pass
    def disconnect(self):
        pass

class Employee(metaclass=ABCMeta):
    def assign_call(self, call: Call):
        pass
    def is_available(self):
        pass
    def finish_call(self):
        pass

""" Different employees """
class Respondent(Employee):
    self.rank = Rank.Respondent
class Manager(Employee):
    self.rank = Rank.Manager
class Director(Employee):
    self.rank = Rank.Director

""" The body of the program """
class CallHandler:
	self.employee_list = [...]
	self.call_queues = [...]
    def dispatch_call(self, call: Call):
        pass

Question

If I want to implement the code so that the employee is able to escalate a call and reassign it to another employee, what would be the best way to do it?

  1. Passing the CallHandler object to the employee as a variable so I can call a CallHandler method from the Employee:
class Employee(metaclass=ABCMeta):
	def __init__(self, call_handler):
		self.call_handler = call_handler
		
    def escalate_call(self):
        self.call_handler.reassign_call(self.current_call, new_rank)
  1. Doing all that logic (finish a call, reassign a call, escalate it...) directly in CallHandler (but, if I'm not wrong, employees cannot escalate the call themselves).
  2. Create CallHandler as a singleton class and call it from the Employee object (similar to the first proposed solution).

Is there a better solution? How would you implement it?

Comments (1)