from dataclasses import dataclass

from kiutils.items.common import Position as Position
from kiutils.utils.strings import dequote as dequote

@dataclass
class GeneralSettings:
    thickness: float = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> GeneralSettings: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True) -> str: ...

@dataclass
class LayerToken:
    ordinal: int = ...
    name: str = ...
    type: str = ...
    userName: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> LayerToken: ...
    def to_sexpr(self, indent: int = 4, newline: bool = True) -> str: ...

@dataclass
class StackupSubLayer:
    thickness: float = ...
    material: str | None = ...
    epsilonR: float | None = ...
    lossTangent: float | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> StackupSubLayer: ...
    def to_sexpr(self, indent: int = 0, newline: bool = False) -> str: ...

@dataclass
class StackupLayer:
    name: str = ...
    type: str = ...
    color: str | None = ...
    thickness: float | None = ...
    material: str | None = ...
    epsilonR: float | None = ...
    lossTangent: float | None = ...
    subLayers: list[StackupSubLayer] = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> StackupLayer: ...
    def to_sexpr(self, indent: int = 6, newline: bool = True) -> str: ...

@dataclass
class Stackup:
    layers: list[StackupLayer] = ...
    copperFinish: str | None = ...
    dielectricContraints: str | None = ...
    edgeConnector: str | None = ...
    castellatedPads: bool = ...
    edgePlating: bool = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Stackup: ...
    def to_sexpr(self, indent: int = 4, newline: bool = True) -> str: ...

@dataclass
class PlotSettings:
    layerSelection: str = ...
    plotOnAllLayersSelection: str | None = ...
    disableApertMacros: bool = ...
    useGerberExtensions: bool = ...
    useGerberAttributes: bool = ...
    useGerberAdvancedAttributes: bool = ...
    createGerberJobFile: bool = ...
    dashedLineDashRatio: float | None = ...
    dashedLineGapRatio: float | None = ...
    svgUseInch: bool | None = ...
    svgPrecision: float = ...
    excludeEdgeLayer: bool | None = ...
    plotFameRef: bool = ...
    viasOnMask: bool = ...
    mode: int = ...
    useAuxOrigin: bool = ...
    hpglPenNumber: int = ...
    hpglPenSpeed: int = ...
    hpglPenDiameter: float = ...
    dxfPolygonMode: bool = ...
    dxfImperialUnits: bool = ...
    dxfUsePcbnewFont: bool = ...
    psNegative: bool = ...
    psA4Output: bool = ...
    plotReference: bool = ...
    plotValue: bool = ...
    plotInvisibleText: bool = ...
    sketchPadsOnFab: bool = ...
    subtractMaskFromSilk: bool = ...
    outputFormat: int = ...
    mirror: bool = ...
    drillShape: int = ...
    scaleSelection: int = ...
    outputDirectory: str = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> PlotSettings: ...
    def to_sexpr(self, indent: int = 4, newline: bool = True) -> str: ...

@dataclass
class SetupData:
    stackup: Stackup | None = ...
    packToMaskClearance: float = ...
    solderMaskMinWidth: float | None = ...
    padToPasteClearance: float | None = ...
    padToPasteClearanceRatio: float | None = ...
    auxAxisOrigin: Position | None = ...
    gridOrigin: Position | None = ...
    plotSettings: PlotSettings | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> SetupData: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True) -> str: ...

@dataclass
class Segment:
    start: Position = ...
    end: Position = ...
    width: float = ...
    layer: str = ...
    locked: bool = ...
    net: int = ...
    tstamp: str = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Segment: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True) -> str: ...

@dataclass
class Via:
    type: str | None = ...
    locked: bool = ...
    position: Position = ...
    size: float = ...
    drill: float = ...
    layers: list[str] = ...
    removeUnusedLayers: bool = ...
    keepEndLayers: bool = ...
    free: bool = ...
    net: int = ...
    tstamp: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Via: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True) -> str: ...

@dataclass
class Arc:
    start: Position = ...
    mid: Position = ...
    end: Position = ...
    width: float = ...
    layer: str = ...
    locked: bool = ...
    net: int = ...
    tstamp: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Arc: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True) -> str: ...

@dataclass
class Target:
    type: str = ...
    position: Position = ...
    size: float = ...
    width: float = ...
    layer: str = ...
    tstamp: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Target: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True) -> str: ...
