from struct import pack

LOG					= 1
SET_SPEED			= 2
NEW_SIM_ADDED		= 3
SIM_REMOVED			= 4
SIM_OUTFIT_CHANGED	= 5

def serializeSimID(id):
	return id.to_bytes(length = 8,byteorder = "little")

class Log:
	def __init__(self,message):
		self.message = message
		
	def __bytes__(self):
		return (pack("<B",LOG)+self.message.encode("ascii"))

class SetSpeed:
	def __init__(self,speed):
		self.speed = int(speed)
		
	def __bytes__(self):
		return pack("<BB",SET_SPEED,self.speed)
	
#class SetCameraPosition:
	#def __init__(self,position):
	
class NewSimAdded:
	def __init__(self,id,name):
		self.id		= id
		self.name	= name
		
	def __bytes__(self):
		return (pack("<B",NEW_SIM_ADDED)+serializeSimID(self.id)+self.name.encode("utf-8"))
		
class SimRemoved:
	def __init__(self,id):
		self.id = id
		
	def __bytes__(self):
		return (pack("<B",SIM_REMOVED)+serializeSimID(self.id))
	
class SimOutfitChanged:
	def __init__(self,id):
		self.id = id
		
	def __bytes__(self):
		return (pack("<B",SIM_OUTFIT_CHANGED)+serializeSimID(self.id))
	
