import socket

import pygame

from Classes.Game.Events.PlaceCard import CardPlaced
from Classes.System.Components.InputHandler import InputHandler
from Classes.Game.World import World
from Classes.Game.Events.GameStart import GameStart
from Classes.Game.Player import Player

class TCPEventHandler:
    def __init__(self, socket:socket):
        self.tcp_socket = socket

    def handleEvents(self, message, inputHandler:InputHandler, world:World):
        if message["event"] == "login":
            # todo: handle login response here
            pass
        elif message["event"] == "startgame":
            print("gamestart")
            GameStart(world, message["hand"], inputHandler, world.getPlayer())
            pass
        elif message["event"] == "PlaceCard":
            CardPlaced(world, message["card"], message["type"], message["owner"], pygame.Vector2(int(message["x"]), int(message["y"]), inputHandler))
            pass    
        elif message["event"] == "MoveCard":
            CardMoved(
                world, 
                message["card"], 
                message["type"], 
                message["owner"], 
                pygame.Vector2(int(message["old_x"]), int(message["old_y"])), 
                pygame.Vector2(int(message["new_x"]), int(message["new_y"])), 
                inputHandler)
            pass
        elif message["event"] == "RemoveCard":
            pass
        elif message["event"] == "AttackCard":
            pass
        elif message["event"] == "AttackPlayer":
            pass
        elif message["event"] == "ActivateEffectCard":
            pass
        elif message["event"] == "ActivateMonsterCard":
            pass