from dataclasses import dataclass

from kiutils.utils import sexpr as sexpr
from kiutils.utils.strings import dequote as dequote

@dataclass
class Constraint:
    type: str = ...
    min: str | None = ...
    opt: str | None = ...
    max: str | None = ...
    elements: list[str] = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Constraint: ...
    def to_sexpr(self, indent: int = 2, newline: bool = True): ...

@dataclass
class Rule:
    name: str = ...
    constraints: list[Constraint] = ...
    condition: str = ...
    layer: str | None = ...
    severity: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> Rule: ...
    def to_sexpr(self, indent: int = 0): ...

@dataclass
class DesignRules:
    version: int = ...
    rules: list[Rule] = ...
    filePath: str | None = ...
    @classmethod
    def from_sexpr(cls, exp: list) -> DesignRules: ...
    @classmethod
    def from_file(cls, filepath: str, encoding: str | None = None) -> DesignRules: ...
    @classmethod
    def create_new(cls) -> DesignRules: ...
    def to_file(self, filepath=None, encoding: str | None = None): ...
    def to_sexpr(self, indent: int = 0, newline: bool = False): ...
