import 'package:boilerplate/data/repositories/categories_repository.dart';
import 'package:boilerplate/domain/entities/categories/intellectual_type_data.dart';
import 'package:dartz/dartz.dart';
import 'package:injectable/injectable.dart';

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

@injectable
class GetIntellectualTypesUseCase {
  final CategoriesRepository _categoriesRepo;

  GetIntellectualTypesUseCase(this._categoriesRepo);

  Future<Either<List<IntellectualTypeData>, Failure>> execute() async {
    try {
      final data = await _categoriesRepo.getIntellectualTypes();

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