import { api as api } from '../../api'; import { presentDriversLeaderboard } from '../../presenters'; import { DriverLeaderboardViewModel } from '../../view-models'; /** * Driver Service * * Handles driver-related operations including profiles, leaderboards, and onboarding. */ export class DriverService { constructor( private readonly apiClient = api.drivers ) {} async getDriverLeaderboard(): Promise { const dto = await this.apiClient.getLeaderboard(); return presentDriversLeaderboard(dto); } async completeDriverOnboarding(input: any): Promise { return await this.apiClient.completeOnboarding(input); } async getCurrentDriver(): Promise { return await this.apiClient.getCurrent(); } } // Singleton instance export const driverService = new DriverService(); // Backward compatibility functional exports export async function getDriverLeaderboard(): Promise { return driverService.getDriverLeaderboard(); } export async function completeDriverOnboarding(input: any): Promise { return driverService.completeDriverOnboarding(input); } export async function getCurrentDriver(): Promise { return driverService.getCurrentDriver(); }