from dataclasses import dataclass

from kiutils.items.common import Effects as Effects
from kiutils.items.common import Font as Font
from kiutils.items.common import Position as Position
from kiutils.items.common import Property as Property
from kiutils.items.syitems import *
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 SymbolAlternativePin:
    pinName: str = ...
    electricalType: str = ...
    graphicalStyle: str = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> SymbolAlternativePin: ...
    def to_sexpr(self, indent: int = 8, newline: bool = True) -> str: ...

@dataclass
class SymbolPin:
    electricalType: str = ...
    graphicalStyle: str = ...
    position: Position = ...
    length: float = ...
    name: str = ...
    nameEffects: Effects | None = ...
    number: str = ...
    numberEffects: Effects | None = ...
    hide: bool = ...
    alternatePins: list[SymbolAlternativePin] = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> SymbolPin: ...
    def to_sexpr(self, indent: int = 4, newline: bool = True) -> str: ...

@dataclass
class Symbol:
    @property
    def libId(self) -> str: ...
    libraryNickname = ...
    entryName = ...
    unitId = ...
    styleId = ...
    @libId.setter
    def libId(self, symbol_id: str): ...
    extends: str | None = ...
    hidePinNumbers: bool = ...
    pinNames: bool = ...
    pinNamesHide: bool = ...
    pinNamesOffset: float | None = ...
    inBom: bool | None = ...
    onBoard: bool | None = ...
    isPower: bool = ...
    properties: list[Property] = ...
    graphicItems: list = ...
    pins: list[SymbolPin] = ...
    units: list[Symbol] = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Symbol: ...
    @classmethod
    def create_new(cls, id: str, reference: str, value: str, footprint: str = '', datasheet: str = '') -> Symbol: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True) -> str: ...

@dataclass
class SymbolLib:
    version: str = ...
    generator: str | None = ...
    symbols: list[Symbol] = ...
    filePath: str | None = ...
    @classmethod
    def from_file(cls, filepath: str, encoding: str | None = None) -> SymbolLib: ...
    @classmethod
    def from_sexpr(cls, exp: list) -> SymbolLib: ...
    def to_file(self, filepath=None, encoding: str | None = None): ...
    def to_sexpr(self, indent: int = 0, newline: bool = True) -> str: ...
