part of 'profit_loss_loader_bloc.dart';

@freezed
class ProfitLossLoaderState with _$ProfitLossLoaderState {
  const factory ProfitLossLoaderState({
    required ProfitLossAnalytic profitLoss,
    required Option<AnalyticFailure> failureOptionProfitLoss,
    @Default(false) bool isFetching,
    required DateTime dateFrom,
    required DateTime dateTo,
  }) = _ProfitLossLoaderState;

  factory ProfitLossLoaderState.initial() => ProfitLossLoaderState(
    profitLoss: ProfitLossAnalytic.empty(),
    failureOptionProfitLoss: none(),
    dateFrom: DateTime.now().subtract(const Duration(days: 30)),
    dateTo: DateTime.now(),
  );
}
