33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
"""Layer 5 — Manufacturing Process Authority."""
|
|
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ProcessEligibilityResult(BaseModel):
|
|
eligible: bool = Field(...)
|
|
process_type: str = Field(...)
|
|
reason: str | None = Field(default=None)
|
|
|
|
|
|
class ProcessAuthority:
|
|
"""Evaluates eligibility for additive, subtractive, hybrid."""
|
|
|
|
def process_eligible(
|
|
self,
|
|
design_ref: str,
|
|
process_type: str,
|
|
context: dict[str, Any] | None = None,
|
|
) -> ProcessEligibilityResult:
|
|
if not design_ref or not process_type:
|
|
return ProcessEligibilityResult(
|
|
eligible=False,
|
|
process_type=process_type or "unknown",
|
|
reason="design_ref and process_type required",
|
|
)
|
|
pt = process_type.lower()
|
|
if pt not in ("additive", "subtractive", "hybrid"):
|
|
return ProcessEligibilityResult(eligible=False, process_type=process_type, reason="Unknown process_type")
|
|
return ProcessEligibilityResult(eligible=True, process_type=pt, reason=None)
|