// // MockEmployeeService.swift // EmployeeDirectory // // Created by Matt Bruce on 3/4/25. // import Foundation // Mock Service Implementation for testing & previews. struct MockEmployeeService: EmployeeServiceProtocol { static let sample = createUser(page: 1, index: 1) static func createUser(page: Int?, index: Int) -> Employee { let id = UUID() return Employee( uuid: id, firstName: "First \(index + ((page ?? 1) - 1) * 20)", lastName: "Last \(index + ((page ?? 1) - 1) * 20)", phoneNumber: "555555\(1000 + index)", emailAddress: "user\(index)@example.com", biography: "Biography for employee \(index)", photoURLSmall: "https://robohash.org/\(id.uuidString).png?size=100x100&set=set1", photoURLLarge: "https://robohash.org/\(id.uuidString).png?size=400x400&set=set1" ) } func getUsers(page: Int?) async throws -> Employees { // Simulate network delay. try await Task.sleep(nanoseconds: 500_000_000) // Create dummy data (20 employees per page). let dummyEmployees: [Employee] = (0..<20).map { i in Self.createUser(page: page, index: i) } // Simulate that there are more pages if page is less than 5. let hasNext = (page ?? 1) < 5 return Employees(result: dummyEmployees, hasNextPage: hasNext) } }