part of 'order_loader_bloc.dart';

@freezed
class OrderLoaderState with _$OrderLoaderState {
  factory OrderLoaderState({
    required List<Order> orders,
    required Option<OrderFailure> failureOption,
    required Option<OrderFailure> failureOptionGetById,
    required Order order,
    Order? selectedOrder,
    String? search,
    required DateTime startDate,
    required DateTime endDate,
    @Default(0) int totalOrder,
    @Default(false) bool isFetching,
    @Default(false) bool isFetchingById,
    @Default(false) bool hasReachedMax,
    @Default(1) int page,
  }) = _OrderLoaderState;

  factory OrderLoaderState.initial() => OrderLoaderState(
    orders: [],
    failureOption: none(),
    startDate: DateTime.now(),
    endDate: DateTime.now(),
    failureOptionGetById: none(),
    order: Order.empty(),
  );
}
