class commonAccountLedgerResponse {
  List<LedgerList>? ledgerList;
  AccountDetails? accountDetails;
  String? error;
  String? message;

  commonAccountLedgerResponse(
      {this.ledgerList, this.accountDetails, this.error, this.message});

  commonAccountLedgerResponse.fromJson(Map<String, dynamic> json) {
    if (json['ledger_list'] != null) {
      ledgerList = <LedgerList>[];
      json['ledger_list'].forEach((v) {
        ledgerList!.add(new LedgerList.fromJson(v));
      });
    }
    accountDetails = json['account_details'] != null
        ? new AccountDetails.fromJson(json['account_details'])
        : null;
    error = json['error'];
    message = json['message'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.ledgerList != null) {
      data['ledger_list'] = this.ledgerList!.map((v) => v.toJson()).toList();
    }
    if (this.accountDetails != null) {
      data['account_details'] = this.accountDetails!.toJson();
    }
    data['error'] = this.error;
    data['message'] = this.message;
    return data;
  }
}

class LedgerList {
  String? id;
  String? accountId;
  String? refType;
  String? refId;
  String? type;
  String? description;
  String? creditAmount;
  String? debitAmount;
  String? date;
  String? createdDatetime;

  LedgerList(
      {this.id,
        this.accountId,
        this.refType,
        this.refId,
        this.type,
        this.description,
        this.creditAmount,
        this.debitAmount,
        this.date,
        this.createdDatetime});

  LedgerList.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    accountId = json['account_id'];
    refType = json['ref_type'];
    refId = json['ref_id'];
    type = json['type'];
    description = json['description'];
    creditAmount = json['credit_amount'];
    debitAmount = json['debit_amount'];
    date = json['date'];
    createdDatetime = json['created_datetime'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['account_id'] = this.accountId;
    data['ref_type'] = this.refType;
    data['ref_id'] = this.refId;
    data['type'] = this.type;
    data['description'] = this.description;
    data['credit_amount'] = this.creditAmount;
    data['debit_amount'] = this.debitAmount;
    data['date'] = this.date;
    data['created_datetime'] = this.createdDatetime;
    return data;
  }
}

class AccountDetails {
  String? id;
  String? name;

  AccountDetails({this.id, this.name});

  AccountDetails.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    return data;
  }
}
