import 'dart:convert';

import 'package:flutter/cupertino.dart';

class ModelDirect {
  final int id;
  final int person_customer_id;
  final String note;
  final int id_event;
  final int id_person_artist;
  final int id_event_artist;
  final double value;

  ModelDirect({
    this.id,
    this.person_customer_id,
    this.note,
    this.id_event,
    this.id_person_artist,
    this.id_event_artist,
    this.value,
  });

  factory ModelDirect.fromJson(Map<String, dynamic> json) {
    return ModelDirect(
      id: json['id'],
      value: double.tryParse(json['value'].toString()),
      person_customer_id: json['id_person_customer']['id'],
      note: json['note'],
    );
  }

  String toJson() => json.encode({
        'id': this.id,
        'id_person_customer': this.person_customer_id,
        'id_event': this.id_event,
        'id_person_artist': this.id_person_artist,
        'id_event_artist': this.id_event_artist,
        'value': this.value,
        'note': this.note,
      });

  String toJsonNew() => json.encode({
        'id_person_customer': this.person_customer_id,
        'id_event': this.id_event,
        'id_person_artist': this.id_person_artist,
        'id_event_artist': this.id_event_artist,
        'value': this.value,
        'note': this.note,
      });

  Map<String, dynamic> toJson2() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['id_person_customer'] = this.person_customer_id;
    data['id_event'] = this.id_event;
    data['id_person_artist'] = this.id_person_artist;
    data['id_event_artist'] = this.id_event_artist;
    data['value'] = this.value;
    data['note'] = this.note;

    return data;
  }

  Map<String, dynamic> toJsonNew2() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id_person_customer'] = this.person_customer_id;
    data['id_event'] = this.id_event;
    data['id_person_artist'] = this.id_person_artist;
    data['id_event_artist'] = this.id_event_artist;
    data['value'] = this.value;
    data['note'] = this.note;

    return data;
  }
}
