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

NoticeBoardEventEntity $NoticeBoardEventEntityFromJson(Map<String, dynamic> json) {
  final NoticeBoardEventEntity noticeBoardEventEntity = NoticeBoardEventEntity();
  final int? count = jsonConvert.convert<int>(json['count']);
  if (count != null) {
    noticeBoardEventEntity.count = count;
  }
  final int? page = jsonConvert.convert<int>(json['page']);
  if (page != null) {
    noticeBoardEventEntity.page = page;
  }
  final int? limit = jsonConvert.convert<int>(json['limit']);
  if (limit != null) {
    noticeBoardEventEntity.limit = limit;
  }
  final int? countPage = jsonConvert.convert<int>(json['count_page']);
  if (countPage != null) {
    noticeBoardEventEntity.countPage = countPage;
  }
  final List<NoticeBoardEventList>? list = (json['list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<NoticeBoardEventList>(e) as NoticeBoardEventList).toList();
  if (list != null) {
    noticeBoardEventEntity.list = list;
  }
  return noticeBoardEventEntity;
}

Map<String, dynamic> $NoticeBoardEventEntityToJson(NoticeBoardEventEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['count'] = entity.count;
  data['page'] = entity.page;
  data['limit'] = entity.limit;
  data['count_page'] = entity.countPage;
  data['list'] = entity.list.map((v) => v.toJson()).toList();
  return data;
}

extension NoticeBoardEventEntityExtension on NoticeBoardEventEntity {
  NoticeBoardEventEntity copyWith({
    int? count,
    int? page,
    int? limit,
    int? countPage,
    List<NoticeBoardEventList>? list,
  }) {
    return NoticeBoardEventEntity()
      ..count = count ?? this.count
      ..page = page ?? this.page
      ..limit = limit ?? this.limit
      ..countPage = countPage ?? this.countPage
      ..list = list ?? this.list;
  }
}

NoticeBoardEventList $NoticeBoardEventListFromJson(Map<String, dynamic> json) {
  final NoticeBoardEventList noticeBoardEventList = NoticeBoardEventList();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    noticeBoardEventList.id = id;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    noticeBoardEventList.title = title;
  }
  final String? datetime = jsonConvert.convert<String>(json['datetime']);
  if (datetime != null) {
    noticeBoardEventList.datetime = datetime;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    noticeBoardEventList.createdAt = createdAt;
  }
  return noticeBoardEventList;
}

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

extension NoticeBoardEventListExtension on NoticeBoardEventList {
  NoticeBoardEventList copyWith({
    int? id,
    String? title,
    String? datetime,
    String? createdAt,
  }) {
    return NoticeBoardEventList()
      ..id = id ?? this.id
      ..title = title ?? this.title
      ..datetime = datetime ?? this.datetime
      ..createdAt = createdAt ?? this.createdAt;
  }
}