001package org.hl7.fhir.r4.model.codesystems;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0
033
034import org.hl7.fhir.exceptions.FHIRException;
035
036public enum PermittedDataType {
037
038  /**
039   * A measured amount.
040   */
041  QUANTITY,
042  /**
043   * A coded concept from a reference terminology and/or text.
044   */
045  CODEABLECONCEPT,
046  /**
047   * A sequence of Unicode characters.
048   */
049  STRING,
050  /**
051   * true or false.
052   */
053  BOOLEAN,
054  /**
055   * A signed integer.
056   */
057  INTEGER,
058  /**
059   * A set of values bounded by low and high.
060   */
061  RANGE,
062  /**
063   * A ratio of two Quantity values - a numerator and a denominator.
064   */
065  RATIO,
066  /**
067   * A series of measurements taken by a device.
068   */
069  SAMPLEDDATA,
070  /**
071   * A time during the day, in the format hh:mm:ss.
072   */
073  TIME,
074  /**
075   * A date, date-time or partial date (e.g. just year or year + month) as used in
076   * human communication.
077   */
078  DATETIME,
079  /**
080   * A time range defined by start and end date/time.
081   */
082  PERIOD,
083  /**
084   * added to help the parsers
085   */
086  NULL;
087
088  public static PermittedDataType fromCode(String codeString) throws FHIRException {
089    if (codeString == null || "".equals(codeString))
090      return null;
091    if ("Quantity".equals(codeString))
092      return QUANTITY;
093    if ("CodeableConcept".equals(codeString))
094      return CODEABLECONCEPT;
095    if ("string".equals(codeString))
096      return STRING;
097    if ("boolean".equals(codeString))
098      return BOOLEAN;
099    if ("integer".equals(codeString))
100      return INTEGER;
101    if ("Range".equals(codeString))
102      return RANGE;
103    if ("Ratio".equals(codeString))
104      return RATIO;
105    if ("SampledData".equals(codeString))
106      return SAMPLEDDATA;
107    if ("time".equals(codeString))
108      return TIME;
109    if ("dateTime".equals(codeString))
110      return DATETIME;
111    if ("Period".equals(codeString))
112      return PERIOD;
113    throw new FHIRException("Unknown PermittedDataType code '" + codeString + "'");
114  }
115
116  public String toCode() {
117    switch (this) {
118    case QUANTITY:
119      return "Quantity";
120    case CODEABLECONCEPT:
121      return "CodeableConcept";
122    case STRING:
123      return "string";
124    case BOOLEAN:
125      return "boolean";
126    case INTEGER:
127      return "integer";
128    case RANGE:
129      return "Range";
130    case RATIO:
131      return "Ratio";
132    case SAMPLEDDATA:
133      return "SampledData";
134    case TIME:
135      return "time";
136    case DATETIME:
137      return "dateTime";
138    case PERIOD:
139      return "Period";
140    case NULL:
141      return null;
142    default:
143      return "?";
144    }
145  }
146
147  public String getSystem() {
148    return "http://hl7.org/fhir/permitted-data-type";
149  }
150
151  public String getDefinition() {
152    switch (this) {
153    case QUANTITY:
154      return "A measured amount.";
155    case CODEABLECONCEPT:
156      return "A coded concept from a reference terminology and/or text.";
157    case STRING:
158      return "A sequence of Unicode characters.";
159    case BOOLEAN:
160      return "true or false.";
161    case INTEGER:
162      return "A signed integer.";
163    case RANGE:
164      return "A set of values bounded by low and high.";
165    case RATIO:
166      return "A ratio of two Quantity values - a numerator and a denominator.";
167    case SAMPLEDDATA:
168      return "A series of measurements taken by a device.";
169    case TIME:
170      return "A time during the day, in the format hh:mm:ss.";
171    case DATETIME:
172      return "A date, date-time or partial date (e.g. just year or year + month) as used in human communication.";
173    case PERIOD:
174      return "A time range defined by start and end date/time.";
175    case NULL:
176      return null;
177    default:
178      return "?";
179    }
180  }
181
182  public String getDisplay() {
183    switch (this) {
184    case QUANTITY:
185      return "Quantity";
186    case CODEABLECONCEPT:
187      return "CodeableConcept";
188    case STRING:
189      return "string";
190    case BOOLEAN:
191      return "boolean";
192    case INTEGER:
193      return "integer";
194    case RANGE:
195      return "Range";
196    case RATIO:
197      return "Ratio";
198    case SAMPLEDDATA:
199      return "SampledData";
200    case TIME:
201      return "time";
202    case DATETIME:
203      return "dateTime";
204    case PERIOD:
205      return "Period";
206    case NULL:
207      return null;
208    default:
209      return "?";
210    }
211  }
212
213}