import Foundation struct ThreadPosition: Equatable, Sendable { let index: Int let count: Int init?(index: Int, count: Int) { guard count > 1, index > 0, index <= count else { return nil } self.index = index self.count = count } } struct ThreadResult { let posts: [Post] let mutedPostIDs: Set let positions: [String: ThreadPosition] init(posts: [Post], mutedPostIDs: Set, positions: [String: ThreadPosition] = [:]) { self.posts = posts self.mutedPostIDs = mutedPostIDs self.positions = positions } } struct CustomFeed: Identifiable, Codable, Equatable, Sendable { let id: String let name: String let avatarURL: URL? } enum TimelineFeedID: Hashable { case following case custom(String) init(_ feed: CustomFeed?) { self = feed.map { .custom($0.id) } ?? .following } } enum CustomFeedError: Error { case unavailable } struct FeedPage: Equatable, Sendable { let posts: [Post] let cursor: String? let replyContexts: [String: [Post]] let repostedBy: [String: Post.Author] let mutedPostIDs: Set init( posts: [Post], cursor: String?, replyContexts: [String: [Post]] = [:], repostedBy: [String: Post.Author] = [:], mutedPostIDs: Set = [] ) { self.posts = posts self.cursor = cursor self.replyContexts = replyContexts self.repostedBy = repostedBy self.mutedPostIDs = mutedPostIDs } }