Files
eatvio_app/lib/features/insights/models/insights_response_model.dart

37 lines
1.4 KiB
Dart

import 'package:eatvio_app/features/insights/models/insights_payload_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'insights_response_model.freezed.dart';
part 'insights_response_model.g.dart';
/// Ответ `GET /api/profile/insights[/{slug}]`: `{ "data": { weight, bmi, measure, daily, intra } }`.
@freezed
abstract class InsightsResponseModel with _$InsightsResponseModel {
const factory InsightsResponseModel({required InsightsPayloadModel data}) =
_InsightsResponseModel;
factory InsightsResponseModel.fromJson(Map<String, dynamic> json) =>
_$InsightsResponseModelFromJson(json);
}
/// Ответ `GET /api/profile/insights/intra` и `/insights/{slug}/intra`:
/// `{ "data": { "intra": { ... } } }`.
@freezed
abstract class InsightsIntraResponseModel with _$InsightsIntraResponseModel {
const factory InsightsIntraResponseModel({
required InsightsIntraDataModel data,
}) = _InsightsIntraResponseModel;
factory InsightsIntraResponseModel.fromJson(Map<String, dynamic> json) =>
_$InsightsIntraResponseModelFromJson(json);
}
@freezed
abstract class InsightsIntraDataModel with _$InsightsIntraDataModel {
const factory InsightsIntraDataModel({required IntraChartModel intra}) =
_InsightsIntraDataModel;
factory InsightsIntraDataModel.fromJson(Map<String, dynamic> json) =>
_$InsightsIntraDataModelFromJson(json);
}