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

// End of user code
import java.io.Serial;
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.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 SLISTPQ.
 *
 */

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SLIST_PQ", propOrder = {
	"origin",
	"scale",
	"digits"
})
@XmlRootElement(name = "SLIST_PQ")
public class SLISTPQ extends net.ihe.gazelle.hl7v3.datatypes.ANY implements java.io.Serializable {
	
	/**
	 * 
	 */
	@Serial
    private static final long serialVersionUID = 1L;

	
	/**
	 * 
	                     The origin of the list item value scale, i.e., the
	                     physical quantity that a zero-digit in the sequence
	                     would represent.
	                  .
	 */
	@XmlElement(name = "origin", required = true, namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.PQ origin;
	/**
	 * 
	                     A ratio-scale quantity that is factored out of the
	                     digit sequence.
	                  .
	 */
	@XmlElement(name = "scale", required = true, namespace = "urn:hl7-org:v3")
	public net.ihe.gazelle.hl7v3.datatypes.PQ scale;
	/**
	 * 
	                     A sequence of raw digits for the sample values. This is
	                     typically the raw output of an A/D converter.
	                  .
	 */
	@XmlElement(name = "digits", required = true, namespace = "urn:hl7-org:v3")
	public java.lang.String digits;
	
	/**
	 * An attribute containing marshalled element node
	 */
	@XmlTransient
	private org.w3c.dom.Node _xmlNodePresentation;
	
	
	/**
	 * Return origin.
	 * @return origin : 
	                     The origin of the list item value scale, i.e., the
	                     physical quantity that a zero-digit in the sequence
	                     would represent.
	 */
	public net.ihe.gazelle.hl7v3.datatypes.PQ getOrigin() {
	    return origin;
	}
	
	/**
	 * Set a value to attribute origin.
	 * @param origin : 
	                     The origin of the list item value scale, i.e., the
	                     physical quantity that a zero-digit in the sequence
	                     would represent.
	 */
	public void setOrigin(net.ihe.gazelle.hl7v3.datatypes.PQ origin) {
	    this.origin = origin;
	}
	
	
	
	
	/**
	 * Return scale.
	 * @return scale : 
	                     A ratio-scale quantity that is factored out of the
	                     digit sequence.
	 */
	public net.ihe.gazelle.hl7v3.datatypes.PQ getScale() {
	    return scale;
	}
	
	/**
	 * Set a value to attribute scale.
	 * @param scale : 
	                     A ratio-scale quantity that is factored out of the
	                     digit sequence.
	 */
	public void setScale(net.ihe.gazelle.hl7v3.datatypes.PQ scale) {
	    this.scale = scale;
	}
	
	
	
	
	/**
	 * Return digits.
	 * @return digits : 
	                     A sequence of raw digits for the sample values. This is
	                     typically the raw output of an A/D converter.
	 */
	public java.lang.String getDigits() {
	    return digits;
	}
	
	/**
	 * Set a value to attribute digits.
	 * @param digits : 
	                     A sequence of raw digits for the sample values. This is
	                     typically the raw output of an A/D converter.
	 */
	public void setDigits(java.lang.String digits) {
	    this.digits = digits;
	}
	

	
	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.datatypes");
					Marshaller m = jc.createMarshaller();
					m.marshal(this, doc);
					_xmlNodePresentation = doc.getElementsByTagNameNS("urn:hl7-org:v3", "SLIST_PQ").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(SLISTPQ sLISTPQ, String _location, ConstraintValidatorModule cvm, List<net.ihe.gazelle.validation.Notification> diagnostic){
   		if (sLISTPQ != null){
   			net.ihe.gazelle.hl7v3.datatypes.ANY.validateByModule(sLISTPQ, _location, cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.PQ.validateByModule(sLISTPQ.getOrigin(), _location + "/origin", cvm, diagnostic);
			net.ihe.gazelle.hl7v3.datatypes.PQ.validateByModule(sLISTPQ.getScale(), _location + "/scale", cvm, diagnostic);
    	}
    }

}