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

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

Map<String, dynamic> $NoticeBoardAnnounEntityToJson(NoticeBoardAnnounEntity 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 NoticeBoardAnnounEntityExtension on NoticeBoardAnnounEntity {
  NoticeBoardAnnounEntity copyWith({
    int? count,
    int? page,
    int? limit,
    int? countPage,
    List<NoticeBoardAnnounList>? list,
  }) {
    return NoticeBoardAnnounEntity()
      ..count = count ?? this.count
      ..page = page ?? this.page
      ..limit = limit ?? this.limit
      ..countPage = countPage ?? this.countPage
      ..list = list ?? this.list;
  }
}

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

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

extension NoticeBoardAnnounListExtension on NoticeBoardAnnounList {
  NoticeBoardAnnounList copyWith({
    int? id,
    String? title,
    String? createdAt,
  }) {
    return NoticeBoardAnnounList()
      ..id = id ?? this.id
      ..title = title ?? this.title
      ..createdAt = createdAt ?? this.createdAt;
  }
}