import Foundation

public struct UserNotificationV2: Equatable, Hashable, Codable {
    public var notifiedAt: Date
    public var notifications: [NotificationItemV2]

    enum CodingKeys: String, CodingKey {
        case notifiedAt = "notified_at"
        case notifications
    }

    init(_ remote: Components.Schemas.UserNotificationV2Schema) throws {
        self.notifiedAt = remote.notified_at
        self.notifications = try remote.notifications?.compactMap(NotificationItemV2.init) ?? []
    }
}
