VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "RulesProcessor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private word_ As API_WordWrapper

Public errors_ As Long
Public fixes_ As Long

Public Function Init(iWord As API_WordWrapper, iConfig As API_Config)
  Set word_ = iWord
  Dim sConfig$: sConfig = iConfig.SaveToJSON
  Dim sFile$: sFile = iWord.Document.FullName
  If Not word_.Run("RulesAccess.InitProcessor", sFile, sConfig) Then _
    Call Err.Raise(ERR_CANNOT_INIT)
End Function

Public Function RunRule(sRuleID$, Optional bApplyFix As Boolean = True)
  Dim vResult As Variant
  vResult = word_.Run("RulesAccess.RunRule", sRuleID, bApplyFix)
  If vResult(0) <> 0 Then _
    Call Err.Raise(vResult(0))
  errors_ = vResult(1)
  fixes_ = vResult(2)
End Function

Public Function FinalizeProcessing()
  Call word_.Run("RulesAccess.FinalizeRulesProcessing")
End Function
