// To parse this JSON data, do
//
//     final classComponents = classComponentsFromJson(jsonString);

import 'dart:convert';

ClassComponentsOffline classComponentsFromJson(String str) =>
    ClassComponentsOffline.fromJson(json.decode(str));

String classComponentsToJson(ClassComponentsOffline data) =>
    json.encode(data.toJson());

class ClassComponentsOffline {
  final int? id;
  final String? componentName;
  final String? minBaseUnitvalPercent;
  final String? maxBaseUnitvalPercent;
  final String? minUnitvalSqrmtr;
  final String? maxUnitvalSqrmtr;
  final String? minAddBaseunitval;
  final String? maxAddBaseunitval;
  final String? minDeductBaserate;
  final String? maxDeductBaserate;
  final String? minLinearMeter;
  final String? maxLinearMeter;
  final String? minSpacing;
  final String? maxSpacing;
  final String? roughFinish;
  final String? highFinish;
  final int? withoutBucc;
  // final String? genCode;

  ClassComponentsOffline({
    this.id,
    this.componentName,
    this.minBaseUnitvalPercent,
    this.maxBaseUnitvalPercent,
    this.minUnitvalSqrmtr,
    this.maxUnitvalSqrmtr,
    this.minAddBaseunitval,
    this.maxAddBaseunitval,
    this.minDeductBaserate,
    this.maxDeductBaserate,
    this.minLinearMeter,
    this.maxLinearMeter,
    this.minSpacing,
    this.maxSpacing,
    this.roughFinish,
    this.highFinish,
    this.withoutBucc,
    // this.genCode
  });

  ClassComponentsOffline copy({
    int? id,
    String? componentName,
    String? minBaseUnitvalPercent,
    String? maxBaseUnitvalPercent,
    String? minUnitvalSqrmtr,
    String? maxUnitvalSqrmtr,
    String? minAddBaseunitval,
    String? maxAddBaseunitval,
    String? minDeductBaserate,
    String? maxDeductBaserate,
    String? minLinearMeter,
    String? maxLinearMeter,
    String? minSpacing,
    String? maxSpacing,
    String? roughFinish,
    String? highFinish,
    int? withoutBucc,
    // String? genCode,
  }) {
    return ClassComponentsOffline(
      id: id ?? this.id,
      componentName: componentName ?? this.componentName,
      minBaseUnitvalPercent:
          minBaseUnitvalPercent ?? this.minBaseUnitvalPercent,
      maxBaseUnitvalPercent:
          maxBaseUnitvalPercent ?? this.maxBaseUnitvalPercent,
      minUnitvalSqrmtr: minUnitvalSqrmtr ?? this.minUnitvalSqrmtr,
      maxUnitvalSqrmtr: maxUnitvalSqrmtr ?? this.maxUnitvalSqrmtr,
      minAddBaseunitval: minAddBaseunitval ?? this.minAddBaseunitval,
      maxAddBaseunitval: maxAddBaseunitval ?? this.maxAddBaseunitval,
      minDeductBaserate: minDeductBaserate ?? this.minDeductBaserate,
      maxDeductBaserate: maxDeductBaserate ?? this.maxDeductBaserate,
      minLinearMeter: minLinearMeter ?? this.minLinearMeter,
      maxLinearMeter: maxLinearMeter ?? this.maxLinearMeter,
      minSpacing: minSpacing ?? this.minSpacing,
      maxSpacing: maxSpacing ?? this.maxSpacing,
      roughFinish: roughFinish ?? this.roughFinish,
      highFinish: highFinish ?? this.highFinish,
      withoutBucc: withoutBucc ?? this.withoutBucc,
      // genCode: genCode ?? this.genCode,
    );
  }

  factory ClassComponentsOffline.fromJson(Map<String, dynamic> json) =>
      ClassComponentsOffline(
        id: json["id"],
        componentName: json["component_name"],
        minBaseUnitvalPercent: json["min_base_unitval_percent"],
        maxBaseUnitvalPercent: json["max_base_unitval_percent"],
        minUnitvalSqrmtr: json["min_unitval_sqrmtr"],
        maxUnitvalSqrmtr: json["max_unitval_sqrmtr"],
        minAddBaseunitval: json["min_add_baseunitval"],
        maxAddBaseunitval: json["max_add_baseunitval"],
        minDeductBaserate: json["min_deduct_baserate"],
        maxDeductBaserate: json["max_deduct_baserate"],
        minLinearMeter: json["min_linear_meter"],
        maxLinearMeter: json["max_linear_meter"],
        minSpacing: json["min_spacing"],
        maxSpacing: json["max_spacing"],
        roughFinish: json["rough_finish"],
        highFinish: json["high_finish"],
        withoutBucc: json["without_bucc"],
        // genCode: json["gen_code"],
      );

  factory ClassComponentsOffline.fromJson2(Map<String, dynamic> json) =>
      ClassComponentsOffline(
        id: json["id"],
        componentName: json["componentName"],
        minBaseUnitvalPercent: json["minBaseUnitvalPercent"],
        maxBaseUnitvalPercent: json["maxBaseUnitvalPercent"],
        minUnitvalSqrmtr: json["minUnitvalSqrmtr"],
        maxUnitvalSqrmtr: json["maxUnitvalSqrmtr"],
        minAddBaseunitval: json["minAddBaseunitval"],
        maxAddBaseunitval: json["maxAddBaseunitval"],
        minDeductBaserate: json["minDeductBaserate"],
        maxDeductBaserate: json["maxDeductBaserate"],
        minLinearMeter: json["minLinearMeter"],
        maxLinearMeter: json["maxLinearMeter"],
        minSpacing: json["minSpacing"],
        maxSpacing: json["maxSpacing"],
        roughFinish: json["roughFinish"],
        highFinish: json["highFinish"],
        withoutBucc: json["withoutBucc"],
        // genCode: json["genCode"]
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "component_name": componentName,
        "min_base_unitval_percent": minBaseUnitvalPercent,
        "max_base_unitval_percent": maxBaseUnitvalPercent,
        "min_unitval_sqrmtr": minUnitvalSqrmtr,
        "max_unitval_sqrmtr": maxUnitvalSqrmtr,
        "min_add_baseunitval": minAddBaseunitval,
        "max_add_baseunitval": maxAddBaseunitval,
        "min_deduct_baserate": minDeductBaserate,
        "max_deduct_baserate": maxDeductBaserate,
        "min_linear_meter": minLinearMeter,
        "max_linear_meter": maxLinearMeter,
        "min_spacing": minSpacing,
        "max_spacing": maxSpacing,
        "rough_finish": roughFinish,
        "high_finish": highFinish,
        "without_bucc": withoutBucc,
        // "gen_code": genCode
      };
}
