import { DriverProfileUpdateService } from '@/lib/services/drivers/DriverProfileUpdateService'; import type { Mutation } from '@/lib/contracts/mutations/Mutation'; import { Result } from '@/lib/contracts/Result'; export interface UpdateDriverProfileCommand { bio?: string; country?: string; } export type UpdateDriverProfileMutationError = 'DRIVER_PROFILE_UPDATE_FAILED'; export class UpdateDriverProfileMutation implements Mutation { private readonly service: DriverProfileUpdateService; constructor() { this.service = new DriverProfileUpdateService(); } async execute( command: UpdateDriverProfileCommand, ): Promise> { try { const result = await this.service.updateProfile({ bio: command.bio, country: command.country, }); if (result.isErr()) { return Result.err('DRIVER_PROFILE_UPDATE_FAILED'); } return Result.ok(undefined); } catch (error) { return Result.err('DRIVER_PROFILE_UPDATE_FAILED'); } } }