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"
)
