part of 'exclusive_summary_loader_bloc.dart';

@freezed
class ExclusiveSummaryLoaderState with _$ExclusiveSummaryLoaderState {
  const factory ExclusiveSummaryLoaderState({
    required ExclusiveSummary exclusiveSummary,
    required Option<AnalyticFailure> failureOption,
    @Default(false) bool isFetching,
    required DateTime dateFrom,
    required DateTime dateTo,
  }) = _ExclusiveSummaryLoaderState;

  factory ExclusiveSummaryLoaderState.initial() {
    final now = DateTime.now();
    return ExclusiveSummaryLoaderState(
      exclusiveSummary: ExclusiveSummary.empty(),
      failureOption: none(),
      dateFrom: DateTime(now.year, now.month, 1),
      dateTo: DateTime(now.year, now.month + 1, 0),
    );
  }
}
