import 'package:hmg_patient_app/generated/json/base/json_convert_content.dart';
import 'package:hmg_patient_app/generated/json/base/json_field.dart';

class PackagesCategoriesResponseModel extends JsonConvert<PackagesCategoriesResponseModel> {
  int? id;
  String? name;
  String? namen;
  @JSONField(name: "localized_names")
  List<OfferCategoriesResponseModelLocalizedName>? localizedNames;
  dynamic description;
  @JSONField(name: "category_template_id")
  int? categoryTemplateId;
  @JSONField(name: "meta_keywords")
  String? metaKeywords;
  @JSONField(name: "meta_description")
  String? metaDescription;
  @JSONField(name: "meta_title")
  String? metaTitle;
  @JSONField(name: "parent_category_id")
  int? parentCategoryId;
  @JSONField(name: "page_size")
  int? pageSize;
  @JSONField(name: "page_size_options")
  String? pageSizeOptions;
  @JSONField(name: "price_ranges")
  dynamic priceRanges;
  @JSONField(name: "show_on_home_page")
  bool? showOnHomePage;
  @JSONField(name: "include_in_top_menu")
  bool? includeInTopMenu;
  @JSONField(name: "has_discounts_applied")
  dynamic hasDiscountsApplied;
  bool? published;
  bool? deleted;
  @JSONField(name: "display_order")
  int? displayOrder;
  @JSONField(name: "created_on_utc")
  String? createdOnUtc;
  @JSONField(name: "updated_on_utc")
  String? updatedOnUtc;
  @JSONField(name: "role_ids")
  List<dynamic>? roleIds;
  @JSONField(name: "discount_ids")
  List<dynamic>? discountIds;
  @JSONField(name: "store_ids")
  List<dynamic>? storeIds;
  OfferCategoriesResponseModelImage? image;
  @JSONField(name: "se_name")
  String? seName;
  @JSONField(name: "is_leaf")
  bool? isLeaf;

  @override
  String toString() {
    if(localizedNames!.length == 2){
      if(localizedNames!.first.languageId == 1)
        return localizedNames?.first.localizedName ?? name.toString();

      else if(localizedNames?.first.languageId == 2)
        return localizedNames?.last.localizedName ?? name.toString();
    }
    return name.toString();
  }
}

class OfferCategoriesResponseModelLocalizedName extends JsonConvert<OfferCategoriesResponseModelLocalizedName> {
  @JSONField(name: "language_id")
  int? languageId;
  @JSONField(name: "localized_name")
  String? localizedName;
}

class OfferCategoriesResponseModelImage extends JsonConvert<OfferCategoriesResponseModelImage> {
  String? src;
  dynamic thumb;
  dynamic attachment;
}
