// // AppModel.swift // Focale // // Author: Simon-Pierre Boucher // Contact: contact@spboucher.ai // import Foundation import Observation import Photos @MainActor @Observable final class AppModel { let camera = CameraModel() let recipes = RecipeStore() let projects = ProjectStore() let albums = LivingAlbumStore() let placeProvider = PlaceProvider() let indexPipeline = IndexPipeline(container: IndexStore.container) let searchEngine = SearchEngine(container: IndexStore.container) private(set) var photoAccess: PHAuthorizationStatus init() { photoAccess = PHPhotoLibrary.authorizationStatus(for: .readWrite) camera.recipes = recipes camera.projects = projects camera.indexPipeline = indexPipeline camera.placeProvider = placeProvider } /// Full access or nothing — in `.limited` the product cannot work /// (CLAUDE.md §2). `.limited` gets its own explanatory screen. var hasFullPhotoAccess: Bool { photoAccess == .authorized } var hasLimitedPhotoAccess: Bool { photoAccess == .limited } func requestPhotoAccess() async { photoAccess = await PHPhotoLibrary.requestAuthorization(for: .readWrite) } func refreshPhotoAccess() { photoAccess = PHPhotoLibrary.authorizationStatus(for: .readWrite) } }