import 'package:domain/generated/json/base/json_convert_content.dart';
import 'package:domain/entity/notice_board_event_detail_entity.dart';

NoticeBoardEventDetailEntity $NoticeBoardEventDetailEntityFromJson(Map<String, dynamic> json) {
  final NoticeBoardEventDetailEntity noticeBoardEventDetailEntity = NoticeBoardEventDetailEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    noticeBoardEventDetailEntity.id = id;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    noticeBoardEventDetailEntity.title = title;
  }
  final String? datetime = jsonConvert.convert<String>(json['datetime']);
  if (datetime != null) {
    noticeBoardEventDetailEntity.datetime = datetime;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    noticeBoardEventDetailEntity.content = content;
  }
  final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (resources != null) {
    noticeBoardEventDetailEntity.resources = resources;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    noticeBoardEventDetailEntity.createdAt = createdAt;
  }
  return noticeBoardEventDetailEntity;
}

Map<String, dynamic> $NoticeBoardEventDetailEntityToJson(NoticeBoardEventDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['title'] = entity.title;
  data['datetime'] = entity.datetime;
  data['content'] = entity.content;
  data['resources'] = entity.resources;
  data['created_at'] = entity.createdAt;
  return data;
}

extension NoticeBoardEventDetailEntityExtension on NoticeBoardEventDetailEntity {
  NoticeBoardEventDetailEntity copyWith({
    int? id,
    String? title,
    String? datetime,
    String? content,
    List<String>? resources,
    String? createdAt,
  }) {
    return NoticeBoardEventDetailEntity()
      ..id = id ?? this.id
      ..title = title ?? this.title
      ..datetime = datetime ?? this.datetime
      ..content = content ?? this.content
      ..resources = resources ?? this.resources
      ..createdAt = createdAt ?? this.createdAt;
  }
}