18 lines
627 B
Python
18 lines
627 B
Python
from dataclasses import dataclass
|
|
|
|
from kab_ingestion.models import SourceDocument
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class GovernanceDecision:
|
|
approved: bool
|
|
reason: str
|
|
|
|
|
|
def review(document: SourceDocument, require_approval: bool = True) -> GovernanceDecision:
|
|
if not document.title.strip() or not document.body.strip():
|
|
return GovernanceDecision(False, "title and body are required")
|
|
if require_approval and document.metadata.get("governance_approved") is not True:
|
|
return GovernanceDecision(False, "governance approval is required")
|
|
return GovernanceDecision(True, "document passed governance")
|