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

from tree_sitter import Node as TSNode
from graph_sitter.codebase.codebase_graph import CodebaseGraph
from graph_sitter.core.autocommit import reader, writer
from graph_sitter.core.class_definition import Class
from graph_sitter.core.node_id_factory import NodeId
from graph_sitter.core.statements.symbol_statement import SymbolStatement
from graph_sitter.typescript.detached_symbols.decorator import TSDecorator
from graph_sitter.typescript.detached_symbols.parameter import TSParameter
from graph_sitter.typescript.expressions.type import TSType
from graph_sitter.typescript.function import TSFunction
from graph_sitter.typescript.interfaces.has_block import TSHasBlock
from graph_sitter.typescript.symbol import TSSymbol
from graph_sitter.writer_decorators import ts_apidoc

@ts_apidoc
class TSClass(Class[TSFunction, TSDecorator, "TSCodeBlock", TSParameter, TSType], TSHasBlock, TSSymbol):
    """A class representing a TypeScript/JavaScript class with enhanced functionality for class manipulation.

    The TSClass provides comprehensive functionality for working with TypeScript/JavaScript classes,
    including handling class methods, attributes, JSX components, and inheritance relationships.
    It supports operations like adding source code to class bodies, managing class attributes,
    and handling React JSX components.

    Attributes:
        parent_classes (Parents | None): The parent classes that this class extends or implements.
        constructor_keyword (str): The keyword used to identify the constructor method.
    """
    constructor_keyword = ...
    def __init__(self, ts_node: TSNode, file_id: NodeId, G: CodebaseGraph, parent: SymbolStatement) -> None:
        ...
    
    @property
    @reader
    def is_jsx(self) -> bool:
        """Determine if the class is a React JSX component.

        Check if any parent class contains 'React' in its name or source.

        Returns:
            bool: True if the class inherits from a React component, False otherwise.
        """
        ...
    
    @writer
    def add_source(self, source: str) -> None:
        """Adds source code to a class body.

        Adds a block of source code to the class body. The code will be added at the end of the existing code block,
        maintaining proper indentation based on the class's structure.

        Args:
            source (str): The source code to be added to the class body.

        Returns:
            None
        """
        ...
    
    @writer
    def add_attribute_from_source(self, source: str) -> None:
        """Adds a class attribute from source code to a TypeScript/JavaScript class.

        Adds the attribute to the class in a suitable location based on the class's current structure:
        after existing attributes if any exist, before methods if any exist, or in an empty class block.

        Args:
            source (str): The source code of the attribute to add to the class.

        Returns:
            None
        """
        ...
    
    def convert_props_to_interface(self) -> None:
        """Converts React component props to TypeScript interfaces.

        For React class components, converts PropTypes declarations to a separate interface.
        The interface will be named {ComponentName}Props and inserted before the component.
        The component will be updated to extend React.Component with the interface type parameter.

        Handles both simple types and complex types including:
        - PropTypes declarations
        - Union types and optional props
        - Nested object shapes
        - Arrays and complex types
        - Required vs optional props

        Example:
            ```typescript
            // Before
            class Button extends React.Component {
                render() {
                    return <button onClick={this.props.onClick}>{this.props.text}</button>;
                }
            }
            Button.propTypes = {
                text: PropTypes.string.isRequired,
                onClick: PropTypes.func.isRequired
            };

            // After
            interface ButtonProps {
                text: string;
                onClick: CallableFunction;
            }

            class Button extends React.Component<ButtonProps> {
                render() {
                    return <button onClick={this.props.onClick}>{this.props.text}</button>;
                }
            }
            ```
        """
        ...
    
    @writer
    def class_component_to_function_component(self) -> None:
        """Converts a class component to a function component."""
        ...
    


