/// Order Data Providers
///
/// Riverpod providers for order data sources and repositories.
library;

import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:worker/core/network/dio_client.dart';
import 'package:worker/features/orders/data/datasources/order_remote_datasource.dart';
import 'package:worker/features/orders/data/datasources/order_status_local_datasource.dart';
import 'package:worker/features/orders/data/repositories/order_repository_impl.dart';
import 'package:worker/features/orders/domain/repositories/order_repository.dart';

part 'order_data_providers.g.dart';

/// Provider for Order Remote Data Source
@riverpod
Future<OrderRemoteDataSource> orderRemoteDataSource(Ref ref) async {
  final dioClient = await ref.watch(dioClientProvider.future);
  return OrderRemoteDataSource(dioClient);
}

/// Provider for Order Repository
@riverpod
Future<OrderRepository> orderRepository(Ref ref) async {
  final remoteDataSource = await ref.watch(orderRemoteDataSourceProvider.future);
  final statusLocalDataSource = OrderStatusLocalDataSource();
  return OrderRepositoryImpl(remoteDataSource, statusLocalDataSource);
}
