import Foundation /// A single notification returned by the relay for a given feed. public struct OrgSocialNotification: Sendable, Identifiable { public enum Kind: String, Sendable { case mention case reaction case reply case boost case unknown } /// Unique ID: kind + post URL combined (the relay can return the same post URL for different kinds). public var id: String { "\(kind.rawValue):\(post)" } /// What kind of interaction this is. public var kind: Kind /// URL of the post that triggered the notification (e.g. `https://shom.dev/social.org#2025-…`). public var post: String /// For reactions: the emoji used. public var emoji: String? /// The post that was reacted/replied to (nil for mentions). public var parent: String? /// Nick/author extracted from the triggering post URL (everything before the first `#`). public var authorFeedURL: URL? { let base = post.components(separatedBy: "#").first ?? post return URL(string: base) } public init(kind: Kind, post: String, emoji: String? = nil, parent: String? = nil) { self.kind = kind self.post = post self.emoji = emoji self.parent = parent } }