001package org.hl7.fhir.r5.openehr;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.r5.openehr.Enumerations.*;
038import org.hl7.fhir.exceptions.FHIRException;
039import org.hl7.fhir.r5.model.*;
040import org.hl7.fhir.instance.model.api.ICompositeType;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.DatatypeDef;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046
047/**
048 * Entry type for evaluation statements. Used for all kinds of statements which evaluate other information, such as interpretations of observations, diagnoses, differential diagnoses, hypotheses, risk assessments, goals and plans. Should not be used for actionable statements such as medication orders - these are represented using the INSTRUCTION type.
049 */
050@DatatypeDef(name="EVALUATION")
051public class EVALUATION extends CARE_ENTRY implements ICompositeType {
052
053    /**
054     * The data of this evaluation, in the form of a spatial data structure.
055     */
056    @Child(name = "data", type = {ITEM_STRUCTURE.class}, order=0, min=1, max=1, modifier=false, summary=false)
057    @Description(shortDefinition="The data of this evaluation, in the form of a spatial data structure", formalDefinition="The data of this evaluation, in the form of a spatial data structure." )
058    protected ITEM_STRUCTURE data;
059
060    private static final long serialVersionUID = 583338983L;
061
062  /**
063   * Constructor
064   */
065    public EVALUATION() {
066      super();
067    }
068
069  /**
070   * Constructor
071   */
072    public EVALUATION(ITEM_STRUCTURE data) {
073      super();
074      this.setData(data);
075    }
076
077    /**
078     * @return {@link #data} (The data of this evaluation, in the form of a spatial data structure.)
079     */
080    public ITEM_STRUCTURE getData() { 
081      return this.data;
082    }
083
084    public boolean hasData() { 
085      return this.data != null && !this.data.isEmpty();
086    }
087
088    /**
089     * @param value {@link #data} (The data of this evaluation, in the form of a spatial data structure.)
090     */
091    public EVALUATION setData(ITEM_STRUCTURE value) { 
092      this.data = value;
093      return this;
094    }
095
096      protected void listChildren(List<Property> children) {
097        super.listChildren(children);
098        children.add(new Property("data", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "The data of this evaluation, in the form of a spatial data structure.", 0, 1, data));
099      }
100
101      @Override
102      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
103        switch (_hash) {
104        case 3076010: /*data*/  return new Property("data", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "The data of this evaluation, in the form of a spatial data structure.", 0, 1, data);
105        default: return super.getNamedProperty(_hash, _name, _checkValid);
106        }
107
108      }
109
110      @Override
111      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
112        switch (hash) {
113        case 3076010: /*data*/ return this.data == null ? new Base[0] : new Base[] {this.data}; // ITEM_STRUCTURE
114        default: return super.getProperty(hash, name, checkValid);
115        }
116
117      }
118
119      @Override
120      public Base setProperty(int hash, String name, Base value) throws FHIRException {
121        switch (hash) {
122        case 3076010: // data
123          this.data = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE
124          return value;
125        default: return super.setProperty(hash, name, value);
126        }
127
128      }
129
130      @Override
131      public Base setProperty(String name, Base value) throws FHIRException {
132        if (name.equals("data")) {
133          this.data = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE
134        } else
135          return super.setProperty(name, value);
136        return value;
137      }
138
139      @Override
140      public Base makeProperty(int hash, String name) throws FHIRException {
141        switch (hash) {
142        case 3076010: /*div*/
143          throw new Error("Unable to make an instance of the abstract property 'data'");
144        default: return super.makeProperty(hash, name);
145        }
146
147      }
148
149      @Override
150      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
151        switch (hash) {
152        case 3076010: /*data*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE"};
153        default: return super.getTypesForProperty(hash, name);
154        }
155
156      }
157
158      @Override
159      public Base addChild(String name) throws FHIRException {
160        if (name.equals("data")) {
161          throw new FHIRException("Cannot call addChild on an abstract type EVALUATION.data");
162        }
163        else
164          return super.addChild(name);
165      }
166
167  public String fhirType() {
168    return "EVALUATION";
169
170  }
171
172      public EVALUATION copy() {
173        EVALUATION dst = new EVALUATION();
174        copyValues(dst);
175        return dst;
176      }
177
178      public void copyValues(EVALUATION dst) {
179        super.copyValues(dst);
180        dst.data = data == null ? null : data.copy();
181      }
182
183      protected EVALUATION typedCopy() {
184        return copy();
185      }
186
187      @Override
188      public boolean equalsDeep(Base other_) {
189        if (!super.equalsDeep(other_))
190          return false;
191        if (!(other_ instanceof EVALUATION))
192          return false;
193        EVALUATION o = (EVALUATION) other_;
194        return compareDeep(data, o.data, true);
195      }
196
197      @Override
198      public boolean equalsShallow(Base other_) {
199        if (!super.equalsShallow(other_))
200          return false;
201        if (!(other_ instanceof EVALUATION))
202          return false;
203        EVALUATION o = (EVALUATION) other_;
204        return true;
205      }
206
207      public boolean isEmpty() {
208        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(data);
209      }
210
211
212}
213