from dataclasses import dataclass

from kiutils.items.common import Justify as Justify
from kiutils.misc.config import KIUTILS_CREATE_NEW_GENERATOR_STR as KIUTILS_CREATE_NEW_GENERATOR_STR
from kiutils.misc.config import KIUTILS_CREATE_NEW_VERSION_STR as KIUTILS_CREATE_NEW_VERSION_STR
from kiutils.utils import sexpr as sexpr
from kiutils.utils.strings import dequote as dequote

@dataclass
class WksFontSize:
    width: float = ...
    height: float = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> WksFontSize: ...
    def to_sexpr(self, indent: int = 0, newline: bool = False): ...

@dataclass
class WksFont:
    linewidth: float | None = ...
    size: WksFontSize | None = ...
    bold: bool = ...
    italic: bool = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> WksFont: ...
    def to_sexpr(self, indent: int = 0, newline: bool = False): ...

@dataclass
class WksPosition:
    X: float = ...
    Y: float = ...
    corner: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> WksPosition: ...
    def to_sexpr(self) -> str: ...

@dataclass
class Line:
    name: str = ...
    start: WksPosition = ...
    end: WksPosition = ...
    option: str | None = ...
    lineWidth: float | None = ...
    repeat: int | None = ...
    incrx: float | None = ...
    incry: float | None = ...
    comment: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Line: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True): ...

@dataclass
class Rect:
    name: str = ...
    start: WksPosition = ...
    end: WksPosition = ...
    option: str | None = ...
    lineWidth: float | None = ...
    repeat: int | None = ...
    incrx: float | None = ...
    incry: float | None = ...
    comment: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Rect: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True): ...

@dataclass
class Polygon:
    name: str = ...
    position: WksPosition = ...
    option: str | None = ...
    rotate: float | None = ...
    coordinates: list[WksPosition] = ...
    repeat: int | None = ...
    incrx: float | None = ...
    incry: float | None = ...
    comment: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Polygon: ...
    def to_sexpr(self, indent: int = 0, newline: bool = False) -> None: ...

@dataclass
class Bitmap:
    name: str = ...
    position: WksPosition = ...
    option: str | None = ...
    scale: float = ...
    repeat: int | None = ...
    incrx: float | None = ...
    incry: float | None = ...
    comment: str | None = ...
    pngdata: list[str] = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Bitmap: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True): ...

@dataclass
class TbText:
    text: str = ...
    name: str = ...
    position: WksPosition = ...
    option: str | None = ...
    rotate: float | None = ...
    font: WksFont = ...
    justify: Justify | None = ...
    maxlen: float | None = ...
    maxheight: float | None = ...
    repeat: int | None = ...
    incrx: float | None = ...
    incry: float | None = ...
    incrlabel: int | None = ...
    comment: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> TbText: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True): ...

@dataclass
class TextSize:
    width: float = ...
    height: float = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> TextSize: ...
    def to_sexpr(self, indent: int = 0, newline: bool = False): ...

@dataclass
class Setup:
    textSize: TextSize = ...
    lineWidth: float = ...
    textLineWidth: float = ...
    leftMargin: float = ...
    rightMargin: float = ...
    topMargin: float = ...
    bottomMargin: float = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Setup: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True): ...

@dataclass
class WorkSheet:
    version: str = ...
    generator: str = ...
    setup: Setup = ...
    drawingObjects: list = ...
    filePath: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> WorkSheet: ...
    @classmethod
    def from_file(cls, filepath: str, encoding: str | None = None) -> WorkSheet: ...
    @classmethod
    def create_new(cls) -> WorkSheet: ...
    def to_file(self, filepath=None) -> None: ...
    def to_sexpr(self, indent: int = 0, newline: bool = True): ...
