import 'package:recording_tool/features/events/model/model_event_info.dart';

class EventInfoState {
  const EventInfoState({
    this.isRequestingStreamKey = false,
    this.profile = const EventProfile(name: '', phone: '', eventTitle: '赛事信息'),
    this.total = 0,
    this.items = const [],
  });

  final bool isRequestingStreamKey;
  final EventProfile profile;
  final int total;
  final List<EventRegistrationItem> items;

  String get eventTitle =>
      items.isEmpty ? profile.eventTitle : items.first.eventName;

  EventInfoState copyWith({
    bool? isRequestingStreamKey,
    EventProfile? profile,
    int? total,
    List<EventRegistrationItem>? items,
  }) {
    return EventInfoState(
      isRequestingStreamKey:
          isRequestingStreamKey ?? this.isRequestingStreamKey,
      profile: profile ?? this.profile,
      total: total ?? this.total,
      items: items ?? this.items,
    );
  }
}
