# Data Model & Edit Operations ## Description Implement the non-destructive editing data model with operation stack for full undo/redo support. ## Acceptance Criteria - [ ] `EditOperation` enum implemented with cases: `.mask`, `.inpaint`, `.adjustment` - [ ] `MaskOperation` struct with: id, toolType, maskData (compressed R8), timestamp - [ ] `InpaintOperation` struct with: id, maskOperationId, patchRadius, featherAmount, timestamp - [ ] `ToolType` enum with cases: `.person`, `.object`, `.wire`, `.brush` - [ ] `Project` model that holds: - Original image reference (PHAsset identifier or embedded Data) - Operation stack (array of EditOperation) - Current stack position for undo/redo - [ ] All models conform to `Codable` - [ ] Undo operation decrements stack position - [ ] Redo operation increments stack position - [ ] Project can be serialized to/from JSON - [ ] Unit tests for operation stack logic ## Technical Notes - Original image is NEVER modified - Mask data should be compressed (R8 texture format) - Store PHAsset `localIdentifier` for Photos-sourced images - Store embedded image data for Files-imported images - Cached previews should set `isExcludedFromBackup = true` ## Edge Cases - Undo at beginning of stack: no-op, return false - Redo at end of stack: no-op, return false - Empty operation stack: valid state, shows original image