from typing import Any, Iterable, Iterator, List, Optional, Tuple, Union, Dict, overload
from .cell import Cell
from .range import Range
from .merge import MergeCells
from .column import Column
from .data_validation import DataValidations
from ._openxlsx import XLWorksheet, XLDrawing

class Worksheet:
    _sheet: XLWorksheet
    _cells: Dict[Tuple[int, int], Cell]
    def __init__(self, raw_sheet: XLWorksheet, workbook: Any = None) -> None: ...
    @property
    def title(self) -> str: ...
    @title.setter
    def title(self, value: str) -> None: ...
    @property
    def index(self) -> int: ...
    @index.setter
    def index(self, value: int) -> None: ...
    @property
    def sheet_state(self) -> str: ...
    @sheet_state.setter
    def sheet_state(self, value: str) -> None: ...
    @property
    def max_row(self) -> int: ...
    @property
    def max_column(self) -> int: ...
    @property
    def has_drawing(self) -> bool: ...
    @property
    def drawing(self) -> XLDrawing: ...
    @property
    def data_validations(self) -> DataValidations: ...
    def append(self, iterable: Iterable[Any]) -> None: ...
    async def append_async(self, iterable: Iterable[Any]) -> None: ...
    @property
    def rows(self) -> Iterator[Tuple[Cell, ...]]: ...
    def __getitem__(self, key: str) -> Cell: ...
    def cell(self, row: int, column: int, value: Optional[Any] = None) -> Cell: ...
    @overload
    def range(self, address: str) -> Range: ...
    @overload
    def range(self, start: str, end: str) -> Range: ...
    def merge_cells(self, range_string: str) -> None: ...
    async def merge_cells_async(self, range_string: str) -> None: ...
    def unmerge_cells(self, range_string: str) -> None: ...
    async def unmerge_cells_async(self, range_string: str) -> None: ...
    def set_column_format(self, column: Union[int, str], style_index: int) -> None: ...
    def set_row_format(self, row: int, style_index: int) -> None: ...
    @property
    def merges(self) -> MergeCells: ...
    def column(self, col: Union[int, str]) -> Column: ...
    def protect(
        self,
        password: Optional[str] = None,
        objects: bool = True,
        scenarios: bool = True,
        insert_columns: bool = False,
        insert_rows: bool = False,
        insert_hyperlinks: bool = False,
        delete_columns: bool = False,
        delete_rows: bool = False,
        select_locked_cells: bool = True,
        select_unlocked_cells: bool = True,
        auto_filter: bool = False,
        sort: bool = False,
        pivot_tables: bool = False,
        format_cells: bool = False,
        format_columns: bool = False,
        format_rows: bool = False,
    ) -> None: ...
    async def protect_async(
        self,
        password: Optional[str] = None,
        objects: bool = True,
        scenarios: bool = True,
        insert_columns: bool = False,
        insert_rows: bool = False,
        insert_hyperlinks: bool = False,
        delete_columns: bool = False,
        delete_rows: bool = False,
        select_locked_cells: bool = True,
        select_unlocked_cells: bool = True,
        auto_filter: bool = False,
        sort: bool = False,
        pivot_tables: bool = False,
        format_cells: bool = False,
        format_columns: bool = False,
        format_rows: bool = False,
    ) -> None: ...
    def unprotect(self) -> None: ...
    async def unprotect_async(self) -> None: ...
    @property
    def protection(self) -> Dict[str, Any]: ...
    def add_image(
        self,
        img_path: str,
        anchor: str = "A1",
        width: Optional[int] = None,
        height: Optional[int] = None,
    ) -> None: ...
    async def add_image_async(
        self,
        img_path: str,
        anchor: str = "A1",
        width: Optional[int] = None,
        height: Optional[int] = None,
    ) -> None: ...
    def add_hyperlink(self, cell_ref: str, url: str, tooltip: str = "") -> None: ...
    def add_internal_hyperlink(
        self, cell_ref: str, location: str, tooltip: str = ""
    ) -> None: ...
    def has_hyperlink(self, cell_ref: str) -> bool: ...
    def get_hyperlink(self, cell_ref: str) -> str: ...
    def remove_hyperlink(self, cell_ref: str) -> None: ...
    def freeze_panes(
        self, row_or_ref: Union[int, str], col: Optional[int] = None
    ) -> None: ...
    def split_panes(
        self,
        x_split: float,
        y_split: float,
        top_left_cell: str = "",
        active_pane: str = "bottomRight",
    ) -> None: ...
    def clear_panes(self) -> None: ...
    @property
    def has_panes(self) -> bool: ...
    @property
    def auto_filter(self) -> Optional[str]: ...
    @auto_filter.setter
    def auto_filter(self, value: Optional[str]) -> None: ...
    @property
    def zoom(self) -> int: ...
    @zoom.setter
    def zoom(self, value: int) -> None: ...
    def get_rows_data(self) -> List[List[Any]]: ...
    async def get_rows_data_async(self) -> List[List[Any]]: ...
    def get_row_values(self, row: int) -> List[Any]: ...
    async def get_row_values_async(self, row: int) -> List[Any]: ...
    def iter_row_values(self) -> Iterator[List[Any]]: ...
    def get_range_data(
        self, start_row: int, start_col: int, end_row: int, end_col: int
    ) -> List[List[Any]]: ...
    async def get_range_data_async(
        self, start_row: int, start_col: int, end_row: int, end_col: int
    ) -> List[List[Any]]: ...
    def get_cell_value(self, row: int, column: int) -> Any: ...
    async def get_cell_value_async(self, row: int, column: int) -> Any: ...
    def write_range(self, start_row: int, start_col: int, data: Any) -> None: ...
    async def write_range_async(
        self, start_row: int, start_col: int, data: Any
    ) -> None: ...
    def get_range_values(
        self, start_row: int, start_col: int, end_row: int, end_col: int
    ) -> Any: ...
    async def get_range_values_async(
        self, start_row: int, start_col: int, end_row: int, end_col: int
    ) -> Any: ...
    def set_cell_value(self, row: int, column: int, value: Any) -> None: ...
    async def set_cell_value_async(self, row: int, column: int, value: Any) -> None: ...
    def write_rows(
        self, start_row: int, data: Iterable[Iterable[Any]], start_col: int = 1
    ) -> None: ...
    async def write_rows_async(
        self, start_row: int, data: Iterable[Iterable[Any]], start_col: int = 1
    ) -> None: ...
    def write_row(
        self, row: int, values: Iterable[Any], start_col: int = 1
    ) -> None: ...
    async def write_row_async(
        self, row: int, values: Iterable[Any], start_col: int = 1
    ) -> None: ...
    def set_cells(self, cells: Iterable[Tuple[int, int, Any]]) -> None: ...
    async def set_cells_async(self, cells: Iterable[Tuple[int, int, Any]]) -> None: ...

    @property
    def table(self) -> Any: ...
    @property
    def tables(self) -> Any: ...
    @property
    def page_margins(self) -> Any: ...
    @property
    def print_options(self) -> Any: ...
    @property
    def page_setup(self) -> Any: ...
    def add_table(self, name: str, range_string: str) -> Any: ...
    def stream_writer(self) -> Any: ...
    def stream_reader(self) -> Any: ...
    def auto_fit_column(self, col: int) -> None: ...
    def apply_auto_filter(self) -> None: ...
    def set_print_area(self, sqref: str) -> None: ...
    def set_print_title_rows(self, start: int, end: int) -> None: ...
    def set_print_title_cols(self, start: int, end: int) -> None: ...
    def add_sparkline(self, location: str, data_range: str, type: Any = ...) -> None: ...
    def add_comment(self, cell_ref: str, text: str, author: str = ...) -> None: ...
    def add_conditional_formatting(self, sqref: str, rule: Any) -> None: ...
    def remove_conditional_formatting(self, sqref: str) -> None: ...
    def clear_all_conditional_formatting(self) -> None: ...
