part of 'purchasing_analytic_loader_bloc.dart';

@freezed
class PurchasingAnalyticLoaderState with _$PurchasingAnalyticLoaderState {
  const factory PurchasingAnalyticLoaderState({
    required PurchasingAnalytic purchasing,
    required Option<AnalyticFailure> failureOptionPurchasing,
    @Default(false) bool isFetching,
    required DateTime dateFrom,
    required DateTime dateTo,
    String? outletId,
    @Default('day') String groupBy,
  }) = _PurchasingAnalyticLoaderState;

  factory PurchasingAnalyticLoaderState.initial() =>
      PurchasingAnalyticLoaderState(
        purchasing: PurchasingAnalytic.empty(),
        failureOptionPurchasing: none(),
        dateFrom: DateTime.now().subtract(const Duration(days: 30)),
        dateTo: DateTime.now(),
      );
}
