// To parse this JSON data, do
//
//     final eSignature = eSignatureFromJson(jsonString);

import 'dart:convert';

ESignature eSignatureFromJson(String str) =>
    ESignature.fromJson(json.decode(str));

String eSignatureToJson(ESignature data) => json.encode(data.toJson());

class ESignature {
  int? bldgapprDetailsId;
  String? signAttachment;
  String? dateCreated;
  String? dateModified;
  String? genCode;

  ESignature({
    this.bldgapprDetailsId,
    this.signAttachment,
    this.dateCreated,
    this.dateModified,
    this.genCode,
  });

  ESignature copy({
    int? bldgapprDetailsId,
    String? signAttachment,
    String? dateCreated,
    String? dateModified,
    String? genCode,
  }) {
    return ESignature(
      bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
      signAttachment: signAttachment ?? this.signAttachment,
      dateCreated: dateCreated ?? this.dateCreated,
      dateModified: dateModified ?? this.dateModified,
      genCode: genCode ?? this.genCode,
    );
  }

  ESignature copyWith({
    int? bldgapprDetailsId,
    String? signAttachment,
    String? dateCreated,
    String? dateModified,
    String? genCode,
  }) =>
      ESignature(
        bldgapprDetailsId: bldgapprDetailsId ?? this.bldgapprDetailsId,
        signAttachment: signAttachment ?? this.signAttachment,
        dateCreated: dateCreated ?? this.dateCreated,
        dateModified: dateModified ?? this.dateModified,
        genCode: genCode ?? this.genCode,
      );

  factory ESignature.fromJson(Map<String, dynamic> json) => ESignature(
        bldgapprDetailsId: json["bldgappr_details_id"],
        signAttachment: json["sign_attachment"],
        dateCreated: json["date_created"],
        dateModified: json["date_modified"],
        genCode: json["gen_code"],
      );

  Map<String, dynamic> toJson() => {
        "bldgappr_details_id": bldgapprDetailsId,
        "sign_attachment": signAttachment,
        "date_created": dateCreated,
        "date_modified": dateModified,
        "gen_code": genCode,
      };

  // Define the fromMap method to convert a Map into an ESignature object
  factory ESignature.fromMap(Map<String, dynamic> map) {
    return ESignature(
      bldgapprDetailsId: map['bldgapprDetailsId'] as int?,
      signAttachment: map['signAttachment'] as String?,
      dateCreated: map['dateCreated'] as String?,
      dateModified: map['dateModified'] as String?,
      genCode: map['genCode'] as String?,
    );
  }

  // You can also add a toMap method if needed for converting back to Map
  Map<String, dynamic> toMap() {
    return {
      'bldgapprDetailsId': bldgapprDetailsId,
      'signAttachment': signAttachment,
      'dateCreated': dateCreated,
      'dateModified': dateModified,
      'genCode': genCode,
    };
  }
}
