import 'package:flutter/cupertino.dart';
import 'dart:convert';

class ModelCreditCard {
  final String id;
  final String holder_name;
  final String display_number;
  final String description;
  final int month;
  final int year;
  final int cvv;
  final int id_person;

  ModelCreditCard(
      {this.id,
      @required this.holder_name,
      @required this.display_number,
      @required this.month,
      @required this.year,
      @required this.cvv,
      @required this.id_person,
      @required this.description});

  factory ModelCreditCard.fromJson(Map<String, dynamic> json) {
    return ModelCreditCard(
        id: json['id'],
        holder_name: json['data']['holder_name'],
        description: json['description'],
        display_number: json['data']['display_number'],
        month: json['data']['month'],
        year: json['data']['year']);
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['holder_name'] = this.holder_name;
    data['description'] = this.description;
    data['display_number'] = this.display_number;
    data['month'] = this.month;
    data['year'] = this.year;
    data['cvv'] = this.cvv;
    data['id_person'] = this.id_person;

    return data;
  }
}
