from __future__ import annotations

from .. import config

from .Point import Point

import math
class Ball:
    
    def __init__(self) -> None:
        self.size: float
        self.position: Point
        self.angle: float
        self.speed: float
        
        self.reset()
    
    def reset(self) -> None:
        self.size = config.BALL_SIZE
        self.position = Point(config.BALL_SPAWN_POS_X + self.size / 2, config.BALL_SPAWN_POS_Y + self.size / 2)
        self.angle = math.pi * 0.3
        self.speed = config.BALL_SPEED_START
    
    def to_dict(self) -> dict:
        
        data: dict = {
            "size": self.size,
            "speed": self.speed,
            "position": self.position.to_dict(),
            "angle": self.angle,
        }
        
        return data
    
    def __str__(self) -> str:
        return f"Ball(size: {self.size}, speed: {self.speed}, angle: {self.angle}, position: {self.position})"