# type: ignore[list-item]
from typing import List, Optional
from polars import DataFrame
from enum import Enum  # <-- Важно импортировать Enum

# --- НОВЫЕ КЛАССЫ, ВИДИМЫЕ В PYTHON ---

class HorizAlignment(Enum):
    """Горизонтальное выравнивание."""
    Left: "HorizAlignment"
    Center: "HorizAlignment"
    Right: "HorizAlignment"
    Fill: "HorizAlignment"
    Justify: "HorizAlignment"

class VertAlignment(Enum):
    """Вертикальное выравнивание."""
    Top: "VertAlignment"
    Center: "VertAlignment"
    Bottom: "VertAlignment"
    Justify: "VertAlignment"

class AlignSpec:
    """Спецификация выравнивания для ячейки."""
    def __init__(
        self,
        horiz: Optional[HorizAlignment] = None,
        vert: Optional[VertAlignment] = None,
        wrap: bool = False,
    ) -> None: ...

# --- СУЩЕСТВУЮЩИЕ И ОБНОВЛЕННЫЕ КЛАССЫ ---

def scan_excel(path: str) -> List[str]: ...

class Editor:
    def __init__(self, path: str, sheet_name: str) -> None: ...
    def append_row(self, cells: List[str]) -> None: ...
    def append_table_at(self, cells: List[List[str]], start_cell: str) -> None: ...
    def save(self, path: str) -> None: ...
    def last_row_index(self, col_name: str) -> int: ...
    def last_rows_index(self, col_name: str) -> List[int]: ...
    def with_polars(self, df: DataFrame, start_cell: Optional[str] = None) -> None: ...
    def add_worksheet(self, sheet_name: str) -> "Editor": ...
    def add_worksheet_at(self, sheet_name: str, index: int) -> "Editor": ...
    def with_worksheet(self, sheet_name: str) -> "Editor": ...
    def delete_worksheet(self, sheet_name: str) -> "Editor": ...
    def rename_worksheet(self, old_name: str, new_name: str) -> "Editor": ...
    def set_number_format(self, range: str, fmt: str) -> "Editor": ...
    def set_fill(self, range: str, fmt: str) -> "Editor": ...
    def merge_cells(self, range: str) -> "Editor": ...
    def set_border(self, range: str, style: str) -> "Editor": ...
    
    # --- ОБНОВЛЕННЫЙ МЕТОД ---
    def set_font(
        self, 
        range: str, 
        name: str, 
        size: float, 
        bold: bool = False, 
        italic: bool = False, 
        align: Optional[AlignSpec] = None  # <-- Добавлен опциональный аргумент
    ) -> "Editor": ...
    
    # --- НОВЫЙ МЕТОД ---
    def set_alignment(self, range: str, spec: AlignSpec) -> "Editor": ...

    def set_cell(self, coords: str, cell: str) -> None: ...
    def set_column_width(self, col_letter: str, width: float) -> "Editor": ...
    def set_columns_width(self, col_letters: List[str], width: float) -> "Editor": ...
    def remove_style(self, range: str) -> "Editor": ...

class Scanner:
    def __init__(self, path: str) -> None: ...
    def get_sheets(self) -> List[str]: ...
    def open_editor(self, sheet_name: str) -> Editor: ...