import Foundation struct SearchDataPayload: Decodable { let users: [UserSearchResult] } struct UserSearchResult: Decodable, Identifiable { let userId: UUID let login: String let fullName: String? let customName: String? let createdAt: Date? let profile: SearchProfile? var id: UUID { userId } } struct SearchProfile: Decodable { let userId: UUID let login: String? let fullName: String? let customName: String? let bio: String? let lastSeen: Int? let createdAt: Date? } extension UserSearchResult { var displayName: String { if let customName = customName, !customName.isEmpty { return customName } if let fullName = fullName, !fullName.isEmpty { return fullName } if let profileName = profile?.customName, !profileName.isEmpty { return profileName } if let profileFullName = profile?.fullName, !profileFullName.isEmpty { return profileFullName } return "@\(login)" } var secondaryText: String? { if let fullName = fullName, !fullName.isEmpty, fullName != displayName { return fullName } if let profileLogin = profile?.login, !profileLogin.isEmpty, profileLogin != login { return "@\(profileLogin)" } return nil } }