/**
 *	Apttus Approvals Management
 *	AdhocApprovalProcessDTO
 *	 
 *	@2019 Apttus Inc. All rights reserved.
 */
global with sharing class AdhocApprovalProcessDTO {
	
	// adhoc approval process
	private AdhocApprovalProcess__c adhocApprovalProcessSO = null;
	
	// adhoc approval groups
	private List<AdhocApprovalGroupDTO> adhocApprovalGroups = new List<AdhocApprovalGroupDTO>();


	/**
	 * Public constructor
	 */
	global AdhocApprovalProcessDTO() {

	}
	
	/**
	 * Class Constructor specifying initial values
	 * @param adhocApprovalGroupSO the adhoc approval group
	 */
	global AdhocApprovalProcessDTO(AdhocApprovalProcess__c adhocApprovalProcessSO) {
		this();
		setAdhocApprovalProcessSO(adhocApprovalProcessSO);

	}
	
	/**
	 * Gets adhoc approval process
	 * @return adhoc approval process sobject
	 */
	global AdhocApprovalProcess__c getAdhocApprovalProcessSO() {
		return adhocApprovalProcessSO;

	}
	
	/**
	 * Sets adhoc approval process
	 * @param adhocApprovalProcessSO the adhoc approval process
	 */
	global void setAdhocApprovalProcessSO(AdhocApprovalProcess__c adhocApprovalProcessSO) {
		this.adhocApprovalProcessSO = adhocApprovalProcessSO;

	}
	
	/**
	 * Determines if a process has one or more approval groups
	 * @return <code>true</code> approval groups exist, <code>false</code> otherwise
	 */
	global Boolean hasAdhocApprovalGroups() {
		return adhocApprovalGroups != null && adhocApprovalGroups.size() > 0;

	}
	
	/**
	 * Gets list of adhoc approval groups
	 * @return list of adhoc approval groups
	 */
	global List<AdhocApprovalGroupDTO> getAdhocApprovalGroups() {
		return adhocApprovalGroups;

	}
	
	/**
	 * Add an adhoc approval group
	 * @param adhocApprovalGroup the adhoc approval group
	 */
	global void addAdhocApprovalGroup(AdhocApprovalGroupDTO adhocApprovalGroup) {
		this.adhocApprovalGroups.add(adhocApprovalGroup);

	}
	
	/**
	 * Add a list of adhoc approval group
	 * @param adhocApprovalGroups list of adhoc approval group
	 */
	global void addAdhocApprovalGroups(List<AdhocApprovalGroupDTO> adhocApprovalGroups) {
		this.adhocApprovalGroups.addAll(adhocApprovalGroups);

	}

	/**
	 * Creates the json representation of this object
	 * @return the json string
	 */
	public String toJSON() {
		// get the json representation
		return System.JSON.serializePretty(this);
       	
	}
    

	/**
	 * Inner class to hold adhoc approval groups
	 */
	global class AdhocApprovalGroupDTO {
		
		// adhoc approval group
		public AdhocApprovalGroup__c adhocApprovalGroupSO = null;
		
		// adhoc approvers
		private List<AdhocApproverDTO> adhocApprovers = new List<AdhocApproverDTO>();

		/**
		 * Class constructor
		 */
		private AdhocApprovalGroupDTO() {

		}
		
		/**
		 * Class Constructor specifying initial values
		 * @param adhocApprovalGroupSO the adhoc approval group
		 */
		global AdhocApprovalGroupDTO(AdhocApprovalGroup__c adhocApprovalGroupSO) {
			this();
			setAdhocApprovalGroupSO(adhocApprovalGroupSO);

		}
		
		/**
		 * Gets adhoc approval group
		 * @return adhoc approval group sobject
		 */
		global AdhocApprovalGroup__c getAdhocApprovalGroupSO() {
			return adhocApprovalGroupSO;

		}
		
		/**
		 * Set adhoc approval group
		 * @param adhocApprovalGroup the adhoc approval group
		 */
		global void setAdhocApprovalGroupSO(AdhocApprovalGroup__c adhocApprovalGroupSO) {
			this.adhocApprovalGroupSO = adhocApprovalGroupSO;

		}
		
		/**
		 * Determines if an approval group has one or more approvers
		 * @return <code>true</code> approval groups exist, <code>false</code> otherwise
		 */
		global Boolean hasAdhocApprovers() {
			return adhocApprovers != null && adhocApprovers.size() > 0;
	
		}
		
		/**
		 * Gets list of adhoc approvers
		 * @return list of adhoc approvers
		 */
		global List<AdhocApproverDTO> getAdhocApprovers() {
			return adhocApprovers;
	
		}
		
		/**
		 * Add an adhoc approver
		 * @param adhocApprover the adhoc approver
		 */
		global void addAdhocApprover(AdhocApproverDTO adhocApprover) {
			this.adhocApprovers.add(adhocApprover);
	
		}
		
		/**
		 * Add a list of adhoc approvers
		 * @param adhocApprovers list of adhoc approvers
		 */
		global void addAdhocApprovers(List<AdhocApproverDTO> adhocApprovers) {
			this.adhocApprovers.addAll(adhocApprovers);
	
		}

	}


	/**
	 * Inner class to hold adhoc approver
	 */
	global class AdhocApproverDTO {
		
		// adhoc approver
		public AdhocApprover__c adhocApproverSO = null;

		/**
		 * Class constructor
		 */
		private AdhocApproverDTO() {

		}
		
		/**
		 * Class Constructor specifying initial values
		 * @param adhocApproverSO the adhoc approver
		 */
		global AdhocApproverDTO(AdhocApprover__c adhocApproverSO) {
			this();
			setAdhocApproverSO(adhocApproverSO);

		}
		
		/**
		 * Get adhoc approver
		 * @return the adhoc approver sobject
		 */
		global AdhocApprover__c getAdhocApproverSO() {
			return adhocApproverSO;

		}
		
		/**
		 * Set adhoc approver
		 * @param adhocApprover the adhoc approver
		 */
		global void setAdhocApproverSO(AdhocApprover__c adhocApprover) {
			this.adhocApproverSO = adhocApprover;

		}
		
	}

}
CODE