import { UserRepository } from '@app/domain/users/user.repository';
import { Observable, of } from 'rxjs';
import { User } from '@app/domain/users/user.model';
import { mockUsers } from '@app/testing/user.mock';

export class FakeUserRepository implements UserRepository {
  getUserById(userId: string): Observable<User> {
    const user = mockUsers.find((u) => u.id === userId) ?? ({} as User);
    return of(user);
  }

  update(userId: string, user: Partial<User> | User): Observable<User> {
    const existingUser = mockUsers.find((u) => u.id === userId) ?? mockUsers[0];
    return of({ ...existingUser, ...user });
  }
}
