import 'package:hmg_patient_app/models/Authentication/authenticated_user.dart';
import 'package:hmg_patient_app/uitl/date_uitl.dart';
import 'package:flutter/cupertino.dart';

class PackagesCustomerRequestModel {

  String? username;
  String? first_name;
  String? last_name;
  String? email;
  String? phone;
  String? national_id;
  String? date_of_birth;


  PackagesCustomerRequestModel.fromUser(AuthenticatedUser user){
    this.username =  "${user.patientID}";
    this.first_name = user.firstName;
    this.last_name = user.lastName;
    this.email = user.emailAddress;
    this.phone = user.mobileNumber;
    this.national_id = user.patientIdentificationNo;

    String isoDateTime = DateUtil.getISODateFormat(user.dateofBirthDataTime!);
    this.date_of_birth = isoDateTime;
  }

  Map<String, dynamic> json() {
    return {
      "customer" : {
        "email": email ?? '',
        "username": username ?? '',
        "national_id": national_id ?? '',
        "phone": phone ?? '',
        "date_of_birth": date_of_birth ?? '',
        "first_name": first_name ?? '',
        "last_name": last_name ?? '',
        // "addresses": [{
        //   "email": email,
        //   "phone_number": phoneNumber
        // }]
      }
    };
  }
}