001package org.hl7.fhir.dstu3.model.codesystems;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu3
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, 
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this 
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, 
034     this list of conditions and the following disclaimer in the documentation 
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
049  POSSIBILITY OF SUCH DAMAGE.
050  
051*/
052
053// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
054
055
056import org.hl7.fhir.exceptions.FHIRException;
057
058public enum ItemType {
059
060        /**
061         * An item with no direct answer but should have at least one child item.
062         */
063        GROUP, 
064        /**
065         * Text for display that will not capture an answer or have child items.
066         */
067        DISPLAY, 
068        /**
069         * An item that defines a specific answer to be captured, and may have child items.
070(the answer provided in the QuestionnaireResponse should be of the defined datatype)
071         */
072        QUESTION, 
073        /**
074         * Question with a yes/no answer (valueBoolean)
075         */
076        BOOLEAN, 
077        /**
078         * Question with is a real number answer (valueDecimal)
079         */
080        DECIMAL, 
081        /**
082         * Question with an integer answer (valueInteger)
083         */
084        INTEGER, 
085        /**
086         * Question with a date answer (valueDate)
087         */
088        DATE, 
089        /**
090         * Question with a date and time answer (valueDateTime)
091         */
092        DATETIME, 
093        /**
094         * Question with a time (hour:minute:second) answer independent of date. (valueTime)
095         */
096        TIME, 
097        /**
098         * Question with a short (few words to short sentence) free-text entry answer (valueString)
099         */
100        STRING, 
101        /**
102         * Question with a long (potentially multi-paragraph) free-text entry answer (valueString)
103         */
104        TEXT, 
105        /**
106         * Question with a URL (website, FTP site, etc.) answer (valueUri)
107         */
108        URL, 
109        /**
110         * Question with a Coding drawn from a list of options (specified in either the option property, or via the valueset referenced in the options property) as an answer (valueCoding)
111         */
112        CHOICE, 
113        /**
114         * Answer is a Coding drawn from a list of options (as with the choice type) or a free-text entry in a string (valueCoding or valueString)
115         */
116        OPENCHOICE, 
117        /**
118         * Question with binary content such as a image, PDF, etc. as an answer (valueAttachment)
119         */
120        ATTACHMENT, 
121        /**
122         * Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference)
123         */
124        REFERENCE, 
125        /**
126         * Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity)
127There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit whould be captured (or the a unit that has a ucum conversion from the provided unit)
128         */
129        QUANTITY, 
130        /**
131         * added to help the parsers
132         */
133        NULL;
134        public static ItemType fromCode(String codeString) throws FHIRException {
135            if (codeString == null || "".equals(codeString))
136                return null;
137        if ("group".equals(codeString))
138          return GROUP;
139        if ("display".equals(codeString))
140          return DISPLAY;
141        if ("question".equals(codeString))
142          return QUESTION;
143        if ("boolean".equals(codeString))
144          return BOOLEAN;
145        if ("decimal".equals(codeString))
146          return DECIMAL;
147        if ("integer".equals(codeString))
148          return INTEGER;
149        if ("date".equals(codeString))
150          return DATE;
151        if ("dateTime".equals(codeString))
152          return DATETIME;
153        if ("time".equals(codeString))
154          return TIME;
155        if ("string".equals(codeString))
156          return STRING;
157        if ("text".equals(codeString))
158          return TEXT;
159        if ("url".equals(codeString))
160          return URL;
161        if ("choice".equals(codeString))
162          return CHOICE;
163        if ("open-choice".equals(codeString))
164          return OPENCHOICE;
165        if ("attachment".equals(codeString))
166          return ATTACHMENT;
167        if ("reference".equals(codeString))
168          return REFERENCE;
169        if ("quantity".equals(codeString))
170          return QUANTITY;
171        throw new FHIRException("Unknown ItemType code '"+codeString+"'");
172        }
173        public String toCode() {
174          switch (this) {
175            case GROUP: return "group";
176            case DISPLAY: return "display";
177            case QUESTION: return "question";
178            case BOOLEAN: return "boolean";
179            case DECIMAL: return "decimal";
180            case INTEGER: return "integer";
181            case DATE: return "date";
182            case DATETIME: return "dateTime";
183            case TIME: return "time";
184            case STRING: return "string";
185            case TEXT: return "text";
186            case URL: return "url";
187            case CHOICE: return "choice";
188            case OPENCHOICE: return "open-choice";
189            case ATTACHMENT: return "attachment";
190            case REFERENCE: return "reference";
191            case QUANTITY: return "quantity";
192            default: return "?";
193          }
194        }
195        public String getSystem() {
196          return "http://hl7.org/fhir/item-type";
197        }
198        public String getDefinition() {
199          switch (this) {
200            case GROUP: return "An item with no direct answer but should have at least one child item.";
201            case DISPLAY: return "Text for display that will not capture an answer or have child items.";
202            case QUESTION: return "An item that defines a specific answer to be captured, and may have child items.\n(the answer provided in the QuestionnaireResponse should be of the defined datatype)";
203            case BOOLEAN: return "Question with a yes/no answer (valueBoolean)";
204            case DECIMAL: return "Question with is a real number answer (valueDecimal)";
205            case INTEGER: return "Question with an integer answer (valueInteger)";
206            case DATE: return "Question with a date answer (valueDate)";
207            case DATETIME: return "Question with a date and time answer (valueDateTime)";
208            case TIME: return "Question with a time (hour:minute:second) answer independent of date. (valueTime)";
209            case STRING: return "Question with a short (few words to short sentence) free-text entry answer (valueString)";
210            case TEXT: return "Question with a long (potentially multi-paragraph) free-text entry answer (valueString)";
211            case URL: return "Question with a URL (website, FTP site, etc.) answer (valueUri)";
212            case CHOICE: return "Question with a Coding drawn from a list of options (specified in either the option property, or via the valueset referenced in the options property) as an answer (valueCoding)";
213            case OPENCHOICE: return "Answer is a Coding drawn from a list of options (as with the choice type) or a free-text entry in a string (valueCoding or valueString)";
214            case ATTACHMENT: return "Question with binary content such as a image, PDF, etc. as an answer (valueAttachment)";
215            case REFERENCE: return "Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference)";
216            case QUANTITY: return "Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity)\nThere is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit whould be captured (or the a unit that has a ucum conversion from the provided unit)";
217            default: return "?";
218          }
219        }
220        public String getDisplay() {
221          switch (this) {
222            case GROUP: return "Group";
223            case DISPLAY: return "Display";
224            case QUESTION: return "Question";
225            case BOOLEAN: return "Boolean";
226            case DECIMAL: return "Decimal";
227            case INTEGER: return "Integer";
228            case DATE: return "Date";
229            case DATETIME: return "Date Time";
230            case TIME: return "Time";
231            case STRING: return "String";
232            case TEXT: return "Text";
233            case URL: return "Url";
234            case CHOICE: return "Choice";
235            case OPENCHOICE: return "Open Choice";
236            case ATTACHMENT: return "Attachment";
237            case REFERENCE: return "Reference";
238            case QUANTITY: return "Quantity";
239            default: return "?";
240          }
241    }
242
243
244}
245