import 'package:sport/services/Converter.dart';

class SportTarget {
  int id;
  String name;
  String intension;
  int duration;
  int consume;
  String fitPeople;
  int sort;
  int userId;

  SportTarget(
      {this.id,
        this.name,
        this.intension,
        this.duration,
        this.consume,
        this.fitPeople,
        this.sort,
        this.userId});

  SportTarget.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    intension = json['intension'];
    duration = json['duration'];
    consume = json['consume'];
    fitPeople = json['fit_people'];
    sort = json['sort'];
    userId = Converter.toInt(json['user_id']);
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['intension'] = this.intension;
    data['duration'] = this.duration;
    data['consume'] = this.consume;
    data['fit_people'] = this.fitPeople;
    data['sort'] = this.sort;
    data['user_id'] = this.userId;
    return data;
  }
}