import 'package:krow/features/invoice/domain/invoice_entity.dart';

class InvoicesState {
  final bool inLoading;
  final int tabIndex;

  final Map<int, InvoiceTabState> tabs;

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

  InvoicesState copyWith({
    bool? inLoading,
    int? tabIndex,
    Map<int, InvoiceTabState>? tabs,
  }) {
    return InvoicesState(
      inLoading: inLoading ?? this.inLoading,
      tabIndex: tabIndex ?? this.tabIndex,
      tabs: tabs ?? this.tabs,
    );
  }
}

class InvoiceTabState {
  final List<InvoiceListEntity> items;
  final bool inLoading;
  final bool hasMoreItems;

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

  InvoiceTabState copyWith({
    List<InvoiceListEntity>? items,
    bool? inLoading,
    bool? hasMoreItems,
  }) {
    return InvoiceTabState(
      items: items ?? this.items,
      inLoading: inLoading ?? this.inLoading,
      hasMoreItems: hasMoreItems ?? this.hasMoreItems,
    );
  }
}
