//
//  SettingsViewModel+CloudSync.swift
//  SelfieCam
//
//  Created by Matt Bruce on 1/4/26.
//

import Foundation
import Bedrock

// MARK: - CloudSyncable Conformance

extension SettingsViewModel: CloudSyncable {
    
    /// Whether iCloud sync is available
    var iCloudAvailable: Bool { cloudSync.iCloudAvailable }
    
    /// Whether iCloud sync is enabled (available to all users)
    var iCloudEnabled: Bool {
        get { cloudSync.iCloudEnabled }
        set { cloudSync.iCloudEnabled = newValue }
    }
    
    /// Last sync date
    var lastSyncDate: Date? { cloudSync.lastSyncDate }
    
    /// Current sync status message
    var syncStatus: String { cloudSync.syncStatus }
    
    /// Whether initial sync has completed
    var hasCompletedInitialSync: Bool { cloudSync.hasCompletedInitialSync }
    
    // MARK: - Sync Actions
    
    /// Forces a sync with iCloud
    func forceSync() {
        cloudSync.sync()
    }
    
    /// Resets all settings to defaults
    func resetToDefaults() {
        cloudSync.reset()
    }
}
