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 EncounterDiet {
037
038  /**
039   * Food without meat, poultry or seafood.
040   */
041  VEGETARIAN,
042  /**
043   * Excludes dairy products.
044   */
045  DAIRYFREE,
046  /**
047   * Excludes ingredients containing nuts.
048   */
049  NUTFREE,
050  /**
051   * Excludes ingredients containing gluten.
052   */
053  GLUTENFREE,
054  /**
055   * Food without meat, poultry, seafood, eggs, dairy products and other
056   * animal-derived substances.
057   */
058  VEGAN,
059  /**
060   * Foods that conform to Islamic law.
061   */
062  HALAL,
063  /**
064   * Foods that conform to Jewish dietary law.
065   */
066  KOSHER,
067  /**
068   * added to help the parsers
069   */
070  NULL;
071
072  public static EncounterDiet fromCode(String codeString) throws FHIRException {
073    if (codeString == null || "".equals(codeString))
074      return null;
075    if ("vegetarian".equals(codeString))
076      return VEGETARIAN;
077    if ("dairy-free".equals(codeString))
078      return DAIRYFREE;
079    if ("nut-free".equals(codeString))
080      return NUTFREE;
081    if ("gluten-free".equals(codeString))
082      return GLUTENFREE;
083    if ("vegan".equals(codeString))
084      return VEGAN;
085    if ("halal".equals(codeString))
086      return HALAL;
087    if ("kosher".equals(codeString))
088      return KOSHER;
089    throw new FHIRException("Unknown EncounterDiet code '" + codeString + "'");
090  }
091
092  public String toCode() {
093    switch (this) {
094    case VEGETARIAN:
095      return "vegetarian";
096    case DAIRYFREE:
097      return "dairy-free";
098    case NUTFREE:
099      return "nut-free";
100    case GLUTENFREE:
101      return "gluten-free";
102    case VEGAN:
103      return "vegan";
104    case HALAL:
105      return "halal";
106    case KOSHER:
107      return "kosher";
108    case NULL:
109      return null;
110    default:
111      return "?";
112    }
113  }
114
115  public String getSystem() {
116    return "http://terminology.hl7.org/CodeSystem/diet";
117  }
118
119  public String getDefinition() {
120    switch (this) {
121    case VEGETARIAN:
122      return "Food without meat, poultry or seafood.";
123    case DAIRYFREE:
124      return "Excludes dairy products.";
125    case NUTFREE:
126      return "Excludes ingredients containing nuts.";
127    case GLUTENFREE:
128      return "Excludes ingredients containing gluten.";
129    case VEGAN:
130      return "Food without meat, poultry, seafood, eggs, dairy products and other animal-derived substances.";
131    case HALAL:
132      return "Foods that conform to Islamic law.";
133    case KOSHER:
134      return "Foods that conform to Jewish dietary law.";
135    case NULL:
136      return null;
137    default:
138      return "?";
139    }
140  }
141
142  public String getDisplay() {
143    switch (this) {
144    case VEGETARIAN:
145      return "Vegetarian";
146    case DAIRYFREE:
147      return "Dairy Free";
148    case NUTFREE:
149      return "Nut Free";
150    case GLUTENFREE:
151      return "Gluten Free";
152    case VEGAN:
153      return "Vegan";
154    case HALAL:
155      return "Halal";
156    case KOSHER:
157      return "Kosher";
158    case NULL:
159      return null;
160    default:
161      return "?";
162    }
163  }
164
165}