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

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

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

NoticeBoardDocumentsList $NoticeBoardDocumentsListFromJson(Map<String, dynamic> json) {
  final NoticeBoardDocumentsList noticeBoardDocumentsList = NoticeBoardDocumentsList();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    noticeBoardDocumentsList.id = id;
  }
  final int? parentId = jsonConvert.convert<int>(json['parent_id']);
  if (parentId != null) {
    noticeBoardDocumentsList.parentId = parentId;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    noticeBoardDocumentsList.name = name;
  }
  final String? url = jsonConvert.convert<String>(json['url']);
  if (url != null) {
    noticeBoardDocumentsList.url = url;
  }
  return noticeBoardDocumentsList;
}

Map<String, dynamic> $NoticeBoardDocumentsListToJson(NoticeBoardDocumentsList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['parent_id'] = entity.parentId;
  data['name'] = entity.name;
  data['url'] = entity.url;
  return data;
}

extension NoticeBoardDocumentsListExtension on NoticeBoardDocumentsList {
  NoticeBoardDocumentsList copyWith({
    int? id,
    int? parentId,
    String? name,
    String? url,
  }) {
    return NoticeBoardDocumentsList()
      ..id = id ?? this.id
      ..parentId = parentId ?? this.parentId
      ..name = name ?? this.name
      ..url = url ?? this.url;
  }
}