"""
This type stub file was generated by pyright.
"""

from collections.abc import Callable
from enum import IntEnum
from functools import cached_property
from typing import Protocol, TYPE_CHECKING, runtime_checkable
from graph_sitter.codebase.diff_lite import DiffLite
from graph_sitter.core.file import File

if TYPE_CHECKING:
    ...
class TransactionPriority(IntEnum):
    Remove = ...
    Edit = ...
    Insert = ...
    FileAdd = ...
    FileRename = ...
    FileRemove = ...


@runtime_checkable
class ContentFunc(Protocol):
    """A function executed to generate a content block dynamically."""
    def __call__(self) -> str:
        ...
    


class Transaction:
    start_byte: int
    end_byte: int
    file_path: str
    priority: int | tuple
    transaction_order: TransactionPriority
    transaction_counter: int = ...
    def __init__(self, start_byte: int, end_byte: int, file_path: str, priority: int | tuple = ..., new_content: str | None | Callable[[], str] = ...) -> None:
        ...
    
    def __repr__(self) -> str:
        ...
    
    def __hash__(self) -> int:
        ...
    
    def __eq__(self, other) -> bool:
        ...
    
    @property
    def length(self): # -> int:
        ...
    
    def execute(self):
        ...
    
    def get_diff(self) -> DiffLite:
        """Gets the diff produced by this transaction"""
        ...
    
    def diff_str(self):
        """Human-readable string representation of the change"""
        ...
    
    @cached_property
    def new_content(self) -> str | None:
        ...
    


class RemoveTransaction(Transaction):
    transaction_order = ...
    exec_func: Callable[[], None] | None = ...
    def __init__(self, start_byte: int, end_byte: int, file_path: str, file: File, priority: int = ..., exec_func: Callable[[], None] | None = ...) -> None:
        ...
    
    def execute(self) -> None:
        """Removes the content between start_byte and end_byte"""
        ...
    
    def get_diff(self) -> DiffLite:
        """Gets the diff produced by this transaction"""
        ...
    
    def diff_str(self) -> str:
        """Human-readable string representation of the change"""
        ...
    


class InsertTransaction(Transaction):
    transaction_order = ...
    exec_func: Callable[[], None] | None = ...
    def __init__(self, insert_byte: int, file_path: str, file: File, new_content: str | Callable[[], str], *, priority: int | tuple = ..., exec_func: Callable[[], None] | None = ...) -> None:
        ...
    
    def execute(self) -> None:
        """Inserts new_src at the specified byte_index"""
        ...
    
    def get_diff(self) -> DiffLite:
        """Gets the diff produced by this transaction"""
        ...
    
    def diff_str(self) -> str:
        """Human-readable string representation of the change"""
        ...
    


class EditTransaction(Transaction):
    transaction_order = ...
    new_content: str
    def __init__(self, start_byte: int, end_byte: int, file_path: str, file: File, new_content: str, priority: int = ...) -> None:
        ...
    
    def execute(self) -> None:
        """Edits the entirety of this node's source to new_src"""
        ...
    
    def get_diff(self) -> DiffLite:
        """Gets the diff produced by this transaction"""
        ...
    
    def diff_str(self) -> str:
        """Human-readable string representation of the change"""
        ...
    
    def break_down(self) -> list[InsertTransaction] | None:
        ...
    


class FileAddTransaction(Transaction):
    transaction_order = ...
    def __init__(self, file_path: str, priority: int = ...) -> None:
        ...
    
    def execute(self) -> None:
        """Adds a new file"""
        ...
    
    def get_diff(self) -> DiffLite:
        """Gets the diff produced by this transaction"""
        ...
    
    def diff_str(self) -> str:
        """Human-readable string representation of the change"""
        ...
    


class FileRenameTransaction(Transaction):
    transaction_order = ...
    def __init__(self, file: File, file_path: str, new_file_path: str, priority: int = ...) -> None:
        ...
    
    def execute(self) -> None:
        """Renames the file"""
        ...
    
    def get_diff(self) -> DiffLite:
        """Gets the diff produced by this transaction"""
        ...
    
    def diff_str(self) -> str:
        """Human-readable string representation of the change"""
        ...
    


class FileRemoveTransaction(Transaction):
    transaction_order = ...
    def __init__(self, file_path: str, file: File, priority: int = ...) -> None:
        ...
    
    def execute(self) -> None:
        """Removes the file"""
        ...
    
    def get_diff(self) -> DiffLite:
        """Gets the diff produced by this transaction"""
        ...
    
    def diff_str(self) -> str:
        """Human-readable string representation of the change"""
        ...
    


