

import 'package:flutter/cupertino.dart';

class ModelEvent {
  final int id;
  final String note;
  final String person_spot_name;
  final String date_event;
  final int person_spot_id;

  ModelEvent(
      { this.id,
        @required this.note,
        @required this.person_spot_name,
        @required this.person_spot_id,
        @required this.date_event});

  factory ModelEvent.fromJson(Map<String, dynamic> json) {
    return ModelEvent(
        id: json['id'],
        note: json['note'],
        person_spot_name: json['id_person_spot']['name'],
        person_spot_id: json['id_person_spot']['id'],
        date_event: json['date_event']);
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['date_event'] = this.date_event;
    data['id_person_spot'] = this.person_spot_id.toString();
    data['note'] = this.note;
    return data;
  }

  Map<String, dynamic> toJsonNew() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['date_event'] = this.date_event;
    data['id_person_spot'] = this.person_spot_id.toString();
    data['note'] = this.note;
    return data;
  }
}