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

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 COCTMT150000UV02Organization.
 *
 */

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "COCT_MT150000UV02.Organization", propOrder = {
	"realmCode",
	"typeId",
	"templateId",
	"id",
	"code",
	"name",
	"desc",
	"statusCode",
	"telecom",
	"addr",
	"standardIndustryClassCode",
	"asOrganizationPartOf",
	"contactParty",
	"organizationContains",
	"classCode",
	"determinerCode",
	"nullFlavor"
})
@XmlRootElement(name = "COCT_MT150000UV02.Organization")
public class COCTMT150000UV02Organization 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", required = true, namespace = "urn:hl7-org:v3")
	public List<net.ihe.gazelle.hl7v3.datatypes.II> id;
	@XmlElement(name = "code", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.CE code;
	@XmlElement(name = "name", namespace = "urn:hl7-org:v3")
	public List<net.ihe.gazelle.hl7v3.datatypes.ON> name;
	@XmlElement(name = "desc", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.ED desc;
	@XmlElement(name = "statusCode", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.CS statusCode;
	@XmlElement(name = "telecom", namespace = "urn:hl7-org:v3")
	public List<net.ihe.gazelle.hl7v3.datatypes.TEL> telecom;
	@XmlElement(name = "addr", namespace = "urn:hl7-org:v3")
	public List<net.ihe.gazelle.hl7v3.datatypes.AD> addr;
	@XmlElement(name = "standardIndustryClassCode", namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.CE standardIndustryClassCode;
	@XmlElement(name = "asOrganizationPartOf", namespace = "urn:hl7-org:v3")
	public List<net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationPartOf> asOrganizationPartOf;
	@XmlElement(name = "contactParty", namespace = "urn:hl7-org:v3")
	public List<net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02ContactParty> contactParty;
	@XmlElement(name = "organizationContains", namespace = "urn:hl7-org:v3")
	public List<net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationContains> organizationContains;
	@XmlAttribute(name = "classCode", required = true)
	public net.ihe.gazelle.hl7v3.voc.EntityClassOrganization classCode;
	@XmlAttribute(name = "determinerCode", required = true)
	public net.ihe.gazelle.hl7v3.voc.EntityDeterminer determinerCode;
	@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 List<net.ihe.gazelle.hl7v3.datatypes.II> getId() {
		if (id == null) {
	        id = new ArrayList<>();
	    }
	    return id;
	}
	
	/**
	 * Set a value to attribute id.
     */
	public void setId(List<net.ihe.gazelle.hl7v3.datatypes.II> id) {
	    this.id = id;
	}
	
	
	
	/**
	 * Add a id to the id collection.
	 * @param id_elt Element to add.
	 */
	public void addId(net.ihe.gazelle.hl7v3.datatypes.II id_elt) {
	    this.id.add(id_elt);
	}
	
	/**
	 * Remove a id to the id collection.
	 * @param id_elt Element to remove
	 */
	public void removeId(net.ihe.gazelle.hl7v3.datatypes.II id_elt) {
	    this.id.remove(id_elt);
	}
	
	/**
	 * Return code.
	 * @return code
	 */
	public net.ihe.gazelle.hl7v3.datatypes.CE getCode() {
	    return code;
	}
	
	/**
	 * Set a value to attribute code.
     */
	public void setCode(net.ihe.gazelle.hl7v3.datatypes.CE code) {
	    this.code = code;
	}
	
	
	
	
	/**
	 * Return name.
	 * @return name
	 */
	public List<net.ihe.gazelle.hl7v3.datatypes.ON> getName() {
		if (name == null) {
	        name = new ArrayList<>();
	    }
	    return name;
	}
	
	/**
	 * Set a value to attribute name.
     */
	public void setName(List<net.ihe.gazelle.hl7v3.datatypes.ON> name) {
	    this.name = name;
	}
	
	
	
	/**
	 * Add a name to the name collection.
	 * @param name_elt Element to add.
	 */
	public void addName(net.ihe.gazelle.hl7v3.datatypes.ON name_elt) {
	    this.name.add(name_elt);
	}
	
	/**
	 * Remove a name to the name collection.
	 * @param name_elt Element to remove
	 */
	public void removeName(net.ihe.gazelle.hl7v3.datatypes.ON name_elt) {
	    this.name.remove(name_elt);
	}
	
	/**
	 * Return desc.
	 * @return desc
	 */
	public net.ihe.gazelle.hl7v3.datatypes.ED getDesc() {
	    return desc;
	}
	
	/**
	 * Set a value to attribute desc.
     */
	public void setDesc(net.ihe.gazelle.hl7v3.datatypes.ED desc) {
	    this.desc = desc;
	}
	
	
	
	
	/**
	 * Return statusCode.
	 * @return statusCode
	 */
	public net.ihe.gazelle.hl7v3.datatypes.CS getStatusCode() {
	    return statusCode;
	}
	
	/**
	 * Set a value to attribute statusCode.
     */
	public void setStatusCode(net.ihe.gazelle.hl7v3.datatypes.CS statusCode) {
	    this.statusCode = statusCode;
	}
	
	
	
	
	/**
	 * Return telecom.
	 * @return telecom
	 */
	public List<net.ihe.gazelle.hl7v3.datatypes.TEL> getTelecom() {
		if (telecom == null) {
	        telecom = new ArrayList<>();
	    }
	    return telecom;
	}
	
	/**
	 * Set a value to attribute telecom.
     */
	public void setTelecom(List<net.ihe.gazelle.hl7v3.datatypes.TEL> telecom) {
	    this.telecom = telecom;
	}
	
	
	
	/**
	 * Add a telecom to the telecom collection.
	 * @param telecom_elt Element to add.
	 */
	public void addTelecom(net.ihe.gazelle.hl7v3.datatypes.TEL telecom_elt) {
	    this.telecom.add(telecom_elt);
	}
	
	/**
	 * Remove a telecom to the telecom collection.
	 * @param telecom_elt Element to remove
	 */
	public void removeTelecom(net.ihe.gazelle.hl7v3.datatypes.TEL telecom_elt) {
	    this.telecom.remove(telecom_elt);
	}
	
	/**
	 * Return addr.
	 * @return addr
	 */
	public List<net.ihe.gazelle.hl7v3.datatypes.AD> getAddr() {
		if (addr == null) {
	        addr = new ArrayList<>();
	    }
	    return addr;
	}
	
	/**
	 * Set a value to attribute addr.
     */
	public void setAddr(List<net.ihe.gazelle.hl7v3.datatypes.AD> addr) {
	    this.addr = addr;
	}
	
	
	
	/**
	 * Add a addr to the addr collection.
	 * @param addr_elt Element to add.
	 */
	public void addAddr(net.ihe.gazelle.hl7v3.datatypes.AD addr_elt) {
	    this.addr.add(addr_elt);
	}
	
	/**
	 * Remove a addr to the addr collection.
	 * @param addr_elt Element to remove
	 */
	public void removeAddr(net.ihe.gazelle.hl7v3.datatypes.AD addr_elt) {
	    this.addr.remove(addr_elt);
	}
	
	/**
	 * Return standardIndustryClassCode.
	 * @return standardIndustryClassCode
	 */
	public net.ihe.gazelle.hl7v3.datatypes.CE getStandardIndustryClassCode() {
	    return standardIndustryClassCode;
	}
	
	/**
	 * Set a value to attribute standardIndustryClassCode.
     */
	public void setStandardIndustryClassCode(net.ihe.gazelle.hl7v3.datatypes.CE standardIndustryClassCode) {
	    this.standardIndustryClassCode = standardIndustryClassCode;
	}
	
	
	
	
	/**
	 * Return asOrganizationPartOf.
	 * @return asOrganizationPartOf
	 */
	public List<net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationPartOf> getAsOrganizationPartOf() {
		if (asOrganizationPartOf == null) {
	        asOrganizationPartOf = new ArrayList<>();
	    }
	    return asOrganizationPartOf;
	}
	
	/**
	 * Set a value to attribute asOrganizationPartOf.
     */
	public void setAsOrganizationPartOf(List<net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationPartOf> asOrganizationPartOf) {
	    this.asOrganizationPartOf = asOrganizationPartOf;
	}
	
	
	
	/**
	 * Add a asOrganizationPartOf to the asOrganizationPartOf collection.
	 * @param asOrganizationPartOf_elt Element to add.
	 */
	public void addAsOrganizationPartOf(net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationPartOf asOrganizationPartOf_elt) {
	    this.asOrganizationPartOf.add(asOrganizationPartOf_elt);
	}
	
	/**
	 * Remove a asOrganizationPartOf to the asOrganizationPartOf collection.
	 * @param asOrganizationPartOf_elt Element to remove
	 */
	public void removeAsOrganizationPartOf(net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationPartOf asOrganizationPartOf_elt) {
	    this.asOrganizationPartOf.remove(asOrganizationPartOf_elt);
	}
	
	/**
	 * Return contactParty.
	 * @return contactParty
	 */
	public List<net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02ContactParty> getContactParty() {
		if (contactParty == null) {
	        contactParty = new ArrayList<>();
	    }
	    return contactParty;
	}
	
	/**
	 * Set a value to attribute contactParty.
     */
	public void setContactParty(List<net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02ContactParty> contactParty) {
	    this.contactParty = contactParty;
	}
	
	
	
	/**
	 * Add a contactParty to the contactParty collection.
	 * @param contactParty_elt Element to add.
	 */
	public void addContactParty(net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02ContactParty contactParty_elt) {
	    this.contactParty.add(contactParty_elt);
	}
	
	/**
	 * Remove a contactParty to the contactParty collection.
	 * @param contactParty_elt Element to remove
	 */
	public void removeContactParty(net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02ContactParty contactParty_elt) {
	    this.contactParty.remove(contactParty_elt);
	}
	
	/**
	 * Return organizationContains.
	 * @return organizationContains
	 */
	public List<net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationContains> getOrganizationContains() {
		if (organizationContains == null) {
	        organizationContains = new ArrayList<>();
	    }
	    return organizationContains;
	}
	
	/**
	 * Set a value to attribute organizationContains.
     */
	public void setOrganizationContains(List<net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationContains> organizationContains) {
	    this.organizationContains = organizationContains;
	}
	
	
	
	/**
	 * Add a organizationContains to the organizationContains collection.
	 * @param organizationContains_elt Element to add.
	 */
	public void addOrganizationContains(net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationContains organizationContains_elt) {
	    this.organizationContains.add(organizationContains_elt);
	}
	
	/**
	 * Remove a organizationContains to the organizationContains collection.
	 * @param organizationContains_elt Element to remove
	 */
	public void removeOrganizationContains(net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationContains organizationContains_elt) {
	    this.organizationContains.remove(organizationContains_elt);
	}
	
	/**
	 * Return classCode.
	 * @return classCode
	 */
	public net.ihe.gazelle.hl7v3.voc.EntityClassOrganization getClassCode() {
	    return classCode;
	}
	
	/**
	 * Set a value to attribute classCode.
     */
	public void setClassCode(net.ihe.gazelle.hl7v3.voc.EntityClassOrganization classCode) {
	    this.classCode = classCode;
	}
	
	
	
	
	/**
	 * Return determinerCode.
	 * @return determinerCode
	 */
	public net.ihe.gazelle.hl7v3.voc.EntityDeterminer getDeterminerCode() {
	    return determinerCode;
	}
	
	/**
	 * Set a value to attribute determinerCode.
     */
	public void setDeterminerCode(net.ihe.gazelle.hl7v3.voc.EntityDeterminer determinerCode) {
	    this.determinerCode = determinerCode;
	}
	
	
	
	
	/**
	 * 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.coctmt150000UV02");
					Marshaller m = jc.createMarshaller();
					m.marshal(this, doc);
					_xmlNodePresentation = doc.getElementsByTagNameNS("urn:hl7-org:v3", "COCT_MT150000UV02.Organization").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(COCTMT150000UV02Organization cOCTMT150000UV02Organization, String _location, ConstraintValidatorModule cvm, List<net.ihe.gazelle.validation.Notification> diagnostic){
   		if (cOCTMT150000UV02Organization != null){
   			cvm.validate(cOCTMT150000UV02Organization, _location, diagnostic);
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.datatypes.CS realmCode: cOCTMT150000UV02Organization.getRealmCode()){
					net.ihe.gazelle.hl7v3.datatypes.CS.validateByModule(realmCode, _location + "/realmCode[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
			net.ihe.gazelle.hl7v3.datatypes.II.validateByModule(cOCTMT150000UV02Organization.getTypeId(), _location + "/typeId", cvm, diagnostic);
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.datatypes.II templateId: cOCTMT150000UV02Organization.getTemplateId()){
					net.ihe.gazelle.hl7v3.datatypes.II.validateByModule(templateId, _location + "/templateId[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.datatypes.II id: cOCTMT150000UV02Organization.getId()){
					net.ihe.gazelle.hl7v3.datatypes.II.validateByModule(id, _location + "/id[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
			net.ihe.gazelle.hl7v3.datatypes.CE.validateByModule(cOCTMT150000UV02Organization.getCode(), _location + "/code", cvm, diagnostic);
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.datatypes.ON name: cOCTMT150000UV02Organization.getName()){
					net.ihe.gazelle.hl7v3.datatypes.ON.validateByModule(name, _location + "/name[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
			net.ihe.gazelle.hl7v3.datatypes.ED.validateByModule(cOCTMT150000UV02Organization.getDesc(), _location + "/desc", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.CS.validateByModule(cOCTMT150000UV02Organization.getStatusCode(), _location + "/statusCode", cvm, diagnostic);
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.datatypes.TEL telecom: cOCTMT150000UV02Organization.getTelecom()){
					net.ihe.gazelle.hl7v3.datatypes.TEL.validateByModule(telecom, _location + "/telecom[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.datatypes.AD addr: cOCTMT150000UV02Organization.getAddr()){
					net.ihe.gazelle.hl7v3.datatypes.AD.validateByModule(addr, _location + "/addr[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
			net.ihe.gazelle.hl7v3.datatypes.CE.validateByModule(cOCTMT150000UV02Organization.getStandardIndustryClassCode(), _location + "/standardIndustryClassCode", cvm, diagnostic);
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationPartOf asOrganizationPartOf: cOCTMT150000UV02Organization.getAsOrganizationPartOf()){
					net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationPartOf.validateByModule(asOrganizationPartOf, _location + "/asOrganizationPartOf[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02ContactParty contactParty: cOCTMT150000UV02Organization.getContactParty()){
					net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02ContactParty.validateByModule(contactParty, _location + "/contactParty[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
			{
				int i = 0;
				for (net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationContains organizationContains: cOCTMT150000UV02Organization.getOrganizationContains()){
					net.ihe.gazelle.hl7v3.coctmt150000UV02.COCTMT150000UV02OrganizationContains.validateByModule(organizationContains, _location + "/organizationContains[" + i + "]", cvm, diagnostic);
					i++;
				}
			}
			
    	}
    }

}