import 'package:freezed_annotation/freezed_annotation.dart';

part 'roles_products.freezed.dart';
part 'roles_products.g.dart';

@freezed
abstract class RolesProductsModel with _$RolesProductsModel {
  factory RolesProductsModel({required List<ProductModel> products}) =
      _RolesProductsModel;

  factory RolesProductsModel.fromJson(Map<String, dynamic> json) =>
      _$RolesProductsModelFromJson(json);
}

@freezed
abstract class ProductModel with _$ProductModel {
  factory ProductModel({
    int? id,
    String? key,
    String? create_date, // Changed from createDate, removed @JsonKey
    String? modify_date, // Changed from modifyDate, removed @JsonKey
    bool? trash,
    String? name,
    int? provinceGovernmentalCarcassesQuantity,
    int? provinceGovernmentalCarcassesWeight,
    int? provinceFreeCarcassesQuantity,
    int? provinceFreeCarcassesWeight,
    int? receiveGovernmentalCarcassesQuantity,
    int? receiveGovernmentalCarcassesWeight,
    int? receiveFreeCarcassesQuantity,
    int? receiveFreeCarcassesWeight,
    int? freeBuyingCarcassesQuantity,
    int? freeBuyingCarcassesWeight,
    int? totalGovernmentalCarcassesQuantity,
    int? totalGovernmentalCarcassesWeight,
    int? totalFreeBarsCarcassesQuantity,
    int? totalFreeBarsCarcassesWeight,
    double? weightAverage,
    int? totalCarcassesQuantity,
    int? totalCarcassesWeight,
    int? freezingQuantity,
    int? freezingWeight,
    int? lossWeight,
    int? outProvinceAllocatedQuantity,
    int? outProvinceAllocatedWeight,
    int? provinceAllocatedQuantity,
    int? provinceAllocatedWeight,
    int? realAllocatedQuantity,
    int? realAllocatedWeight,
    int? coldHouseAllocatedWeight,
    int? posAllocatedWeight,
    int? segmentationWeight,
    int? totalRemainQuantity,
    int? totalRemainWeight,
    int? freePrice,
    int? approvedPrice,
    bool? approvedPriceStatus,
    dynamic createdBy,
    dynamic modifiedBy,
    int? parentProduct,
    dynamic killHouse,
    int? guild,
  }) = _ProductModel;

  factory ProductModel.fromJson(Map<String, dynamic> json) =>
      _$ProductModelFromJson(json);
}
