// To parse this JSON data, do
//
//     final propertyAssessment = propertyAssessmentFromJson(jsonString);

import 'package:meta/meta.dart';
import 'dart:convert';

PropertyAssessment propertyAssessmentFromJson(String str) =>
    PropertyAssessment.fromJson(json.decode(str));

String propertyAssessmentToJson(PropertyAssessment data) =>
    json.encode(data.toJson());

class PropertyAssessment {
  final int id;
  final int bldgapprDetailsId;
  final String actualUse;
  final String marketValue;
  final String assessmentLevel;
  final String assessedValue;
  final bool taxable;
  final bool exempt;
  final int qtr;
  final int yr;
  final String appraisedbyName;
  final DateTime appraisedbyDate;
  final String recommendapprName;
  final DateTime recommendapprDate;
  final String approvedbyName;
  final String memoranda;
  final String swornstatementNo;
  final DateTime dateReceived;
  final DateTime entryDateAssessment;
  final String entryDateBy;

  PropertyAssessment({
    required this.id,
    required this.bldgapprDetailsId,
    required this.actualUse,
    required this.marketValue,
    required this.assessmentLevel,
    required this.assessedValue,
    required this.taxable,
    required this.exempt,
    required this.qtr,
    required this.yr,
    required this.appraisedbyName,
    required this.appraisedbyDate,
    required this.recommendapprName,
    required this.recommendapprDate,
    required this.approvedbyName,
    required this.memoranda,
    required this.swornstatementNo,
    required this.dateReceived,
    required this.entryDateAssessment,
    required this.entryDateBy,
  });

  factory PropertyAssessment.fromJson(Map<String, dynamic> json) =>
      PropertyAssessment(
        id: json["id"],
        bldgapprDetailsId: json["bldgappr_details_id"],
        actualUse: json["actual_use"],
        marketValue: json["market_value"],
        assessmentLevel: json["assessment_level"],
        assessedValue: json["assessed_value"],
        taxable: json["taxable"],
        exempt: json["exempt"],
        qtr: json["qtr"],
        yr: json["yr"],
        appraisedbyName: json["appraisedby_name"],
        appraisedbyDate: DateTime.parse(json["appraisedby_date"]),
        recommendapprName: json["recommendappr_name"],
        recommendapprDate: DateTime.parse(json["recommendappr_date"]),
        approvedbyName: json["approvedby_name"],
        memoranda: json["memoranda"],
        swornstatementNo: json["swornstatement_no"],
        dateReceived: DateTime.parse(json["date_received"]),
        entryDateAssessment: DateTime.parse(json["entry_date_assessment"]),
        entryDateBy: json["entry_date_by"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "bldgappr_details_id": bldgapprDetailsId,
        "actual_use": actualUse,
        "market_value": marketValue,
        "assessment_level": assessmentLevel,
        "assessed_value": assessedValue,
        "taxable": taxable,
        "exempt": exempt,
        "qtr": qtr,
        "yr": yr,
        "appraisedby_name": appraisedbyName,
        "appraisedby_date":
            "${appraisedbyDate.year.toString().padLeft(4, '0')}-${appraisedbyDate.month.toString().padLeft(2, '0')}-${appraisedbyDate.day.toString().padLeft(2, '0')}",
        "recommendappr_name": recommendapprName,
        "recommendappr_date":
            "${recommendapprDate.year.toString().padLeft(4, '0')}-${recommendapprDate.month.toString().padLeft(2, '0')}-${recommendapprDate.day.toString().padLeft(2, '0')}",
        "approvedby_name": approvedbyName,
        "memoranda": memoranda,
        "swornstatement_no": swornstatementNo,
        "date_received":
            "${dateReceived.year.toString().padLeft(4, '0')}-${dateReceived.month.toString().padLeft(2, '0')}-${dateReceived.day.toString().padLeft(2, '0')}",
        "entry_date_assessment":
            "${entryDateAssessment.year.toString().padLeft(4, '0')}-${entryDateAssessment.month.toString().padLeft(2, '0')}-${entryDateAssessment.day.toString().padLeft(2, '0')}",
        "entry_date_by": entryDateBy,
      };
}
