Data Model

 avatar
unknown
dart
3 years ago
9.4 kB
7
Indexable
// To parse this JSON data, do
//
//     final detailProfileModel = detailProfileModelFromJson(jsonString);

import 'dart:convert';

DetailProfileModel detailProfileModelFromJson(String str) =>
    DetailProfileModel.fromJson(json.decode(str));

String detailProfileModelToJson(DetailProfileModel data) =>
    json.encode(data.toJson());

class DetailProfileModel {
  DetailProfileModel({
    this.sukses,
    this.message,
    this.data,
  });

  bool sukses;
  String message;
  Data data;

  factory DetailProfileModel.fromJson(Map<String, dynamic> json) =>
      DetailProfileModel(
        sukses: json["sukses"],
        message: json["message"],
        data: Data.fromJson(json["data"]),
      );

  Map<String, dynamic> toJson() => {
        "sukses": sukses,
        "message": message,
        "data": data.toJson(),
      };

  @override
  String toString() {
    return 'DetailProfileModel{sukses: $sukses, message: $message, data: $data}';
  }
}

class Data {
  Data({
    this.numberid,
    this.email,
    this.fullname,
    this.birthdate,
    this.gender,
    this.phone,
    this.photo,
    this.role,
    this.joinDate,
    this.prodi,
    this.angkatan,
    this.linkCv,
    this.about,
    this.workStatus,
    this.skills,
    this.schools,
    this.organization,
    this.experiences,
    this.awards,
    this.interests,
    this.city,
  });

  String numberid;
  dynamic email;
  String fullname;
  dynamic birthdate;
  dynamic gender;
  dynamic phone;
  String photo;
  String role;
  DateTime joinDate;
  dynamic prodi;
  dynamic angkatan;
  dynamic linkCv;
  dynamic about;
  dynamic workStatus;
  List<Skill> skills;
  List<School> schools;
  List<dynamic> organization;
  List<Experience> experiences;
  List<Award> awards;
  List<InterestElement> interests;
  List<CityElement> city;

  factory Data.fromJson(Map<String, dynamic> json) => Data(
        numberid: json["numberid"],
        email: json["email"],
        fullname: json["fullname"],
        birthdate: json["birthdate"],
        gender: json["gender"],
        phone: json["phone"],
        photo: json["photo"],
        role: json["role"],
        joinDate: DateTime.parse(json["join_date"]),
        prodi: json["prodi"],
        angkatan: json["angkatan"],
        linkCv: json["link_cv"],
        about: json["about"],
        workStatus: json["work_status"],
        skills: List<Skill>.from(json["skills"].map((x) => Skill.fromJson(x))),
        schools:
            List<School>.from(json["schools"].map((x) => School.fromJson(x))),
        organization: List<dynamic>.from(json["organization"].map((x) => x)),
        experiences: List<Experience>.from(
            json["experiences"].map((x) => Experience.fromJson(x))),
        awards: List<Award>.from(json["awards"].map((x) => Award.fromJson(x))),
        interests: List<InterestElement>.from(
            json["interests"].map((x) => InterestElement.fromJson(x))),
        city: List<CityElement>.from(
            json["city"].map((x) => CityElement.fromJson(x))),
      );

  Map<String, dynamic> toJson() => {
        "numberid": numberid,
        "email": email,
        "fullname": fullname,
        "birthdate": birthdate,
        "gender": gender,
        "phone": phone,
        "photo": photo,
        "role": role,
        "join_date": joinDate.toIso8601String(),
        "prodi": prodi,
        "angkatan": angkatan,
        "link_cv": linkCv,
        "about": about,
        "work_status": workStatus,
        "skills": List<dynamic>.from(skills.map((x) => x.toJson())),
        "schools": List<dynamic>.from(schools.map((x) => x.toJson())),
        "organization": List<dynamic>.from(organization.map((x) => x)),
        "experiences": List<dynamic>.from(experiences.map((x) => x.toJson())),
        "awards": List<dynamic>.from(awards.map((x) => x.toJson())),
        "interests": List<dynamic>.from(interests.map((x) => x.toJson())),
        "city": List<dynamic>.from(city.map((x) => x.toJson())),
      };

  @override
  String toString() {
    return 'Data{numberid: $numberid, email: $email, fullname: $fullname, birthdate: $birthdate, gender: $gender, phone: $phone, photo: $photo, role: $role, joinDate: $joinDate, prodi: $prodi, angkatan: $angkatan, linkCv: $linkCv, about: $about, workStatus: $workStatus, skills: $skills, schools: $schools, organization: $organization, experiences: $experiences, awards: $awards, interests: $interests, city: $city}';
  }
}

class Award {
  Award({
    this.id,
    this.name,
    this.issuer,
    this.year,
    this.description,
  });

  int id;
  String name;
  String issuer;
  String year;
  String description;

  factory Award.fromJson(Map<String, dynamic> json) => Award(
        id: json["id"],
        name: json["name"],
        issuer: json["issuer"],
        year: json["year"],
        description: json["description"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "name": name,
        "issuer": issuer,
        "year": year,
        "description": description,
      };

  @override
  String toString() {
    return 'Award{id: $id, name: $name, issuer: $issuer, year: $year, description: $description}';
  }
}

class CityElement {
  CityElement({
    this.id,
    this.city,
  });

  int id;
  CityCity city;

  factory CityElement.fromJson(Map<String, dynamic> json) => CityElement(
        id: json["id"],
        city: CityCity.fromJson(json["city"]),
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "city": city.toJson(),
      };

  @override
  String toString() {
    return 'CityElement{id: $id, city: $city}';
  }
}

class CityCity {
  CityCity({
    this.id,
    this.regencies,
  });

  String id;
  String regencies;

  factory CityCity.fromJson(Map<String, dynamic> json) => CityCity(
        id: json["id"],
        regencies: json["regencies"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "regencies": regencies,
      };

  @override
  String toString() {
    return 'CityCity{id: $id, regencies: $regencies}';
  }
}

class Experience {
  Experience({
    this.id,
    this.company,
    this.title,
    this.startDate,
    this.description,
  });

  int id;
  String company;
  String title;
  String startDate;
  String description;

  factory Experience.fromJson(Map<String, dynamic> json) => Experience(
        id: json["id"],
        company: json["company"],
        title: json["title"],
        startDate: json["start_date"],
        description: json["description"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "company": company,
        "title": title,
        "start_date": startDate,
        "description": description,
      };

  @override
  String toString() {
    return 'Experience{id: $id, company: $company, title: $title, startDate: $startDate, description: $description}';
  }
}

class InterestElement {
  InterestElement({
    this.id,
    this.interest,
  });

  int id;
  InterestInterest interest;

  factory InterestElement.fromJson(Map<String, dynamic> json) =>
      InterestElement(
        id: json["id"],
        interest: InterestInterest.fromJson(json["interest"]),
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "interest": interest.toJson(),
      };
  @override
  String toString() {
    return 'InterestElement{id: $id, interest: $interest}';
  }
}

class InterestInterest {
  InterestInterest({
    this.name,
  });

  String name;

  factory InterestInterest.fromJson(Map<String, dynamic> json) =>
      InterestInterest(
        name: json["name"],
      );

  Map<String, dynamic> toJson() => {
        "name": name,
      };

  @override
  String toString() {
    return 'InterestInterest{name: $name}';
  }
}

class School {
  School({
    this.id,
    this.nama,
    this.jurusan,
    this.tahunMasuk,
    this.tahunKeluar,
  });

  int id;
  String nama;
  String jurusan;
  String tahunMasuk;
  String tahunKeluar;

  factory School.fromJson(Map<String, dynamic> json) => School(
        id: json["id"],
        nama: json["nama"],
        jurusan: json["jurusan"],
        tahunMasuk: json["tahun_masuk"],
        tahunKeluar: json["tahun_keluar"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "nama": nama,
        "jurusan": jurusan,
        "tahun_masuk": tahunMasuk,
        "tahun_keluar": tahunKeluar,
      };

  @override
  String toString() {
    return 'School{id: $id, nama: $nama, jurusan: $jurusan, tahunMasuk: $tahunMasuk, tahunKeluar: $tahunKeluar}';
  }
}

class Skill {
  Skill({
    this.id,
    this.skill,
    this.level,
  });

  int id;
  String skill;
  String level;

  factory Skill.fromJson(Map<String, dynamic> json) => Skill(
        id: json["id"],
        skill: json["skill"],
        level: json["level"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "skill": skill,
        "level": level,
      };

  @override
  String toString() {
    return 'Skill{id: $id, skill: $skill, level: $level}';
  }
}
Editor is loading...