import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:niogu_ecommerce_v1/core/providers/app_provider.dart';
import 'package:niogu_ecommerce_v1/features/checkout/data/datasource/checkout_remote_datasource_impl.dart';
import 'package:niogu_ecommerce_v1/features/checkout/data/repositories/checkout_repository_impl.dart';
import 'package:niogu_ecommerce_v1/features/checkout/domain/repositories/i_checkout_repository.dart';
import 'package:niogu_ecommerce_v1/features/checkout/presentation/controllers/checkout_controller.dart';

final checkoutRemoteDatasourceProvider =
    Provider.autoDispose<ICheckoutRemoteDatasource>((ref) {
      final dio = ref.watch(dioProvider);

      return CheckoutRemoteDatasourceImpl(dio);
    });

final checkoutRepositoryProvider = Provider.autoDispose<ICheckoutRepository>((
  ref,
) {
  final checkoutRemoteDatasource = ref.watch(checkoutRemoteDatasourceProvider);

  return CheckoutRepositoryImpl(checkoutRemoteDatasource);
});

final checkoutControllerProvider =
    AsyncNotifierProvider.autoDispose<CheckoutController, void>(
      CheckoutController.new,
    );