/**
 * COCTMT490000UV04BillableClinicalProduct.java
 * <p>
 * File generated from the coctmt490000UV04::COCTMT490000UV04BillableClinicalProduct uml Class
 * Generated by IHE - europe, gazelle team
 */
package net.ihe.gazelle.hl7v3.coctmt490000UV04;

import java.io.Serial;
import java.util.ArrayList;
import java.util.List;

import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlTransient;
import jakarta.xml.bind.annotation.XmlType;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import net.ihe.gazelle.gen.common.ConstraintValidatorModule;

import org.w3c.dom.Document;
import org.w3c.dom.Node;


/**
 * Description of the class COCTMT490000UV04BillableClinicalProduct.
 *
 */

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "COCT_MT490000UV04.BillableClinicalProduct", propOrder = {
	"realmCode",
	"typeId",
	"templateId",
	"id",
	"code",
	"effectiveTime",
	"product",
	"referrer",
	"consultant",
	"origin",
	"destination",
	"location",
	"pertinentInformation",
	"classCode",
	"moodCode",
	"nullFlavor"
})
@XmlRootElement(name = "COCT_MT490000UV04.BillableClinicalProduct")
public class COCTMT490000UV04BillableClinicalProduct implements java.io.Serializable {
	
	/**
	 * 
	 */
	@Serial
    private static final long serialVersionUID = 1L;

	
	@XmlElement(name = "realmCode", namespace = "urn:hl7-org:v3")
	public List<net.ihe.gazelle.hl7v3.datatypes.CS> realmCode;
	@XmlElement(name = "typeId", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.II typeId;
	@XmlElement(name = "templateId", namespace = "urn:hl7-org:v3")
	public List<net.ihe.gazelle.hl7v3.datatypes.II> templateId;
	@XmlElement(name = "id", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.II id;
	@XmlElement(name = "code", required = true, namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.CS code;
	@XmlElement(name = "effectiveTime", required = true, namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.IVLTS effectiveTime;
	@XmlElement(name = "product", required = true, namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Product product;
	@XmlElement(name = "referrer", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Referrer referrer;
	@XmlElement(name = "consultant", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Consultant consultant;
	@XmlElement(name = "origin", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Origin origin;
	@XmlElement(name = "destination", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Destination destination;
	@XmlElement(name = "location", required = true, namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Location location;
	@XmlElement(name = "pertinentInformation", namespace = "urn:hl7-org:v3")
	public List<net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04PertinentInformation> pertinentInformation;
	@XmlAttribute(name = "classCode", required = true)
	public net.ihe.gazelle.hl7v3.voc.ActClassSupply classCode;
	@XmlAttribute(name = "moodCode", required = true)
	public net.ihe.gazelle.hl7v3.voc.XActMoodIntentEvent moodCode;
	@XmlAttribute(name = "nullFlavor")
	public net.ihe.gazelle.hl7v3.voc.NullFlavor nullFlavor;
	
	/**
	 * An attribute containing marshalled element node
	 */
	@XmlTransient
	private org.w3c.dom.Node _xmlNodePresentation;
	
	
	/**
	 * Return realmCode.
	 * @return realmCode
	 */
	public List<net.ihe.gazelle.hl7v3.datatypes.CS> getRealmCode() {
		if (realmCode == null) {
	        realmCode = new ArrayList<>();
	    }
	    return realmCode;
	}
	
	/**
	 * Set a value to attribute realmCode.
     */
	public void setRealmCode(List<net.ihe.gazelle.hl7v3.datatypes.CS> realmCode) {
	    this.realmCode = realmCode;
	}
	
	
	
	/**
	 * Add a realmCode to the realmCode collection.
	 * @param realmCode_elt Element to add.
	 */
	public void addRealmCode(net.ihe.gazelle.hl7v3.datatypes.CS realmCode_elt) {
	    this.realmCode.add(realmCode_elt);
	}
	
	/**
	 * Remove a realmCode to the realmCode collection.
	 * @param realmCode_elt Element to remove
	 */
	public void removeRealmCode(net.ihe.gazelle.hl7v3.datatypes.CS realmCode_elt) {
	    this.realmCode.remove(realmCode_elt);
	}
	
	/**
	 * Return typeId.
	 * @return typeId
	 */
	public net.ihe.gazelle.hl7v3.datatypes.II getTypeId() {
	    return typeId;
	}
	
	/**
	 * Set a value to attribute typeId.
     */
	public void setTypeId(net.ihe.gazelle.hl7v3.datatypes.II typeId) {
	    this.typeId = typeId;
	}
	
	
	
	
	/**
	 * Return templateId.
	 * @return templateId
	 */
	public List<net.ihe.gazelle.hl7v3.datatypes.II> getTemplateId() {
		if (templateId == null) {
	        templateId = new ArrayList<>();
	    }
	    return templateId;
	}
	
	/**
	 * Set a value to attribute templateId.
     */
	public void setTemplateId(List<net.ihe.gazelle.hl7v3.datatypes.II> templateId) {
	    this.templateId = templateId;
	}
	
	
	
	/**
	 * Add a templateId to the templateId collection.
	 * @param templateId_elt Element to add.
	 */
	public void addTemplateId(net.ihe.gazelle.hl7v3.datatypes.II templateId_elt) {
	    this.templateId.add(templateId_elt);
	}
	
	/**
	 * Remove a templateId to the templateId collection.
	 * @param templateId_elt Element to remove
	 */
	public void removeTemplateId(net.ihe.gazelle.hl7v3.datatypes.II templateId_elt) {
	    this.templateId.remove(templateId_elt);
	}
	
	/**
	 * Return id.
	 * @return id
	 */
	public net.ihe.gazelle.hl7v3.datatypes.II getId() {
	    return id;
	}
	
	/**
	 * Set a value to attribute id.
     */
	public void setId(net.ihe.gazelle.hl7v3.datatypes.II id) {
	    this.id = id;
	}
	
	
	
	
	/**
	 * Return code.
	 * @return code
	 */
	public net.ihe.gazelle.hl7v3.datatypes.CS getCode() {
	    return code;
	}
	
	/**
	 * Set a value to attribute code.
     */
	public void setCode(net.ihe.gazelle.hl7v3.datatypes.CS code) {
	    this.code = code;
	}
	
	
	
	
	/**
	 * Return effectiveTime.
	 * @return effectiveTime
	 */
	public net.ihe.gazelle.hl7v3.datatypes.IVLTS getEffectiveTime() {
	    return effectiveTime;
	}
	
	/**
	 * Set a value to attribute effectiveTime.
     */
	public void setEffectiveTime(net.ihe.gazelle.hl7v3.datatypes.IVLTS effectiveTime) {
	    this.effectiveTime = effectiveTime;
	}
	
	
	
	
	/**
	 * Return product.
	 * @return product
	 */
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Product getProduct() {
	    return product;
	}
	
	/**
	 * Set a value to attribute product.
     */
	public void setProduct(net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Product product) {
	    this.product = product;
	}
	
	
	
	
	/**
	 * Return referrer.
	 * @return referrer
	 */
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Referrer getReferrer() {
	    return referrer;
	}
	
	/**
	 * Set a value to attribute referrer.
     */
	public void setReferrer(net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Referrer referrer) {
	    this.referrer = referrer;
	}
	
	
	
	
	/**
	 * Return consultant.
	 * @return consultant
	 */
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Consultant getConsultant() {
	    return consultant;
	}
	
	/**
	 * Set a value to attribute consultant.
     */
	public void setConsultant(net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Consultant consultant) {
	    this.consultant = consultant;
	}
	
	
	
	
	/**
	 * Return origin.
	 * @return origin
	 */
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Origin getOrigin() {
	    return origin;
	}
	
	/**
	 * Set a value to attribute origin.
     */
	public void setOrigin(net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Origin origin) {
	    this.origin = origin;
	}
	
	
	
	
	/**
	 * Return destination.
	 * @return destination
	 */
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Destination getDestination() {
	    return destination;
	}
	
	/**
	 * Set a value to attribute destination.
     */
	public void setDestination(net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Destination destination) {
	    this.destination = destination;
	}
	
	
	
	
	/**
	 * Return location.
	 * @return location
	 */
	public net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Location getLocation() {
	    return location;
	}
	
	/**
	 * Set a value to attribute location.
     */
	public void setLocation(net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Location location) {
	    this.location = location;
	}
	
	
	
	
	/**
	 * Return pertinentInformation.
	 * @return pertinentInformation
	 */
	public List<net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04PertinentInformation> getPertinentInformation() {
		if (pertinentInformation == null) {
	        pertinentInformation = new ArrayList<>();
	    }
	    return pertinentInformation;
	}
	
	/**
	 * Set a value to attribute pertinentInformation.
     */
	public void setPertinentInformation(List<net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04PertinentInformation> pertinentInformation) {
	    this.pertinentInformation = pertinentInformation;
	}
	
	
	
	/**
	 * Add a pertinentInformation to the pertinentInformation collection.
	 * @param pertinentInformation_elt Element to add.
	 */
	public void addPertinentInformation(net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04PertinentInformation pertinentInformation_elt) {
	    this.pertinentInformation.add(pertinentInformation_elt);
	}
	
	/**
	 * Remove a pertinentInformation to the pertinentInformation collection.
	 * @param pertinentInformation_elt Element to remove
	 */
	public void removePertinentInformation(net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04PertinentInformation pertinentInformation_elt) {
	    this.pertinentInformation.remove(pertinentInformation_elt);
	}
	
	/**
	 * Return classCode.
	 * @return classCode
	 */
	public net.ihe.gazelle.hl7v3.voc.ActClassSupply getClassCode() {
	    return classCode;
	}
	
	/**
	 * Set a value to attribute classCode.
     */
	public void setClassCode(net.ihe.gazelle.hl7v3.voc.ActClassSupply classCode) {
	    this.classCode = classCode;
	}
	
	
	
	
	/**
	 * Return moodCode.
	 * @return moodCode
	 */
	public net.ihe.gazelle.hl7v3.voc.XActMoodIntentEvent getMoodCode() {
	    return moodCode;
	}
	
	/**
	 * Set a value to attribute moodCode.
     */
	public void setMoodCode(net.ihe.gazelle.hl7v3.voc.XActMoodIntentEvent moodCode) {
	    this.moodCode = moodCode;
	}
	
	
	
	
	/**
	 * Return nullFlavor.
	 * @return nullFlavor
	 */
	public net.ihe.gazelle.hl7v3.voc.NullFlavor getNullFlavor() {
	    return nullFlavor;
	}
	
	/**
	 * Set a value to attribute nullFlavor.
     */
	public void setNullFlavor(net.ihe.gazelle.hl7v3.voc.NullFlavor nullFlavor) {
	    this.nullFlavor = nullFlavor;
	}
	
	
	
	
	
	public Node get_xmlNodePresentation() {
		if (_xmlNodePresentation == null){
				JAXBContext jc;
				DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
				dbf.setNamespaceAware(true);
				DocumentBuilder db = null;
				Document doc = null;
				try {
					db = dbf.newDocumentBuilder();
					doc = db.newDocument();
				} catch (ParserConfigurationException ignored) {}
				try {
					jc = JAXBContext.newInstance("net.ihe.gazelle.hl7v3.coctmt490000UV04");
					Marshaller m = jc.createMarshaller();
					m.marshal(this, doc);
					_xmlNodePresentation = doc.getElementsByTagNameNS("urn:hl7-org:v3", "COCT_MT490000UV04.BillableClinicalProduct").item(0);
				} catch (JAXBException e) {
					try{
						db = dbf.newDocumentBuilder();
						_xmlNodePresentation = db.newDocument();
					}
					catch(Exception ignored){}
				}
			}
			return _xmlNodePresentation;
	}
	
	public void set_xmlNodePresentation(Node _xmlNodePresentation) {
		this._xmlNodePresentation = _xmlNodePresentation;
	}
	
	
	

	
	/**
     * validate by a module of validation
     * 
     */
   public static void validateByModule(COCTMT490000UV04BillableClinicalProduct cOCTMT490000UV04BillableClinicalProduct, String _location, ConstraintValidatorModule cvm, List<net.ihe.gazelle.validation.Notification> diagnostic){
   		if (cOCTMT490000UV04BillableClinicalProduct != null){
   			cvm.validate(cOCTMT490000UV04BillableClinicalProduct, _location, diagnostic);
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.datatypes.CS realmCode: cOCTMT490000UV04BillableClinicalProduct.getRealmCode()){
					net.ihe.gazelle.hl7v3.datatypes.CS.validateByModule(realmCode, _location + "/realmCode[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
			net.ihe.gazelle.hl7v3.datatypes.II.validateByModule(cOCTMT490000UV04BillableClinicalProduct.getTypeId(), _location + "/typeId", cvm, diagnostic);
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.datatypes.II templateId: cOCTMT490000UV04BillableClinicalProduct.getTemplateId()){
					net.ihe.gazelle.hl7v3.datatypes.II.validateByModule(templateId, _location + "/templateId[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
			net.ihe.gazelle.hl7v3.datatypes.II.validateByModule(cOCTMT490000UV04BillableClinicalProduct.getId(), _location + "/id", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.CS.validateByModule(cOCTMT490000UV04BillableClinicalProduct.getCode(), _location + "/code", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.IVLTS.validateByModule(cOCTMT490000UV04BillableClinicalProduct.getEffectiveTime(), _location + "/effectiveTime", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Product.validateByModule(cOCTMT490000UV04BillableClinicalProduct.getProduct(), _location + "/product", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Referrer.validateByModule(cOCTMT490000UV04BillableClinicalProduct.getReferrer(), _location + "/referrer", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Consultant.validateByModule(cOCTMT490000UV04BillableClinicalProduct.getConsultant(), _location + "/consultant", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Origin.validateByModule(cOCTMT490000UV04BillableClinicalProduct.getOrigin(), _location + "/origin", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Destination.validateByModule(cOCTMT490000UV04BillableClinicalProduct.getDestination(), _location + "/destination", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04Location.validateByModule(cOCTMT490000UV04BillableClinicalProduct.getLocation(), _location + "/location", cvm, diagnostic);
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04PertinentInformation pertinentInformation: cOCTMT490000UV04BillableClinicalProduct.getPertinentInformation()){
					net.ihe.gazelle.hl7v3.coctmt490000UV04.COCTMT490000UV04PertinentInformation.validateByModule(pertinentInformation, _location + "/pertinentInformation[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
    	}
    }

}