import { Wallet } from '../../../domain/entities/wallet';
import { NotFoundError } from '../../../domain/errors/not-found-error';
import { IWalletRepository } from '../../../domain/repositories/wallet-repository';

export class GetWalletByIdUseCase {
  constructor(private readonly walletRepository: IWalletRepository) {}

  async execute(id: string): Promise<Wallet> {
    const wallet = await this.walletRepository.findById(id);
    if (!wallet) {
      throw new NotFoundError('Wallet', id);
    }
    return wallet;
  }
}
