Files
breakpilot-compliance/ai-compliance-sdk/internal/iace/models.go
Sharang Parnerkar 3f1444541f refactor(go/iace): split tech_file_generator, hazard_patterns, models, completeness
Split 4 oversized files (503-679 LOC each) into focused units all under 500 LOC:
- tech_file_generator.go → +_prompts, +_prompt_builder, +_fallback
- hazard_patterns_extended.go → +_extended2.go (HP074-HP102 extracted)
- models.go → +_entities.go, +_api.go (enums / DB entities / API types)
- completeness.go → +_gates.go (gate definitions extracted)

All files remain in package iace. Zero behavior changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 10:03:44 +02:00

194 lines
7.5 KiB
Go

package iace
// ============================================================================
// Constants / Enums
// ============================================================================
// ProjectStatus represents the lifecycle status of an IACE project
type ProjectStatus string
const (
ProjectStatusDraft ProjectStatus = "draft"
ProjectStatusOnboarding ProjectStatus = "onboarding"
ProjectStatusClassification ProjectStatus = "classification"
ProjectStatusHazardAnalysis ProjectStatus = "hazard_analysis"
ProjectStatusMitigation ProjectStatus = "mitigation"
ProjectStatusVerification ProjectStatus = "verification"
ProjectStatusTechFile ProjectStatus = "tech_file"
ProjectStatusCompleted ProjectStatus = "completed"
ProjectStatusArchived ProjectStatus = "archived"
)
// ComponentType represents the type of a system component
type ComponentType string
const (
ComponentTypeSoftware ComponentType = "software"
ComponentTypeFirmware ComponentType = "firmware"
ComponentTypeAIModel ComponentType = "ai_model"
ComponentTypeHMI ComponentType = "hmi"
ComponentTypeSensor ComponentType = "sensor"
ComponentTypeActuator ComponentType = "actuator"
ComponentTypeController ComponentType = "controller"
ComponentTypeNetwork ComponentType = "network"
ComponentTypeMechanical ComponentType = "mechanical"
ComponentTypeElectrical ComponentType = "electrical"
ComponentTypeOther ComponentType = "other"
)
// RegulationType represents the applicable EU regulation
type RegulationType string
const (
RegulationNIS2 RegulationType = "nis2"
RegulationAIAct RegulationType = "ai_act"
RegulationCRA RegulationType = "cra"
RegulationMachineryRegulation RegulationType = "machinery_regulation"
)
// HazardStatus represents the lifecycle status of a hazard
type HazardStatus string
const (
HazardStatusIdentified HazardStatus = "identified"
HazardStatusAssessed HazardStatus = "assessed"
HazardStatusMitigated HazardStatus = "mitigated"
HazardStatusAccepted HazardStatus = "accepted"
HazardStatusClosed HazardStatus = "closed"
)
// AssessmentType represents the type of risk assessment
type AssessmentType string
const (
AssessmentTypeInitial AssessmentType = "initial"
AssessmentTypePostMitigation AssessmentType = "post_mitigation"
AssessmentTypeReassessment AssessmentType = "reassessment"
)
// RiskLevel represents the severity level of a risk
type RiskLevel string
const (
RiskLevelNotAcceptable RiskLevel = "not_acceptable" // ISO 12100 mode: > 300
RiskLevelVeryHigh RiskLevel = "very_high" // ISO 12100 mode: 151-300
RiskLevelCritical RiskLevel = "critical"
RiskLevelHigh RiskLevel = "high"
RiskLevelMedium RiskLevel = "medium"
RiskLevelLow RiskLevel = "low"
RiskLevelNegligible RiskLevel = "negligible"
)
// ReductionType represents the type of risk reduction measure
type ReductionType string
const (
ReductionTypeDesign ReductionType = "design"
ReductionTypeProtective ReductionType = "protective"
ReductionTypeInformation ReductionType = "information"
)
// MitigationStatus represents the lifecycle status of a mitigation measure
type MitigationStatus string
const (
MitigationStatusPlanned MitigationStatus = "planned"
MitigationStatusImplemented MitigationStatus = "implemented"
MitigationStatusVerified MitigationStatus = "verified"
MitigationStatusRejected MitigationStatus = "rejected"
)
// VerificationMethod represents the method used for verification
type VerificationMethod string
const (
VerificationMethodTest VerificationMethod = "test"
VerificationMethodAnalysis VerificationMethod = "analysis"
VerificationMethodInspection VerificationMethod = "inspection"
VerificationMethodReview VerificationMethod = "review"
VerificationMethodDesignReview VerificationMethod = "design_review"
VerificationMethodCalculation VerificationMethod = "calculation"
VerificationMethodTestReport VerificationMethod = "test_report"
VerificationMethodValidation VerificationMethod = "validation"
VerificationMethodElectricalTest VerificationMethod = "electrical_test"
VerificationMethodSoftwareTest VerificationMethod = "software_test"
VerificationMethodPenetrationTest VerificationMethod = "penetration_test"
VerificationMethodAcceptanceProtocol VerificationMethod = "acceptance_protocol"
VerificationMethodUserTest VerificationMethod = "user_test"
VerificationMethodDocRelease VerificationMethod = "documentation_release"
)
// TechFileSectionStatus represents the status of a technical file section
type TechFileSectionStatus string
const (
TechFileSectionStatusDraft TechFileSectionStatus = "draft"
TechFileSectionStatusGenerated TechFileSectionStatus = "generated"
TechFileSectionStatusReviewed TechFileSectionStatus = "reviewed"
TechFileSectionStatusApproved TechFileSectionStatus = "approved"
)
// MonitoringEventType represents the type of monitoring event
type MonitoringEventType string
const (
MonitoringEventTypeIncident MonitoringEventType = "incident"
MonitoringEventTypeUpdate MonitoringEventType = "update"
MonitoringEventTypeDriftAlert MonitoringEventType = "drift_alert"
MonitoringEventTypeRegulationChange MonitoringEventType = "regulation_change"
MonitoringEventTypeAudit MonitoringEventType = "audit"
)
// AuditAction represents the type of action recorded in the audit trail
type AuditAction string
const (
AuditActionCreate AuditAction = "create"
AuditActionUpdate AuditAction = "update"
AuditActionDelete AuditAction = "delete"
AuditActionApprove AuditAction = "approve"
AuditActionVerify AuditAction = "verify"
)
// LifecyclePhase represents a machine lifecycle phase per ISO 12100 methodology
type LifecyclePhase string
const (
LPTransport LifecyclePhase = "transport"
LPStorage LifecyclePhase = "storage"
LPAssembly LifecyclePhase = "assembly"
LPInstallation LifecyclePhase = "installation"
LPCommissioning LifecyclePhase = "commissioning"
LPParameterization LifecyclePhase = "parameterization"
LPSetup LifecyclePhase = "setup"
LPNormalOperation LifecyclePhase = "normal_operation"
LPAutoOperation LifecyclePhase = "automatic_operation"
LPManualOperation LifecyclePhase = "manual_operation"
LPTeachMode LifecyclePhase = "teach_mode"
LPProductionStart LifecyclePhase = "production_start"
LPProductionStop LifecyclePhase = "production_stop"
LPProcessMonitoring LifecyclePhase = "process_monitoring"
LPCleaning LifecyclePhase = "cleaning"
LPMaintenance LifecyclePhase = "maintenance"
LPInspection LifecyclePhase = "inspection"
LPCalibration LifecyclePhase = "calibration"
LPFaultClearing LifecyclePhase = "fault_clearing"
LPRepair LifecyclePhase = "repair"
LPChangeover LifecyclePhase = "changeover"
LPSoftwareUpdate LifecyclePhase = "software_update"
LPRemoteMaintenance LifecyclePhase = "remote_maintenance"
LPDecommissioning LifecyclePhase = "decommissioning"
LPDisposal LifecyclePhase = "disposal"
)
// ReviewStatus represents the review state of a hazard assessment
type ReviewStatus string
const (
ReviewStatusDraft ReviewStatus = "draft"
ReviewStatusInReview ReviewStatus = "in_review"
ReviewStatusReviewed ReviewStatus = "reviewed"
ReviewStatusApproved ReviewStatus = "approved"
ReviewStatusRejected ReviewStatus = "rejected"
)