from typing import Any, List, Union

from dev.coatl.helper.types import AnyStr as AnyStr
from java.lang import Object
from org.apache.poi.common import Duplicatable
from org.apache.poi.ss.formula import (
    ExternSheetReferenceToken,
    WorkbookDependentFormula,
)
from org.apache.poi.util import LittleEndianInput, LittleEndianOutput

class AreaI:
    class OffsetArea:
        def __init__(
            self,
            baseRow: int,
            baseColumn: int,
            relFirstRow: int,
            relLastRowIx: int,
            relFirstColIx: int,
            relLastColIx: int,
        ) -> None: ...
        def getFirstRow(self) -> int: ...
        def getFirstColumn(self) -> int: ...
        def getLastRow(self) -> int: ...
        def getLastColumn(self) -> int: ...

    def getFirstColumn(self) -> int: ...
    def getFirstRow(self) -> int: ...
    def getLastColumn(self) -> int: ...
    def getLastRow(self) -> int: ...

class Pxg:
    def getExternalWorkbookNumber(self) -> int: ...
    def getSheetName(self) -> AnyStr: ...
    def setSheetName(self, name: AnyStr) -> None: ...
    def toFormulaString(self) -> AnyStr: ...

class Pxg3D(Pxg):
    def getExternalWorkbookNumber(self) -> int: ...
    def getLastSheetName(self) -> AnyStr: ...
    def getSheetName(self) -> AnyStr: ...
    def setLastSheetName(self, name: AnyStr) -> None: ...
    def setSheetName(self, name: AnyStr) -> None: ...
    def toFormulaString(self) -> AnyStr: ...

class Ptg(Object, Duplicatable):
    CLASS_ARRAY: int
    CLASS_REF: int
    CLASS_VALUE: int
    EMPTY_PTG_ARRAY: List[Ptg]
    def copy(self) -> Duplicatable: ...
    @staticmethod
    def createPtg(in_: LittleEndianInput) -> Ptg: ...
    @staticmethod
    def doesFormulaReferToDeletedCell(ptgs: List[Ptg]) -> bool: ...
    def getDefaultOperandClass(self) -> int: ...
    @staticmethod
    def getEncodedSize(ptgs: List[Ptg]) -> int: ...
    @staticmethod
    def getEncodedSizeWithoutArrayData(ptgs: List[Ptg]) -> int: ...
    def getPtgClass(self) -> int: ...
    def getRVAType(self) -> AnyStr: ...
    def getSize(self) -> int: ...
    def isBaseToken(self) -> bool: ...
    @staticmethod
    def readTokens(size: int, in_: LittleEndianInput) -> List[Ptg]: ...
    @staticmethod
    def serializePtgs(ptgs: List[Ptg], array: bytearray, offset: int) -> int: ...
    def setClass(self, thePtgClass: int) -> None: ...
    def toFormulaString(self) -> AnyStr: ...
    def write(self, out: LittleEndianOutput) -> None: ...

class OperandPtg(Ptg): ...

class NamePtg(OperandPtg):
    sid: int
    def __init__(self, arg: Union[int, LittleEndianInput, NamePtg]) -> None: ...
    def getIndex(self) -> int: ...

class AreaPtgBase(OperandPtg, AreaI):
    sid: int
    def __init__(self, *args: Any) -> None: ...
    def getFirstColumn(self) -> int: ...
    def getFirstColumnRaw(self) -> int: ...
    def getFirstRow(self) -> int: ...
    def getLastColumn(self) -> int: ...
    def getLastColumnRaw(self) -> int: ...
    def getLastRow(self) -> int: ...
    def isFirstColRelative(self) -> bool: ...
    def isFirstRowRelative(self) -> bool: ...
    def isLastColRelative(self) -> bool: ...
    def isLastRowRelative(self) -> bool: ...
    def setFirstColRelative(self, rel: bool) -> None: ...
    def setFirstColumnRaw(self, colIx: int) -> None: ...
    def setFirstRowRelative(self, rel: bool) -> None: ...
    def setLastColRelative(self, rel: bool) -> None: ...
    def setLastColumn(self, colIx: int) -> None: ...
    def setLastColumnRaw(self, column: int) -> None: ...
    def setLastRow(self, rowIx: int) -> None: ...
    def setLastRowRelative(self, rel: bool) -> None: ...
    def sortTopLeftToBottomRight(self) -> None: ...

class Area3DPtg(AreaPtgBase, WorkbookDependentFormula, ExternSheetReferenceToken):
    def __init__(self, *args: Any) -> None: ...
    def format2DRefAsString(self) -> AnyStr: ...
    def getExternSheetIndex(self) -> int: ...
    def setExternSheetIndex(self, index: int) -> None: ...

class Area3DPxg(AreaPtgBase, Pxg3D):
    def __init__(self, *args: Any) -> None: ...
    def format2DRefAsString(self) -> AnyStr: ...
    def getExternalWorkbookNumber(self) -> int: ...
    def getLastSheetName(self) -> AnyStr: ...
    def getSheetName(self) -> AnyStr: ...
    def setLastSheetName(self, name: AnyStr) -> None: ...
    def setSheetName(self, name: AnyStr) -> None: ...

class NameXPtg(OperandPtg):
    sid: int
    def __init__(self, *args: Any) -> None: ...
    def getNameIndex(self) -> int: ...
    def getSheetRefIndex(self) -> int: ...

class NameXPxg(OperandPtg):
    def __init__(self, *args: Any) -> None: ...
    def getExternalWorkbookNumber(self) -> int: ...
    def getNameName(self) -> AnyStr: ...
    def getSheetName(self) -> AnyStr: ...
    def setSheetName(self, sheetName: AnyStr) -> None: ...

class RefPtgBase(OperandPtg):
    def getColumn(self) -> int: ...
    def getRow(self) -> int: ...
    def isColRelative(self) -> bool: ...
    def isRowRelative(self) -> bool: ...
    def setColRelative(self, rel: bool) -> None: ...
    def setColumn(self, colIx: int) -> None: ...
    def setRow(self, rowIx: int) -> None: ...
    def setRowRelative(self, rel: bool) -> None: ...

class Ref3DPtg(RefPtgBase, WorkbookDependentFormula, ExternSheetReferenceToken):
    def __init__(self, *args: Any) -> None: ...
    def format2DRefAsString(self) -> AnyStr: ...
    def getExternSheetIndex(self) -> int: ...
    def setExternSheetIndex(self, index: int) -> None: ...

class Ref3DPxg(RefPtgBase, Pxg3D):
    def __init__(self, *args: Any) -> None: ...
    def format2DRefAsString(self) -> AnyStr: ...
    def getExternalWorkbookNumber(self) -> int: ...
    def getLastSheetName(self) -> AnyStr: ...
    def getSheetName(self) -> AnyStr: ...
    def setLastSheetName(self, name: AnyStr) -> None: ...
    def setSheetName(self, name: AnyStr) -> None: ...
