import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:niogu_ecommerce_v1/core/providers/app_provider.dart';
import 'package:niogu_ecommerce_v1/features/account/data/datasource/account_remote_datasource_impl.dart';
import 'package:niogu_ecommerce_v1/features/account/data/repositories/account_repository_impl.dart';
import 'package:niogu_ecommerce_v1/features/account/domain/entities/account.dart';
import 'package:niogu_ecommerce_v1/features/account/domain/repositories/i_account_repository.dart';
import 'package:niogu_ecommerce_v1/features/account/presentation/controllers/account_controller.dart';

final accountRemoteDatasourceProvider =
    Provider.autoDispose<IAccountRemoteDatasource>((ref) {
      final dio = ref.watch(dioProvider);

      return AccountRemoteDatasourceImpl(dio);
    });

final accountRepositoryProvider = Provider.autoDispose<IAccountRepository>((
  ref,
) {
  final accountRemoteDatasource = ref.watch(accountRemoteDatasourceProvider);

  return AccountRepositoryImpl(accountRemoteDatasource);
});

final customerControllerProvider =
    AsyncNotifierProvider.autoDispose<CustomerController, void>(
      CustomerController.new,
    );

final customerAddressControllerProvider =
    AsyncNotifierProvider.autoDispose<
      CustomerAddressController,
      List<CustomerAddress>
    >(CustomerAddressController.new);

final selectedAddressProvider = StateProvider<SelectedAddress?>((ref) => null);
