"""
Provides functionality for handling Ballance TAS files loading, saving and editing.
"""


class TasFile:
    """
    Represents a TAS file containing a sequence of frames.
    
    This class provides methods for manipulating TAS files including adding, removing,
    modifying frames, and getting/setting key press states.
    Each frame contains key press information and delta time for Ballance gameplay.
    """
    def append(self, /, count: int, delta_time: float) -> None: ...
    def batchly_clear_key_pressed(self, /, index_from: int, index_to: int) -> None: ...
    def batchly_flip_key_pressed(self, /, index_from: int, index_to: int, key: TasKey) -> None: ...
    def batchly_set_delta_time(self, /, index_from: int, index_to: int, delta_time: float) -> None: ...
    def batchly_set_key_pressed(self, /, index_from: int, index_to: int, key: TasKey, pressed: bool) -> None: ...
    def clear(self, /) -> None: ...
    def clear_key_pressed(self, /, index: int) -> None: ...
    def flip_key_pressed(self, /, index: int, key: TasKey) -> None: ...
    def get_count(self, /) -> int: ...
    def get_delta_time(self, /, index: int) -> float: ...
    def insert(self, /, index: int, count: int, delta_time: float) -> None: ...
    def is_empty(self, /) -> bool: ...
    def is_key_pressed(self, /, index: int, key: TasKey) -> bool: ...
    def remove(self, /, index_from: int, index_to: int) -> None: ...
    def set_delta_time(self, /, index: int, delta_time: float) -> None: ...
    def set_key_pressed(self, /, index: int, key: TasKey, pressed: bool) -> None: ...

class TasKey:
    """
    Represents the different keys that can be pressed in a TAS frame.
    """
    KEY_UP: TasKey = ...
    """Up arrow key"""
    KEY_DOWN: TasKey = ...
    """Down arrow key"""
    KEY_LEFT: TasKey = ...
    """Left arrow key"""
    KEY_RIGHT: TasKey = ...
    """Right arrow key"""
    KEY_SHIFT: TasKey = ...
    """Shift key"""
    KEY_SPACE: TasKey = ...
    """Space key"""
    KEY_Q: TasKey = ...
    """Q key"""
    KEY_ESC: TasKey = ...
    """Escape key"""
    KEY_ENTER: TasKey = ...
    """Enter key"""
    def __eq__(self, /, other: TasKey | int) -> bool: ...
    def __ne__(self, /, other: TasKey | int) -> bool: ...

def create(count: int, delta_time: float) -> TasFile: ...
"""
Creates a new TAS file with a specified number of frames, all having the same delta time.

:param count: The number of frames to create in the new TAS file.
:type count: int
:param delta_time: The delta time value for all frames in the new TAS file.
:type delta_time: float
:returns: A new TasFile instance with the specified number of frames.
:rtype: TasFile
"""
def load(filename: str) -> TasFile: ...
"""
Loads a TAS file from disk.

:param filename: The path to the TAS file to load.
:type filename: str
:returns: A TasFile instance loaded from the specified file.
:rtype: TasFile
:raises RuntimeError: If the file cannot be loaded or is invalid.
"""
def save(file: TasFile, filename: str) -> None: ...
"""
Saves a TAS file to disk.

:param file: The TasFile instance to save.
:type file: TasFile
:param filename: The path where the TAS file should be saved.
:type filename: str
:returns: None
:rtype: None
:raises RuntimeError: If the file cannot be saved.
"""
