//
// Generated by JSON2Apex http://json2apex.herokuapp.com/
//
// The supplied json has fields with names that are not valid in apex
// and so can only be parsed with explicitly generated code, this option
// was auto selected for you.

@SuppressWarnings('PMD.PropertyNamingConventions, PMD.VariableNamingConventions, PMD.FieldNamingConventions')
public class QBPaymentQueryJSON {

	public class Line {

		public Line(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						{
							System.debug(LoggingLevel.WARN, 'Line consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	public class Any_Z {
		public String name {get;set;} 
		public Boolean nil {get;set;} 
		public Value value {get;set;} 
		public String declaredType {get;set;} 
		public String scope {get;set;} 
		public Boolean globalScope {get;set;} 
		public Boolean typeSubstituted {get;set;} 

		public Any_Z(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						if (text == 'name') {
							name = parser.getText();
						} else if (text == 'nil') {
							nil = parser.getBooleanValue();
						} else if (text == 'value') {
							value = new Value(parser);
						} else if (text == 'declaredType') {
							declaredType = parser.getText();
						} else if (text == 'scope') {
							scope = parser.getText();
						} else if (text == 'globalScope') {
							globalScope = parser.getBooleanValue();
						} else if (text == 'typeSubstituted') {
							typeSubstituted = parser.getBooleanValue();
						} else {
							System.debug(LoggingLevel.WARN, 'Any_Z consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	public class Payment {
		public String SyncToken {get;set;} 
		public String domain {get;set;} 
		public DepositToAccountRef DepositToAccountRef {get;set;} 
		public Double UnappliedAmt {get;set;} 
		public String TxnDate {get;set;} 
		public Double TotalAmt {get;set;} 
		public Boolean ProcessPayment {get;set;} 
		public Boolean sparse {get;set;} 
		public List<Line> Line {get;set;} 
		public CustomerRef CustomerRef {get;set;} 
		public String Id {get;set;} 
		public MetaData MetaData {get;set;} 

		public Payment(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						if (text == 'SyncToken') {
							SyncToken = parser.getText();
						} else if (text == 'domain') {
							domain = parser.getText();
						} else if (text == 'DepositToAccountRef') {
							DepositToAccountRef = new DepositToAccountRef(parser);
						} else if (text == 'UnappliedAmt') {
							UnappliedAmt = parser.getDoubleValue();
						} else if (text == 'TxnDate') {
							TxnDate = parser.getText();
						} else if (text == 'TotalAmt') {
							TotalAmt = parser.getDoubleValue();
						} else if (text == 'ProcessPayment') {
							ProcessPayment = parser.getBooleanValue();
						} else if (text == 'sparse') {
							sparse = parser.getBooleanValue();
						} else if (text == 'Line') {
							Line = arrayOfLine(parser);
						} else if (text == 'CustomerRef') {
							CustomerRef = new CustomerRef(parser);
						} else if (text == 'Id') {
							Id = parser.getText();
						} else if (text == 'MetaData') {
							MetaData = new MetaData(parser);
						} else {
							System.debug(LoggingLevel.WARN, 'Payment consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	public class DepositToAccountRef {
		public String value {get;set;} 

		public DepositToAccountRef(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						if (text == 'value') {
							value = parser.getText();
						} else {
							System.debug(LoggingLevel.WARN, 'DepositToAccountRef consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	public class Line_Z {
		public Double Amount {get;set;} 
		public LineEx LineEx {get;set;} 
		public List<LinkedTxn> LinkedTxn {get;set;} 

		public Line_Z(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						if (text == 'Amount') {
							Amount = parser.getDoubleValue();
						} else if (text == 'LineEx') {
							LineEx = new LineEx(parser);
						} else if (text == 'LinkedTxn') {
							LinkedTxn = arrayOfLinkedTxn(parser);
						} else {
							System.debug(LoggingLevel.WARN, 'Line_Z consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	public class MetaData {
		public String CreateTime {get;set;} 
		public String LastUpdatedTime {get;set;} 

		public MetaData(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						if (text == 'CreateTime') {
							CreateTime = parser.getText();
						} else if (text == 'LastUpdatedTime') {
							LastUpdatedTime = parser.getText();
						} else {
							System.debug(LoggingLevel.WARN, 'MetaData consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	public class QueryResponse {
		public Integer startPosition {get;set;} 
		public List<Payment> Payment {get;set;} 
		public Integer maxResults {get;set;} 

		public QueryResponse(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						if (text == 'startPosition') {
							startPosition = parser.getIntegerValue();
						} else if (text == 'Payment') {
							Payment = arrayOfPayment(parser);
						} else if (text == 'maxResults') {
							maxResults = parser.getIntegerValue();
						} else {
							System.debug(LoggingLevel.WARN, 'QueryResponse consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	public class Value {
		public String Name {get;set;} 
		public String Value {get;set;} 

		public Value(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						if (text == 'Name') {
							Name = parser.getText();
						} else if (text == 'Value') {
							Value = parser.getText();
						} else {
							System.debug(LoggingLevel.WARN, 'Value consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	public class CustomerRef {
		public String name {get;set;} 
		public String value {get;set;} 

		public CustomerRef(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						if (text == 'name') {
							name = parser.getText();
						} else if (text == 'value') {
							value = parser.getText();
						} else {
							System.debug(LoggingLevel.WARN, 'CustomerRef consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	public class LineEx {
		public List<Any_Z> any_Z {get;set;} // in json: any

		public LineEx(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						if (text == 'any') {
							any_Z = arrayOfAny_Z(parser);
						} else {
							System.debug(LoggingLevel.WARN, 'LineEx consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	public QueryResponse QueryResponse {get;set;} 
	public String time_Z {get;set;} // in json: time

	public QBPaymentQueryJSON(JSONParser parser) {
		while (parser.nextToken() != System.JSONToken.END_OBJECT) {
			if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
				String text = parser.getText();
				if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
					if (text == 'QueryResponse') {
						QueryResponse = new QueryResponse(parser);
					} else if (text == 'time') {
						time_Z = parser.getText();
					} else {
						System.debug(LoggingLevel.WARN, 'QBPaymentQueryJSON consuming unrecognized property: '+text);
						consumeObject(parser);
					}
				}
			}
		}
	}
	
	public class LinkedTxn {
		public String TxnId {get;set;} 
		public String TxnType {get;set;} 

		public LinkedTxn(JSONParser parser) {
			while (parser.nextToken() != System.JSONToken.END_OBJECT) {
				if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
					String text = parser.getText();
					if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
						if (text == 'TxnId') {
							TxnId = parser.getText();
						} else if (text == 'TxnType') {
							TxnType = parser.getText();
						} else {
							System.debug(LoggingLevel.WARN, 'LinkedTxn consuming unrecognized property: '+text);
							consumeObject(parser);
						}
					}
				}
			}
		}
	}
	
	
	public static QBPaymentQueryJSON parse(String json) {
		System.JSONParser parser = System.JSON.createParser(json);
		return new QBPaymentQueryJSON(parser);
	}
	
	public static void consumeObject(System.JSONParser parser) {
		Integer depth = 0;
		do {
			System.JSONToken curr = parser.getCurrentToken();
			if (curr == System.JSONToken.START_OBJECT || 
				curr == System.JSONToken.START_ARRAY) {
				depth++;
			} else if (curr == System.JSONToken.END_OBJECT ||
				curr == System.JSONToken.END_ARRAY) {
				depth--;
			}
		} while (depth > 0 && parser.nextToken() != null);
	}
	



    private static List<Payment> arrayOfPayment(System.JSONParser p) {
        List<Payment> res = new List<Payment>();
        if (p.getCurrentToken() == null) p.nextToken();
        while (p.nextToken() != System.JSONToken.END_ARRAY) {
            res.add(new Payment(p));
        }
        return res;
    }


    private static List<Any_Z> arrayOfAny_Z(System.JSONParser p) {
        List<Any_Z> res = new List<Any_Z>();
        if (p.getCurrentToken() == null) p.nextToken();
        while (p.nextToken() != System.JSONToken.END_ARRAY) {
            res.add(new Any_Z(p));
        }
        return res;
    }





    private static List<Line> arrayOfLine(System.JSONParser p) {
        List<Line> res = new List<Line>();
        if (p.getCurrentToken() == null) p.nextToken();
        while (p.nextToken() != System.JSONToken.END_ARRAY) {
            res.add(new Line(p));
        }
        return res;
    }





    private static List<Line_Z> arrayOfLine_Z(System.JSONParser p) {
        List<Line_Z> res = new List<Line_Z>();
        if (p.getCurrentToken() == null) p.nextToken();
        while (p.nextToken() != System.JSONToken.END_ARRAY) {
            res.add(new Line_Z(p));
        }
        return res;
    }









    private static List<LinkedTxn> arrayOfLinkedTxn(System.JSONParser p) {
        List<LinkedTxn> res = new List<LinkedTxn>();
        if (p.getCurrentToken() == null) p.nextToken();
        while (p.nextToken() != System.JSONToken.END_ARRAY) {
            res.add(new LinkedTxn(p));
        }
        return res;
    }




}