import 'package:krow/core/entity/event_entity.dart';

class EventsState {
  final bool inLoading;
  final int tabIndex;
  final int subTabIndex;
  final String? errorMessage;

  final Map<int, Map<int, EventTabState>> tabs;

  const EventsState(
      {this.inLoading = false,
      this.tabIndex = 0,
      this.subTabIndex = 0,
        this.errorMessage,
      required this.tabs});

  EventsState copyWith({
    bool? inLoading,
    int? tabIndex,
    int? subTabIndex,
    String? errorMessage,
    Map<int, Map<int, EventTabState>>? tabs,
  }) {
    return EventsState(
      inLoading: inLoading ?? this.inLoading,
      tabIndex: tabIndex ?? this.tabIndex,
      subTabIndex: subTabIndex ?? this.subTabIndex,
      tabs: tabs ?? this.tabs,
      errorMessage: errorMessage,
    );
  }
}

class EventTabState {
  final List<EventEntity> items;
  final bool inLoading;
  final bool hasMoreItems;

  final EventStatus status;

  const EventTabState({
    required this.items,
    this.inLoading = false,
    this.hasMoreItems = true,
    required this.status,
  });

  EventTabState copyWith({
    List<EventEntity>? items,
    bool? inLoading,
    bool? hasMoreItems,
  }) {
    return EventTabState(
      items: items ?? this.items,
      inLoading: inLoading ?? this.inLoading,
      hasMoreItems: hasMoreItems ?? this.hasMoreItems,
      status: status,
    );
  }
}
