pokeritup/src/entities/room.py
Elia el Lazkani a492a0bb6a chore(): Expands the definitions of the entities
- Adds create methods to the room, person and cards
- Adds methods to add and remove person from room
2024-11-23 18:31:53 +01:00

40 lines
812 B
Python

import uuid
class Room:
"""
Room entity
"""
def __init__(self, name):
"""
Room entity initializer
"""
self.name = name
self.uuid = None
self.attendant = []
self.create()
def create(self):
"""
Method to create a new room object
"""
if not self.uuid:
self.uuid = uuid.uuid1()
return self
def add_person(self, person: uuid.UUID):
"""
Method to add a person to a room
"""
if person not in self.attendant:
self.attendant.append(person)
def remove_person(self, person: uuid.UUID):
"""
Method to remove a person from a room
"""
if person in self.attendant:
self.attendant.remove(person)