export class SearchMangas {
  constructor(mangaRepository) {
    this.mangaRepository = mangaRepository;
  }

  async execute(query) {
    if (!query || query.trim().length === 0) {
      return [];
    }

    try {
      return await this.mangaRepository.searchMangas(query);
    } catch (error) {
      console.error('Search error:', error);
      throw error;
    }
  }
}
