import 'models.dart';

class SimpleAttributeModel {
  late SimpleAttribute attribute;
  late List<SimpleOption> options;

  SimpleAttributeModel({
    required this.attribute,
    required this.options,
  });

  SimpleAttributeModel.fromJson(Map<String, dynamic> json) {
    attribute = (json['attribute'] != null ? new SimpleAttribute.fromJson(json['attribute']) : null)!;
    if (json['options'] != null) {
      options = <SimpleOption>[];
      json['options'].forEach((v) {
        options.add(new SimpleOption.fromJson(v));
      });
    }
  }
}

class SimpleAttribute {
  late int id;
  late String code;
  late String name;

  SimpleAttribute({
    required this.id,
    required this.code,
    required this.name,
  });

  SimpleAttribute.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    code = json['code'];
    name = json['name'];
  }
}

class SimpleOption {
  late String option;
  late List<ProductImage> images;
  late ProductModel product;

  SimpleOption({
    required this.option,
    required this.images,
    required this.product,
  });

  SimpleOption.fromJson(Map<String, dynamic> json) {
    option = json['option'];
    if (json['images'] != null) {
      images = <ProductImage>[];
      json['images'].forEach((v) {
        images.add(new ProductImage.fromJson(v));
      });
    }
    product = (json['product'] != null ? new ProductModel.fromJson(json['product']) : null)!;
  }
}
