from dataclasses import dataclass

from kiutils.items.common import Coordinate as Coordinate
from kiutils.items.common import Font as Font
from kiutils.items.common import Group as Group
from kiutils.items.common import Image as Image
from kiutils.items.common import Net as Net
from kiutils.items.common import Position as Position
from kiutils.items.fpitems import *
from kiutils.items.gritems import *
from kiutils.items.zones import Zone as Zone
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
from kiutils.utils.strings import remove_prefix as remove_prefix

@dataclass
class Attributes:
    type: str | None = ...
    boardOnly: bool = ...
    excludeFromPosFiles: bool = ...
    excludeFromBom: bool = ...
    allowMissingCourtyard: bool = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Attributes: ...
    def to_sexpr(self, indent: int = 0, newline: bool = False) -> str: ...

@dataclass
class Model:
    path: str = ...
    pos: Coordinate = ...
    scale: Coordinate = ...
    rotate: Coordinate = ...
    hide: bool = ...
    opacity: float | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Model: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True) -> str: ...

@dataclass
class DrillDefinition:
    oval: bool = ...
    diameter: float = ...
    width: float | None = ...
    offset: Position | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> DrillDefinition: ...
    def to_sexpr(self, indent: int = 0, newline: bool = False) -> str: ...

@dataclass
class PadOptions:
    clearance: str = ...
    anchor: str = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> PadOptions: ...
    def to_sexpr(self, indent: int = 0, newline: bool = False) -> str: ...

@dataclass
class Pad:
    number: str = ...
    type: str = ...
    shape: str = ...
    position: Position = ...
    locked: bool = ...
    size: Position = ...
    drill: DrillDefinition | None = ...
    layers: list[str] = ...
    property: str | None = ...
    removeUnusedLayers: bool = ...
    keepEndLayers: bool = ...
    roundrectRatio: float | None = ...
    chamferRatio: float | None = ...
    chamfer: list[str] = ...
    net: Net | None = ...
    tstamp: str | None = ...
    pinFunction: str | None = ...
    pinType: str | None = ...
    dieLength: float | None = ...
    solderMaskMargin: float | None = ...
    solderPasteMargin: float | None = ...
    solderPasteMarginRatio: float | None = ...
    clearance: float | None = ...
    zoneConnect: int | None = ...
    thermalWidth: float | None = ...
    thermalGap: float | None = ...
    customPadOptions: PadOptions | None = ...
    customPadPrimitives: list = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Pad: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True) -> str: ...

@dataclass
class Footprint:
    @property
    def libId(self) -> str: ...
    libraryNickname = ...
    entryName = ...
    @libId.setter
    def libId(self, symbol_id: str): ...
    version: str | None = ...
    generator: str | None = ...
    locked: bool = ...
    placed: bool = ...
    layer: str = ...
    tedit: str = ...
    tstamp: str | None = ...
    position: Position | None = ...
    description: str | None = ...
    tags: str | None = ...
    properties: dict = ...
    path: str | None = ...
    autoplaceCost90: int | None = ...
    autoplaceCost180: int | None = ...
    solderMaskMargin: float | None = ...
    solderPasteMargin: float | None = ...
    solderPasteRatio: float | None = ...
    clearance: float | None = ...
    zoneConnect: int | None = ...
    thermalWidth: float | None = ...
    thermalGap: float | None = ...
    attributes: Attributes = ...
    privateLayers: list[str] = ...
    netTiePadGroups: list[str] = ...
    graphicItems: list = ...
    pads: list[Pad] = ...
    zones: list[Zone] = ...
    groups: list[Group] = ...
    models: list[Model] = ...
    filePath: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Footprint: ...
    @classmethod
    def from_file(cls, filepath: str, encoding: str | None = None) -> Footprint: ...
    @classmethod
    def create_new(cls, library_id: str, value: str, type: str = 'other', reference: str = 'REF**') -> Footprint: ...
    def to_file(self, filepath=None, encoding: str | None = None): ...
    def to_sexpr(self, indent: int = 0, newline: bool = True, layerInFirstLine: bool = False) -> str: ...
