// To parse this JSON data, do
//
//     final brand = brandFromJson(jsonString);

import 'dart:convert';

List<Brand> brandFromJson(String str) => List<Brand>.from(json.decode(str).map((x) => Brand.fromJson(x)));

String brandToJson(List<Brand> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));

class Brand {
  Brand({
    this.id,
    this.name,
    this.namen,
    this.localizedNames,
    this.description,
    this.manufacturerTemplateId,
    this.metaKeywords,
    this.metaDescription,
    this.metaTitle,
    this.pageSize,
    this.pageSizeOptions,
    this.priceRanges,
    this.published,
    this.deleted,
    this.displayOrder,
    this.createdOnUtc,
    this.updatedOnUtc,
    this.image,
  });

  String? id;
  String? name;
  String? namen;
  List<LocalizedName>? localizedNames;
  String? description;
  int? manufacturerTemplateId;
  String? metaKeywords;
  dynamic metaDescription;
  dynamic metaTitle;
  int? pageSize;
  String? pageSizeOptions;
  dynamic priceRanges;
  bool? published;
  bool? deleted;
  int? displayOrder;
  DateTime? createdOnUtc;
  DateTime? updatedOnUtc;
  Image? image;

  factory Brand.fromJson(Map<String, dynamic> json) => Brand(
    id: json["id"],
    name: json["name"],
    namen: json["namen"],
    localizedNames: List<LocalizedName>.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))),
    description: json["description"] == null ? null : json["description"],
    manufacturerTemplateId: json["manufacturer_template_id"],
    metaKeywords: json["meta_keywords"],
    metaDescription: json["meta_description"],
    metaTitle: json["meta_title"],
    pageSize: json["page_size"],
    pageSizeOptions: json["page_size_options"],
    priceRanges: json["price_ranges"],
    published: json["published"],
    deleted: json["deleted"],
    displayOrder: json["display_order"],
    createdOnUtc: DateTime.parse(json["created_on_utc"]),
    updatedOnUtc: DateTime.parse(json["updated_on_utc"]),
    image: json["image"] == null ? null : Image.fromJson(json["image"]),
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "name": name,
    "namen": namen,
    "localized_names": List<dynamic>.from(localizedNames!.map((x) => x.toJson())),
    "description": description == null ? null : description,
    "manufacturer_template_id": manufacturerTemplateId,
    "meta_keywords": metaKeywords,
    "meta_description": metaDescription,
    "meta_title": metaTitle,
    "page_size": pageSize,
    "page_size_options": pageSizeOptions,
    "price_ranges": priceRanges,
    "published": published,
    "deleted": deleted,
    "display_order": displayOrder,
    "created_on_utc": createdOnUtc!.toIso8601String(),
    "updated_on_utc": updatedOnUtc!.toIso8601String(),
    "image": image == null ? null : image!.toJson(),
  };
}

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

  String? src;
  dynamic thumb;
  dynamic attachment;

  factory Image.fromJson(Map<String, dynamic> json) => Image(
    src: json["src"],
    thumb: json["thumb"],
    attachment: json["attachment"],
  );

  Map<String, dynamic> toJson() => {
    "src": src,
    "thumb": thumb,
    "attachment": attachment,
  };
}

class LocalizedName {
  LocalizedName({
    this.languageId,
    this.localizedName,
  });

  int? languageId;
  String? localizedName;

  factory LocalizedName.fromJson(Map<String, dynamic> json) => LocalizedName(
    languageId: json["language_id"],
    localizedName: json["localized_name"],
  );

  Map<String, dynamic> toJson() => {
    "language_id": languageId,
    "localized_name": localizedName,
  };
}
