// To parse this JSON data, do
//
//     final unitConstruct = unitConstructFromJson(jsonString);

import 'dart:convert';

UnitConstruct unitConstructFromJson(String str) =>
    UnitConstruct.fromJson(json.decode(str));

String unitConstructToJson(UnitConstruct data) => json.encode(data.toJson());

class UnitConstruct {
  final int id;
  final String bldgType;
  final String building;
  final String unitValue;
  final String genCode;

  UnitConstruct({
    required this.id,
    required this.bldgType,
    required this.building,
    required this.unitValue,
    required this.genCode,
  });

  UnitConstruct copy({
    int? id,
    String? bldgType,
    String? building,
    String? unitValue,
    String? genCode,
  }) {
    return UnitConstruct(
      id: id ?? this.id,
      bldgType: bldgType ?? this.bldgType,
      building: building ?? this.building,
      unitValue: unitValue ?? this.unitValue,
      genCode: genCode ?? this.genCode,
    );
  }

  UnitConstruct.defaultConstruct()
      : id = 0,
        bldgType = 'defaultType',
        building = 'defaultBuilding',
        unitValue = '0',
        genCode = 'defaultGenCode';

  factory UnitConstruct.fromJson2(Map<String, dynamic> json) => UnitConstruct(
        id: json["id"],
        bldgType: json["bldgType"],
        building: json["building"],
        unitValue: json["unitValue"],
        genCode: json["gen_code"],
      );

  factory UnitConstruct.fromJson(Map<String, dynamic> json) => UnitConstruct(
        id: json["id"],
        bldgType: json["bldg_type"],
        building: json["building"],
        unitValue: json["unit_value"],
        genCode: json["gen_code"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "bldg_type": bldgType,
        "building": building,
        "unit_value": unitValue,
        "gen_code": genCode,
      };
}
