forked from eatvio/eatvio_app
chats have been updated to work with consultatons
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@@ -13,8 +14,16 @@ class ChosenPlanModel with _$ChosenPlanModel {
|
||||
@JsonKey(name: 'start_date') required DateTime startDate,
|
||||
@JsonKey(name: 'last_state') required ChosenPlanStateEnum chosenPlanState,
|
||||
@JsonKey(name: 'chat_id') required String chatId,
|
||||
|
||||
@JsonKey(name: 'consultant_id') required int consultantId,
|
||||
@JsonKey(name: 'plan') required PlanModel plan,
|
||||
}) = _ChosenPlanModel;
|
||||
|
||||
factory ChosenPlanModel.fromJson(Map<String, dynamic> json) => _$ChosenPlanModelFromJson(json);
|
||||
}
|
||||
|
||||
ChosenPlanModel? parseChosenPlan(json) {
|
||||
if (json is Map<String, dynamic>) {
|
||||
return ChosenPlanModel.fromJson(json);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -30,6 +30,10 @@ mixin _$ChosenPlanModel {
|
||||
ChosenPlanStateEnum get chosenPlanState => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'chat_id')
|
||||
String get chatId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'consultant_id')
|
||||
int get consultantId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'plan')
|
||||
PlanModel get plan => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this ChosenPlanModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@@ -52,7 +56,11 @@ abstract class $ChosenPlanModelCopyWith<$Res> {
|
||||
@JsonKey(name: 'option_type') String optionType,
|
||||
@JsonKey(name: 'start_date') DateTime startDate,
|
||||
@JsonKey(name: 'last_state') ChosenPlanStateEnum chosenPlanState,
|
||||
@JsonKey(name: 'chat_id') String chatId});
|
||||
@JsonKey(name: 'chat_id') String chatId,
|
||||
@JsonKey(name: 'consultant_id') int consultantId,
|
||||
@JsonKey(name: 'plan') PlanModel plan});
|
||||
|
||||
$PlanModelCopyWith<$Res> get plan;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -75,6 +83,8 @@ class _$ChosenPlanModelCopyWithImpl<$Res, $Val extends ChosenPlanModel>
|
||||
Object? startDate = null,
|
||||
Object? chosenPlanState = null,
|
||||
Object? chatId = null,
|
||||
Object? consultantId = null,
|
||||
Object? plan = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
@@ -97,8 +107,26 @@ class _$ChosenPlanModelCopyWithImpl<$Res, $Val extends ChosenPlanModel>
|
||||
? _value.chatId
|
||||
: chatId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
consultantId: null == consultantId
|
||||
? _value.consultantId
|
||||
: consultantId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
plan: null == plan
|
||||
? _value.plan
|
||||
: plan // ignore: cast_nullable_to_non_nullable
|
||||
as PlanModel,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of ChosenPlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PlanModelCopyWith<$Res> get plan {
|
||||
return $PlanModelCopyWith<$Res>(_value.plan, (value) {
|
||||
return _then(_value.copyWith(plan: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -114,7 +142,12 @@ abstract class _$$ChosenPlanModelImplCopyWith<$Res>
|
||||
@JsonKey(name: 'option_type') String optionType,
|
||||
@JsonKey(name: 'start_date') DateTime startDate,
|
||||
@JsonKey(name: 'last_state') ChosenPlanStateEnum chosenPlanState,
|
||||
@JsonKey(name: 'chat_id') String chatId});
|
||||
@JsonKey(name: 'chat_id') String chatId,
|
||||
@JsonKey(name: 'consultant_id') int consultantId,
|
||||
@JsonKey(name: 'plan') PlanModel plan});
|
||||
|
||||
@override
|
||||
$PlanModelCopyWith<$Res> get plan;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -135,6 +168,8 @@ class __$$ChosenPlanModelImplCopyWithImpl<$Res>
|
||||
Object? startDate = null,
|
||||
Object? chosenPlanState = null,
|
||||
Object? chatId = null,
|
||||
Object? consultantId = null,
|
||||
Object? plan = null,
|
||||
}) {
|
||||
return _then(_$ChosenPlanModelImpl(
|
||||
id: null == id
|
||||
@@ -157,6 +192,14 @@ class __$$ChosenPlanModelImplCopyWithImpl<$Res>
|
||||
? _value.chatId
|
||||
: chatId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
consultantId: null == consultantId
|
||||
? _value.consultantId
|
||||
: consultantId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
plan: null == plan
|
||||
? _value.plan
|
||||
: plan // ignore: cast_nullable_to_non_nullable
|
||||
as PlanModel,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -169,7 +212,9 @@ class _$ChosenPlanModelImpl implements _ChosenPlanModel {
|
||||
@JsonKey(name: 'option_type') required this.optionType,
|
||||
@JsonKey(name: 'start_date') required this.startDate,
|
||||
@JsonKey(name: 'last_state') required this.chosenPlanState,
|
||||
@JsonKey(name: 'chat_id') required this.chatId});
|
||||
@JsonKey(name: 'chat_id') required this.chatId,
|
||||
@JsonKey(name: 'consultant_id') required this.consultantId,
|
||||
@JsonKey(name: 'plan') required this.plan});
|
||||
|
||||
factory _$ChosenPlanModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ChosenPlanModelImplFromJson(json);
|
||||
@@ -189,10 +234,16 @@ class _$ChosenPlanModelImpl implements _ChosenPlanModel {
|
||||
@override
|
||||
@JsonKey(name: 'chat_id')
|
||||
final String chatId;
|
||||
@override
|
||||
@JsonKey(name: 'consultant_id')
|
||||
final int consultantId;
|
||||
@override
|
||||
@JsonKey(name: 'plan')
|
||||
final PlanModel plan;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ChosenPlanModel(id: $id, optionType: $optionType, startDate: $startDate, chosenPlanState: $chosenPlanState, chatId: $chatId)';
|
||||
return 'ChosenPlanModel(id: $id, optionType: $optionType, startDate: $startDate, chosenPlanState: $chosenPlanState, chatId: $chatId, consultantId: $consultantId, plan: $plan)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -207,13 +258,16 @@ class _$ChosenPlanModelImpl implements _ChosenPlanModel {
|
||||
other.startDate == startDate) &&
|
||||
(identical(other.chosenPlanState, chosenPlanState) ||
|
||||
other.chosenPlanState == chosenPlanState) &&
|
||||
(identical(other.chatId, chatId) || other.chatId == chatId));
|
||||
(identical(other.chatId, chatId) || other.chatId == chatId) &&
|
||||
(identical(other.consultantId, consultantId) ||
|
||||
other.consultantId == consultantId) &&
|
||||
(identical(other.plan, plan) || other.plan == plan));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, id, optionType, startDate, chosenPlanState, chatId);
|
||||
int get hashCode => Object.hash(runtimeType, id, optionType, startDate,
|
||||
chosenPlanState, chatId, consultantId, plan);
|
||||
|
||||
/// Create a copy of ChosenPlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -239,7 +293,9 @@ abstract class _ChosenPlanModel implements ChosenPlanModel {
|
||||
@JsonKey(name: 'start_date') required final DateTime startDate,
|
||||
@JsonKey(name: 'last_state')
|
||||
required final ChosenPlanStateEnum chosenPlanState,
|
||||
@JsonKey(name: 'chat_id') required final String chatId}) =
|
||||
@JsonKey(name: 'chat_id') required final String chatId,
|
||||
@JsonKey(name: 'consultant_id') required final int consultantId,
|
||||
@JsonKey(name: 'plan') required final PlanModel plan}) =
|
||||
_$ChosenPlanModelImpl;
|
||||
|
||||
factory _ChosenPlanModel.fromJson(Map<String, dynamic> json) =
|
||||
@@ -260,6 +316,12 @@ abstract class _ChosenPlanModel implements ChosenPlanModel {
|
||||
@override
|
||||
@JsonKey(name: 'chat_id')
|
||||
String get chatId;
|
||||
@override
|
||||
@JsonKey(name: 'consultant_id')
|
||||
int get consultantId;
|
||||
@override
|
||||
@JsonKey(name: 'plan')
|
||||
PlanModel get plan;
|
||||
|
||||
/// Create a copy of ChosenPlanModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
||||
@@ -15,6 +15,8 @@ _$ChosenPlanModelImpl _$$ChosenPlanModelImplFromJson(
|
||||
chosenPlanState:
|
||||
$enumDecode(_$ChosenPlanStateEnumEnumMap, json['last_state']),
|
||||
chatId: json['chat_id'] as String,
|
||||
consultantId: (json['consultant_id'] as num).toInt(),
|
||||
plan: PlanModel.fromJson(json['plan'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ChosenPlanModelImplToJson(
|
||||
@@ -25,6 +27,8 @@ Map<String, dynamic> _$$ChosenPlanModelImplToJson(
|
||||
'start_date': instance.startDate.toIso8601String(),
|
||||
'last_state': _$ChosenPlanStateEnumEnumMap[instance.chosenPlanState]!,
|
||||
'chat_id': instance.chatId,
|
||||
'consultant_id': instance.consultantId,
|
||||
'plan': instance.plan,
|
||||
};
|
||||
|
||||
const _$ChosenPlanStateEnumEnumMap = {
|
||||
|
||||
Reference in New Issue
Block a user