import 'package:eatvio_app/features/insights/models/insights_payload_model.dart'; import 'package:eatvio_app/features/insights/models/insights_period.dart'; import 'package:eatvio_app/features/insights/presentation/cubit/insights_panel.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'insights_state.freezed.dart'; /// Видимость серий (чипы под графиком): `true` — серия показана. @freezed abstract class InsightsSeriesVisibility with _$InsightsSeriesVisibility { const factory InsightsSeriesVisibility({ /// Талия, Грудь, Бёдра. @Default([true, true, true]) List measure, /// Калории, Белки, Жиры, Углеводы. @Default([true, true, true, true]) List daily, /// Белки, Жиры, Углеводы, Сытость, Настроение. @Default([true, true, true, true, true]) List intra, }) = _InsightsSeriesVisibility; } @freezed abstract class InsightsState with _$InsightsState { const factory InsightsState.initial() = InsightsStateInitial; const factory InsightsState.loading() = InsightsStateLoading; /// 403: данные недоступны, блок не показывается. const factory InsightsState.hidden() = InsightsStateHidden; const factory InsightsState.error({required String message}) = InsightsStateError; const factory InsightsState.loaded({ required InsightsPayloadModel payload, @Default(BodyPeriod.threeMonths) BodyPeriod bodyPeriod, @Default(DailyPeriod.twoWeeks) DailyPeriod dailyPeriod, /// День вкладки «В течение дня» (`YYYY-MM-DD`); `null` — сегодня. String? intraDate, @Default(InsightsPanel.weight) InsightsPanel panel, @Default(InsightsSeriesVisibility()) InsightsSeriesVisibility seriesVisibility, @Default(true) bool showSleep, @Default(false) bool isExpanded, /// Идёт перезапрос (смена периода / обновление) — старые данные остаются на экране. @Default(false) bool isRefreshing, }) = InsightsStateLoaded; }