001package org.hl7.fhir.dstu3.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 Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
033
034
035import org.hl7.fhir.exceptions.FHIRException;
036
037public enum DeviceStatus {
038
039  /**
040   * The Device is available for use.  Note: This means for *implanted devices*  the device is implanted in the patient.
041   */
042  ACTIVE,
043  /**
044   * The Device is no longer available for use (e.g. lost, expired, damaged).  Note: This means for *implanted devices*  the device has been removed from the patient.
045   */
046  INACTIVE,
047  /**
048   * The Device was entered in error and voided.
049   */
050  ENTEREDINERROR,
051  /**
052   * The status of the device has not been determined.
053   */
054  UNKNOWN,
055  /**
056   * added to help the parsers
057   */
058  NULL;
059
060  public String getDefinition() {
061    switch (this) {
062      case ACTIVE:
063        return "The Device is available for use.  Note: This means for *implanted devices*  the device is implanted in the patient.";
064      case INACTIVE:
065        return "The Device is no longer available for use (e.g. lost, expired, damaged).  Note: This means for *implanted devices*  the device has been removed from the patient.";
066      case ENTEREDINERROR:
067        return "The Device was entered in error and voided.";
068      case UNKNOWN:
069        return "The status of the device has not been determined.";
070      default:
071        return "?";
072    }
073  }
074
075  public String getDisplay() {
076    switch (this) {
077      case ACTIVE:
078        return "Active";
079      case INACTIVE:
080        return "Inactive";
081      case ENTEREDINERROR:
082        return "Entered in Error";
083      case UNKNOWN:
084        return "Unknown";
085      default:
086        return "?";
087    }
088  }
089
090  public String getSystem() {
091    return "http://hl7.org/fhir/device-status";
092  }
093
094  public String toCode() {
095    switch (this) {
096      case ACTIVE:
097        return "active";
098      case INACTIVE:
099        return "inactive";
100      case ENTEREDINERROR:
101        return "entered-in-error";
102      case UNKNOWN:
103        return "unknown";
104      default:
105        return "?";
106    }
107  }
108
109  public static DeviceStatus fromCode(String codeString) throws FHIRException {
110    if (codeString == null || "".equals(codeString))
111      return null;
112    if ("active".equals(codeString))
113      return ACTIVE;
114    if ("inactive".equals(codeString))
115      return INACTIVE;
116    if ("entered-in-error".equals(codeString))
117      return ENTEREDINERROR;
118    if ("unknown".equals(codeString))
119      return UNKNOWN;
120    throw new FHIRException("Unknown DeviceStatus code '" + codeString + "'");
121  }
122
123
124}
125