package proposals import ( "fmt" "strings" ) // CorrectionProposal is the base proposal emitted by correction modules. type CorrectionProposal struct { TargetSegmentID int `json:"id"` OriginalText string `json:"original_text"` CorrectedText string `json:"corrected_text"` Confidence float64 `json:"confidence"` } // ProposalMetadata is framework-enriched execution metadata for a proposal. type ProposalMetadata struct { ProposalIndex int `json:"proposal_index"` ModuleKey string `json:"module_key"` ModuleInstance string `json:"module_instance"` SectionIndex *int `json:"section_index,omitempty"` } // EnrichedCorrectionProposal combines module-emitted proposal data with // framework execution metadata. type EnrichedCorrectionProposal struct { CorrectionProposal ProposalMetadata } // Validate checks only basic structural integrity of the proposal. // Semantic checks (staleness, span presence, replacement behavior) are handled // by proposal preview/application and validator execution. func (p CorrectionProposal) Validate() error { if p.TargetSegmentID <= 0 { return fmt.Errorf("proposal id must be positive") } if strings.TrimSpace(p.OriginalText) == "" { return fmt.Errorf("proposal original_text must not be empty") } if p.Confidence < 0.0 || p.Confidence > 1.0 { return fmt.Errorf("proposal confidence must be between 0.0 and 1.0") } return nil }