import { IThumbnailResolver } from '../../application/ports/thumbnail-resolver';
import { ImageEntityType, ThumbnailMetadata } from '../../application/ports/image-storage';
import { CoinMarketCapClient } from './coinmarketcap-client';

export class CoinMarketCapThumbnailResolver implements IThumbnailResolver {
  constructor(private readonly client: CoinMarketCapClient) {}

  async resolve(type: ImageEntityType, metadata: ThumbnailMetadata): Promise<string | null> {
    if (type === 'network') {
      return this.client.getNetworkLogoUrl(metadata.name, metadata.symbol);
    }
    return this.client.getTokenLogoUrl(metadata.name, metadata.symbol);
  }
}
