import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/feedback_detail_entity.dart'; import 'package:domain/entity/id_name_entity.dart'; FeedbackDetailEntity $FeedbackDetailEntityFromJson(Map json) { final FeedbackDetailEntity feedbackDetailEntity = FeedbackDetailEntity(); final String? id = jsonConvert.convert(json['id']); if (id != null) { feedbackDetailEntity.id = id; } final String? title = jsonConvert.convert(json['title']); if (title != null) { feedbackDetailEntity.title = title; } final String? content = jsonConvert.convert(json['content']); if (content != null) { feedbackDetailEntity.content = content; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { feedbackDetailEntity.resources = resources; } final int? status = jsonConvert.convert(json['status']); if (status != null) { feedbackDetailEntity.status = status; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { feedbackDetailEntity.createdAt = createdAt; } final IdNameEntity? category = jsonConvert.convert(json['category']); if (category != null) { feedbackDetailEntity.category = category; } final List? replies = (json['replies'] as List?)?.map( (e) => jsonConvert.convert(e) as FeedbackDetailReplies).toList(); if (replies != null) { feedbackDetailEntity.replies = replies; } return feedbackDetailEntity; } Map $FeedbackDetailEntityToJson(FeedbackDetailEntity entity) { final Map data = {}; data['id'] = entity.id; data['title'] = entity.title; data['content'] = entity.content; data['resources'] = entity.resources; data['status'] = entity.status; data['created_at'] = entity.createdAt; data['category'] = entity.category?.toJson(); data['replies'] = entity.replies?.map((v) => v.toJson()).toList(); return data; } extension FeedbackDetailEntityExtension on FeedbackDetailEntity { FeedbackDetailEntity copyWith({ String? id, String? title, String? content, List? resources, int? status, String? createdAt, IdNameEntity? category, List? replies, }) { return FeedbackDetailEntity() ..id = id ?? this.id ..title = title ?? this.title ..content = content ?? this.content ..resources = resources ?? this.resources ..status = status ?? this.status ..createdAt = createdAt ?? this.createdAt ..category = category ?? this.category ..replies = replies ?? this.replies; } } FeedbackDetailReplies $FeedbackDetailRepliesFromJson(Map json) { final FeedbackDetailReplies feedbackDetailReplies = FeedbackDetailReplies(); final String? id = jsonConvert.convert(json['id']); if (id != null) { feedbackDetailReplies.id = id; } final String? content = jsonConvert.convert(json['content']); if (content != null) { feedbackDetailReplies.content = content; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { feedbackDetailReplies.resources = resources; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { feedbackDetailReplies.createdAt = createdAt; } final IdNameEntity? accountable = jsonConvert.convert(json['accountable']); if (accountable != null) { feedbackDetailReplies.accountable = accountable; } return feedbackDetailReplies; } Map $FeedbackDetailRepliesToJson(FeedbackDetailReplies entity) { final Map data = {}; data['id'] = entity.id; data['content'] = entity.content; data['resources'] = entity.resources; data['created_at'] = entity.createdAt; data['accountable'] = entity.accountable?.toJson(); return data; } extension FeedbackDetailRepliesExtension on FeedbackDetailReplies { FeedbackDetailReplies copyWith({ String? id, String? content, List? resources, String? createdAt, IdNameEntity? accountable, }) { return FeedbackDetailReplies() ..id = id ?? this.id ..content = content ?? this.content ..resources = resources ?? this.resources ..createdAt = createdAt ?? this.createdAt ..accountable = accountable ?? this.accountable; } }