"""规则服务接口。""" from abc import ABC, abstractmethod from fastapi_modules.fastapi_leaudit.domian.vo.ruleVo import ( RuleBindingVO, RuleContentVO, RuleSetVO, RuleValidationVO, RuleVersionVO, ) class IRuleService(ABC): """规则服务接口。""" @abstractmethod async def ListSets(self) -> list[RuleSetVO]: """列出所有规则集。""" ... @abstractmethod async def GetVersions(self, RuleType: str) -> list[RuleVersionVO]: """获取规则集的所有版本。""" ... @abstractmethod async def GetContent(self, VersionId: int) -> RuleContentVO: """获取指定版本的规则正文。""" ... @abstractmethod async def Validate(self, RuleType: str, YamlText: str) -> RuleValidationVO: """校验规则 YAML。""" ... @abstractmethod async def CreateVersion( self, RuleType: str, YamlText: str, ChangeNote: str | None = None, EditorUserId: int | None = None, ) -> RuleVersionVO: """创建规则版本。""" ... @abstractmethod async def Publish( self, RuleType: str, VersionId: int, OperatorUserId: int | None = None, ) -> RuleVersionVO: """发布指定版本。""" ... @abstractmethod async def Rollback( self, RuleType: str, VersionId: int, OperatorUserId: int | None = None, ) -> RuleVersionVO: """回滚到指定历史版本。""" ... @abstractmethod async def ListBindings(self, RuleType: str | None = None, Region: str | None = None) -> list[RuleBindingVO]: """列出规则类型绑定。可按规则类型/地区过滤。""" ... @abstractmethod async def CreateBinding( self, DocTypeId: int, RuleSetId: int, Region: str = "default", BindingMode: str = "explicit", Priority: int = 0, DocTypeCode: str | None = None, Note: str | None = None, ) -> RuleBindingVO: """创建规则类型绑定。""" ... @abstractmethod async def UpdateBinding( self, BindingId: int, IsActive: bool | None = None, Priority: int | None = None, BindingMode: str | None = None, Note: str | None = None, ) -> RuleBindingVO: """更新规则类型绑定。""" ... @abstractmethod async def DeleteBinding(self, BindingId: int) -> None: """删除规则类型绑定。""" ...