// 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;

import java.util.*;

/** A class representing a billing vendor object. */
public class Vendor {
  private String vendorID;
  private String legacyVendorID;
  private int nextGenVendorID;
  private ArrayList<Account> accountList;

  public Vendor() {
    accountList = new ArrayList<Account>();
  }

  public Vendor(String vendorID, String legacyVendorID, int nextGenVendorID) {
    this.vendorID = vendorID;
    this.legacyVendorID = legacyVendorID;
    this.nextGenVendorID = nextGenVendorID;
    accountList = new ArrayList<Account>();
  }

  public String getVendorID() {
    return vendorID; 
  }

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

  public String getLegacyVendorID() {
    return legacyVendorID;
  } 

  public void setLegacyVendorID(String legacyVendorID) {
    this.legacyVendorID = legacyVendorID;
  }

  public int getNextGenVendorID() {
    return nextGenVendorID;
  }
 
  public void setNextGenVendorID(int nextGenVendorID) {
    this.nextGenVendorID = nextGenVendorID;
  }

  public void addAccount(Account account) {
    accountList.add(account);
  }

  public ArrayList<Account> getAccounts() {
    return accountList;
  }
}
@@ -1778,10 +1778,708 @@
 ist;%0A  %7D
+%0A%0A  /** Return a String representing a billing config's JSON content. */%0A  public String createConfig() %7B%0A    ArrayList%3CAccount%3E accounts = getAccounts();%0A    String config = toString();%0A%0A    for(int i = 0; i %3C accounts.size(); i++) %7B%0A      config += accounts.get(i).toString();%0A    %7D%0A    config += %22%5D%7D%22;%0A%0A    return config;%0A  %7D%0A%0A  /** Return a String representation of Vendor fields. */%0A  public String toString() %7B%0A    StringBuilder vendorBuilder = new StringBuilder();%0A    vendorBuilder.append(%22%7BLegacy_Vendor_ID:%22 + getLegacyVendorID());%0A    vendorBuilder.append(%22,Next_Gen_Vendor_ID:%22 +  getNextGenVendorID());%0A    vendorBuilder.append(%22,Accounts:%5B%22);%0A%0A    return vendorBuilder.toString();%0A  %7D
 %0A%7D

add toString() and createConfig() methods to Vendor