import Foundation
import SharedModels

struct WidgetDataReader {
    static let suiteName = "group.com.conjuga.app"
    static let dataKey = "widgetData"

    static func read() -> WidgetData {
        guard let shared = UserDefaults(suiteName: suiteName),
              let data = shared.data(forKey: dataKey),
              let decoded = try? JSONDecoder().decode(WidgetData.self, from: data) else {
            return .placeholder
        }
        return decoded
    }
}
