import 'package:hmg_patient_app/core/model/pharmacies/Addresses.dart';
import 'package:hmg_patient_app/core/model/pharmacies/BillingAddress.dart';

class Customer {
  BillingAddress? billingAddress;
  BillingAddress? shippingAddress;
  List<Addresses>? addresses;
  String? fileNumber;
  String? iqamaNumber;
  int? isOutSa;
  int? patientType;
  String? gender;
  String? birthDate;
  String? phone;
  String? countryCode;
  String? yahalaAccountno;
  String? id;
  String? username;
  String? email;
  String? firstName;
  String? lastName;
  String? languageId;
  String? adminComment;
  bool? isTaxExempt;
  bool? hasShoppingCartItems;
  bool? active;
  bool? deleted;
  bool? isSystemAccount;
  String? systemName;
  String? lastIpAddress;
  String? createdOnUtc;
  String? lastLoginDateUtc;
  String? lastActivityDateUtc;
  int? registeredInStoreId;
  List<int>? roleIds;

  Customer(
      {this.billingAddress,
      this.shippingAddress,
      this.addresses,
      this.fileNumber,
      this.iqamaNumber,
      this.isOutSa,
      this.patientType,
      this.gender,
      this.birthDate,
      this.phone,
      this.countryCode,
      this.yahalaAccountno,
      this.id,
      this.username,
      this.email,
      this.firstName,
      this.lastName,
      this.languageId,
      this.adminComment,
      this.isTaxExempt,
      this.hasShoppingCartItems,
      this.active,
      this.deleted,
      this.isSystemAccount,
      this.systemName,
      this.lastIpAddress,
      this.createdOnUtc,
      this.lastLoginDateUtc,
      this.lastActivityDateUtc,
      this.registeredInStoreId,
        this.roleIds});

  Customer.fromJson(Map<String, dynamic> json) {
    billingAddress = json['billing_address'] != null
        ? new BillingAddress.fromJson(json['billing_address'])
        : null;
    shippingAddress = json['shipping_address'] != null
        ? new BillingAddress.fromJson(json['shipping_address'])
        : null;
    if (json['addresses'] != null) {
      addresses =  [];
      json['addresses'].forEach((v) {
        addresses!.add(new Addresses.fromJson(v));
      });
    }
    fileNumber = json['file_number'];
    iqamaNumber = json['iqama_number'];
    isOutSa = json['is_out_sa'];
    patientType = json['patient_type'];
    gender = json['gender'];
    birthDate = json['birth_date'];
    phone = json['phone'];
    countryCode = json['country_code'];
    yahalaAccountno = json['yahala_accountno'];
    id = json['id'];
    username = json['username'];
    email = json['email'];
    firstName = json['first_name'];
    lastName = json['last_name'];
    languageId = json['language_id'];
    adminComment = json['admin_comment'];
    isTaxExempt = json['is_tax_exempt'];
    hasShoppingCartItems = json['has_shopping_cart_items'];
    active = json['active'];
    deleted = json['deleted'];
    isSystemAccount = json['is_system_account'];
    systemName = json['system_name'];
    lastIpAddress = json['last_ip_address'];
    createdOnUtc = json['created_on_utc'];
    lastLoginDateUtc = json['last_login_date_utc'];
    lastActivityDateUtc = json['last_activity_date_utc'];
    registeredInStoreId = json['registered_in_store_id'];
    if (json['role_ids'] != null) {
      roleIds =  [];
      json['role_ids'].forEach((v) {
        roleIds!.add(v);
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.billingAddress != null) {
      data['billing_address'] = this.billingAddress!.toJson();
    }
    if (this.shippingAddress != null) {
      data['shipping_address'] = this.shippingAddress!.toJson();
    }
    if (this.addresses != null) {
      data['addresses'] = this.addresses!.map((v) => v.toJson()).toList();
    }
    data['file_number'] = this.fileNumber;
    data['iqama_number'] = this.iqamaNumber;
    data['is_out_sa'] = this.isOutSa;
    data['patient_type'] = this.patientType;
    data['gender'] = this.gender;
    data['birth_date'] = this.birthDate;
    data['phone'] = this.phone;
    data['country_code'] = this.countryCode;
    data['yahala_accountno'] = this.yahalaAccountno;
    data['id'] = this.id;
    data['username'] = this.username;
    data['email'] = this.email;
    data['first_name'] = this.firstName;
    data['last_name'] = this.lastName;
    data['language_id'] = this.languageId;
    data['admin_comment'] = this.adminComment;
    data['is_tax_exempt'] = this.isTaxExempt;
    data['has_shopping_cart_items'] = this.hasShoppingCartItems;
    data['active'] = this.active;
    data['deleted'] = this.deleted;
    data['is_system_account'] = this.isSystemAccount;
    data['system_name'] = this.systemName;
    data['last_ip_address'] = this.lastIpAddress;
    data['created_on_utc'] = this.createdOnUtc;
    data['last_login_date_utc'] = this.lastLoginDateUtc;
    data['last_activity_date_utc'] = this.lastActivityDateUtc;
    data['registered_in_store_id'] = this.registeredInStoreId;
    data['role_ids'] = this.roleIds;
    return data;
  }
}
