/***********************************************************
 Copyright (C) 2017 VeriSign, Inc.

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

 http://www.verisign.com/nds/naming/namestore/techdocs.html
 ***********************************************************/
package com.verisign.epp.rootzone.interfaces;

import com.verisign.epp.codec.changeext.EPPChangeExt;
import com.verisign.epp.codec.gen.EPPResponse;
import com.verisign.epp.interfaces.EPPCommandException;
import com.verisign.epp.interfaces.EPPHost;
import com.verisign.epp.interfaces.EPPSession;

/**
 * Root Zone Host interface that extends that standard {@code EPPHost}
 * by adding new Root Zone (RZ) operations.
 */
public class RZHost extends EPPHost {

	/**
	 * Creates an {@code NSHost} with an established
	 * {@code EPPSession}.
	 * @param aSession Established session
	 */
	public RZHost(EPPSession aSession) {
		super(aSession);
	}


	/**
	 * Send a Root Zone (RZ) update with the required Change Request Identifier.
	 * 
	 * @param aChangeRequestId Change Request Identifier associated with the update.
	 * 
	 * @return EPP response
	 * 
	 * @throws EPPCommandException On error
	 */
	public EPPResponse sendUpdate(String aChangeRequestId) throws EPPCommandException {
		this.setRequestId(aChangeRequestId);
		return super.sendUpdate();
	}

	/**
	 * Add a Change Request to this Host command. An Extension is created for
	 * the Change Request and applied to the EPPComponent.
	 * @param requestId
	 */
	private void setRequestId(String requestId) {
		super.addExtension(new EPPChangeExt(requestId));
	}

}
