import 'package:boilerplate/data/repositories/master_repository.dart';
import 'package:dartz/dartz.dart';
import 'package:injectable/injectable.dart';

import '../../../core/utils/print_utils.dart';
import '../../../data/models/app/failure.dart';
import '../../entities/master/banner_data.dart';

@injectable
class GetBannerUseCase {
  final MasterRepository _repo;

  GetBannerUseCase(this._repo);

  Future<Either<List<BannerData>, Failure>> execute() async {
    try {
      final data = await _repo.getBanners();

      return Left(data.result);
    } catch (err) {
      print('GetBannerUseCase Error : $err');
      return Right(Failure(
        errMessage: '$err',
      ));
    }
  }
}
