import 'package:boilerplate/domain/entities/categories/categories_data.dart';
import 'package:boilerplate/domain/entities/categories/intellectual_type_data.dart';
import 'package:boilerplate/domain/entities/product/product_data.dart';
import 'package:json_annotation/json_annotation.dart';

import 'get_product_list_res_model.dart';

part 'get_product_detail_res_model.g.dart';

@JsonSerializable(createToJson: false)
class GetProductDetailResModel {
  final GetProductDetailResultResModel result;

  GetProductDetailResModel(this.result);

  factory GetProductDetailResModel.fromJson(json) =>
      _$GetProductDetailResModelFromJson(json);
}

@JsonSerializable(createToJson: false)
class GetProductDetailResultResModel extends ProductData {
  final GetProductDetailStoreResModel? store;
  final List<GetProductImagesResModel>? images;
  final List<GetProductDetailCategoryResModel>? category;
  // final List<GetProductDetailDipRegisInfoResModel>? detailDipRegisInfoResModel;
  final GetProductDetailIntellectureTypeResModel? intellectual_type;
  @JsonKey(defaultValue: [])
  final List<GetProductDetailRelateDataResModel> relate_data;


  GetProductDetailResultResModel( {
    super.id,
    super.urlCode,
    super.name,
    super.cover,
    super.excerpt,
    super.detail,
    super.price,
    super.specialPrice,
    super.sku,
    super.tax,
    super.quantity,
    super.size,
    super.visibility,
    super.newsFromDate,
    super.newsToDate,
    super.layout,
    super.theme,
    super.duration,
    super.sellingStartTime,
    super.sellingEndTime,
    super.redemptionStartTime,
    super.redemptionEndTime,
    super.availibility,
    super.isFeatured,
    super.isDeal,
    super.reviewStatus,
    super.relatedStatus,
    super.upSellsStatus,
    super.crossSellsStatus,
    super.allowGiftMessage,
    super.stockStatus,
    super.status,
    super.dimension,
    super.groupId,
    super.tags,
    super.attributeSet,
    super.vendorId,
    super.allowRoute,
    super.type,
    super.createdAt,
    super.updatedAt,
    super.createdDate,
    super.updatedDate,
    super.createBy,
    super.updatedBy,
    super.groupData,
    super.address,
    super.industryGroup,
    super.objectiveSale,
    super.storeId,
    super.location,
    super.target,
    // this.detailDipRegisInfoResModel,
    this.store,
    this.images,
    this.category,
    this.intellectual_type,
    super.contractType,
    required this.relate_data,
  }) : super(
          images: images,
          store: store,
          category: category,
          intellectualType: intellectual_type,
          relateData: relate_data,
    // dipRegisInfo: detailDipRegisInfoResModel,
        );

  factory GetProductDetailResultResModel.fromJson(json) =>
      _$GetProductDetailResultResModelFromJson(json);
}

@JsonSerializable(createToJson: false)
class GetProductDetailStoreResModel extends ProductStoreData {
  GetProductDetailStoreResModel(super.email, super.phone, super.id);

  factory GetProductDetailStoreResModel.fromJson(json) =>
      _$GetProductDetailStoreResModelFromJson(json);
}

@JsonSerializable(createToJson: false)
class GetProductDetailCategoryResModel extends CategoriesData {
  GetProductDetailCategoryResModel(
    super.id,
    super.parentId,
    super.name,
    super.code,
    super.link,
    super.detail,
    super.type,
    super.status,
    super.sortOrder,
    super.group,
    super.level,
    super.createdAt,
    super.updatedAt,
    super.cover,
  );

  factory GetProductDetailCategoryResModel.fromJson(json) =>
      _$GetProductDetailCategoryResModelFromJson(json);
}
// @JsonSerializable(createToJson: false)
// class GetProductDetailDipRegisInfoResModel extends ProductDipRegisInfoData {
//   GetProductDetailDipRegisInfoResModel(
//       super.requestNumber,
//       super.requestDate,
//       super.expireDate,
//       super.name,
//       super.requestName,
//       super.addressOfRequestName,
//       super.certificateNumber,
//       super.certificateDate,
//
//       );
//
//   factory GetProductDetailDipRegisInfoResModel.fromJson(json) =>
//       _$GetProductDetailDipRegisInfoResModelFromJson(json);
// }

@JsonSerializable(createToJson: false)
class GetProductDetailIntellectureTypeResModel extends IntellectualTypeData {
  GetProductDetailIntellectureTypeResModel(
    super.id,
    super.code,
    super.name,
    super.detail,
    super.value,
    super.link,
    super.target,
    super.icon,
    super.image,
    super.className,
    super.level,
    super.group,
    super.category,
    super.scope,
    super.status,
    super.refSubId,
    super.refMainId,
    super.createdAt,
    super.updatedAt,
    super.tbName,
    super.tbId,
  );

  factory GetProductDetailIntellectureTypeResModel.fromJson(json) =>
      _$GetProductDetailIntellectureTypeResModelFromJson(json);
}

@JsonSerializable(createToJson: false)
class GetProductDetailRelateDataResModel extends ProductRelateData {
  GetProductDetailRelateDataResModel(
      super.id, super.urlCode, super.name, super.cover);

  factory GetProductDetailRelateDataResModel.fromJson(json) =>
      _$GetProductDetailRelateDataResModelFromJson(json);
}
