import 'package:krow/features/shifts/domain/shift_entity.dart';

class ShiftsState {
  final bool isLoading;
  final int tabIndex;

  final Map<int, ShiftTabState> tabs;
  final List<ShiftEntity> missedShifts;

  const ShiftsState(
      {this.isLoading = false,
      this.tabIndex = 0,
      required this.tabs,
      this.missedShifts = const []});

  ShiftsState copyWith({
    bool? isLoading,
    int? tabIndex,
    Map<int, ShiftTabState>? tabs,
    List<ShiftEntity>? missedShifts,
  }) {
    return ShiftsState(
      isLoading: isLoading ?? this.isLoading,
      tabIndex: tabIndex ?? this.tabIndex,
      tabs: tabs ?? this.tabs,
      missedShifts: missedShifts ?? this.missedShifts,
    );
  }
}

class ShiftTabState {
  final List<ShiftEntity> items;
  final bool isLoading;
  final bool hasMoreItems;

  const ShiftTabState({
    required this.items,
    this.isLoading = false,
    this.hasMoreItems = true,
  });

  ShiftTabState copyWith({
    List<ShiftEntity>? items,
    bool? isLoading,
    bool? hasMoreItems,
  }) {
    return ShiftTabState(
      items: items ?? this.items,
      isLoading: isLoading ?? this.isLoading,
      hasMoreItems: hasMoreItems ?? this.hasMoreItems,
    );
  }
}
