class PharmacyCategorise {
  dynamic id;
  String? name;
  dynamic namen;
  List<LocalizedNames>? localizedNames;
  dynamic description;
  dynamic parentCategoryId;
  dynamic displayOrder;
  dynamic image;
  dynamic isLeaf;

  PharmacyCategorise({this.id, this.name, this.namen, this.localizedNames, this.description, this.parentCategoryId, this.displayOrder, this.image, this.isLeaf});

  PharmacyCategorise.fromJson(Map<String, dynamic> json) {
    try {
      id = json['id'];
      name = json['name'];
      namen = json['namen'];
      if (json['localized_names'] != null) {
        localizedNames = [];
        json['localized_names'].forEach((v) {
          localizedNames!.add(new LocalizedNames.fromJson(v));
        });
      }
      description = json['description'];
      parentCategoryId = json['parent_category_id'];
      displayOrder = json['display_order'];
      image = json['image'] != null ? new Image.fromJson(json['image']) : null;
      isLeaf = json['is_leaf'];
    } catch (e) {
      print(e);
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['namen'] = this.namen;
    if (this.localizedNames != null) {
      data['localized_names'] = this.localizedNames!.map((v) => v.toJson()).toList();
    }
    data['description'] = this.description;
    data['parent_category_id'] = this.parentCategoryId;
    data['display_order'] = this.displayOrder;
    if (this.image != null) {
      data['image'] = this.image.toJson();
    }
    data['is_leaf'] = this.isLeaf;
    return data;
  }
}

class LocalizedNames {
  int? languageId;
  String? localizedName;

  LocalizedNames({this.languageId, this.localizedName});

  LocalizedNames.fromJson(Map<String, dynamic> json) {
    languageId = json['language_id'];
    localizedName = json['localized_name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['language_id'] = this.languageId;
    data['localized_name'] = this.localizedName;
    return data;
  }
}

class Image {
  String? src;
  dynamic thumb;
  dynamic attachment;

  Image({this.src, this.thumb, this.attachment});

  Image.fromJson(Map<String, dynamic> json) {
    src = json['src'];
    thumb = json['thumb'];
    attachment = json['attachment'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['src'] = this.src;
    data['thumb'] = this.thumb;
    data['attachment'] = this.attachment;
    return data;
  }
}
