// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package data;

/** A class representing a billing account object. */
public class Account {
  private String accountID;
  private String vendorID;
  private String entity;
  private String currency;
  private String direction;
  private String legacyAccountID;
  private int nextGenAccountID;
  private String matchingMode;
  private String aggregationMode;

  public Account(String accountID, String vendorID, String entity, 
    String currency, String direction, String legacyAccountID, 
    int nextGenAccountID, String matchingMode, String aggregationMode) {

    this.accountID = accountID;
    this.vendorID = vendorID;
    this.entity = entity;
    this.currency = currency;
    this.direction = direction;
    this.legacyAccountID = legacyAccountID;
    this.nextGenAccountID = nextGenAccountID;
    this.matchingMode = matchingMode;
    this.aggregationMode = aggregationMode;
  }

  public String getAccountID() {
    return accountID;
  }

  public void setAccountID(String accountID) {
    this.accountID = accountID;
  }

  public String getVendorID() {
    return vendorID;  
  }

  public void setVendorID(String vendorID) {
    this.vendorID = vendorID;
  }

  public String getEntity() {
    return entity;
  }

  public void setEntity(String entity) {
    this.entity = entity;
  }

  public String getCurrency() {
    return currency;
  }

  public void setCurrency(String currency) {
    this.currency = currency;
  }

  public String getDirection() {
    return direction;
  }

  public void setDirection(String direction) {
    this.direction = direction;
  }

  public String getLegacyAccountID() {
    return legacyAccountID;
  }

  public void setLegacyAccountID(String legacyAccountID) {
    this.legacyAccountID = legacyAccountID;
  }

  public int getNextGenAccountID() {
    return nextGenAccountID;
  }

  public void setNextGenAccountID(int nextGenAccountID) {
    this.nextGenAccountID = nextGenAccountID;
  }

  public String getMatchingMode() {
    return matchingMode;
  }

  public void setMatchingMode(String matchingMode) {
    this.matchingMode = matchingMode;
  }

  public String getAggregationMode() {
    return aggregationMode;
  }

  public void setAggregationMode(String aggregationMode) {
    this.aggregationMode = aggregationMode;
  }
}
@@ -596,16 +596,65 @@
  data;%0A%0A
+import java.util.*;%0Aimport org.json.JSONObject;%0A%0A
 /** A cl
@@ -2914,10 +2914,1204 @@
 ode;%0A  %7D
+%0A%0A  // Create and return a JSON object that contains Account fields.%0A  public LinkedHashMap toJson() %7B%0A    // Use LinkedHashMap to preserve order.%0A    LinkedHashMap accountMap = new LinkedHashMap();%0A    LinkedHashMap settlementAttributesMap = new LinkedHashMap();%0A%0A    // Create a JSON objects to contain Account fields.%0A    JSONObject settlementConfig = new JSONObject();%0A%0A    // Populate settlementConfig JSON object. LEARN HOW TO PUT QUOTES AROUND A VARIABLE%0A    settlementConfig.put(%22Matching_Mode%22, getMatchingMode());%0A%0A    // Populate settlementAttributes JSON object.%0A    settlementAttributesMap.put(%22Currency_Code%22, getCurrency());%0A    settlementAttributesMap.put(%22Direction%22, getDirection());%0A    settlementAttributesMap.put(%22Entity%22, getEntity());%0A%0A    // Populate JSON account object.%0A    accountMap.put(%22Legacy_Account_ID%22, getLegacyAccountID());%0A    accountMap.put(%22Next_Gen_Customer_ID%22, getNextGenAccountID());%0A    accountMap.put(%22Settlement_Attributes%22, settlementAttributesMap);%0A    accountMap.put(%22Settlement_Config%22, settlementConfig);%0A    accountMap.put(%22Account_ID%22, getAccountID());%0A    accountMap.put(%22Aggregation_Mode%22, getAggregationMode());%0A%0A    return accountMap;%0A  %7D
 %0A%7D

add toJson() method to the Account class