import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:niogu_ecommerce_v1/core/providers/app_provider.dart';
import 'package:niogu_ecommerce_v1/features/auth/data/datasource/auth_remote_datasource_impl.dart';
import 'package:niogu_ecommerce_v1/features/auth/data/repositories/auth_repository_impl.dart';
import 'package:niogu_ecommerce_v1/features/auth/domain/repositories/i_auth_repository.dart';
import 'package:niogu_ecommerce_v1/features/auth/presentation/controllers/auth_controller.dart';

final authRemoteDatasourceProvider =
    Provider.autoDispose<IAuthRemoteDatasource>((ref) {
      final dio = ref.watch(dioProvider);

      return AuthRemoteDatasourceImpl(dio);
    });

final authRepositoryProvider = Provider.autoDispose<IAuthRepository>((ref) {
  final datasource = ref.watch(authRemoteDatasourceProvider);

  return AuthRepositoryImpl(datasource);
});

final authControllerProvider =
    AsyncNotifierProvider.autoDispose<AuthController, void>(AuthController.new);
