/// Payment Terms Provider
///
/// Provides payment terms list from the API.
library;

import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:worker/features/orders/domain/entities/payment_term.dart';
import 'package:worker/features/orders/presentation/providers/order_data_providers.dart';

part 'payment_terms_provider.g.dart';

/// Provider for fetching payment terms list
///
/// This provider automatically fetches the list when accessed.
/// Returns AsyncValue<List<PaymentTerm>> which handles loading/error states.
@riverpod
Future<List<PaymentTerm>> paymentTermsList(Ref ref) async {
  final repository = await ref.watch(orderRepositoryProvider.future);
  return repository.getPaymentTermsList();
}
