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 InvoicePriceComponentType {
037
038  /**
039   * the amount is the base price used for calculating the total price before
040   * applying surcharges, discount or taxes.
041   */
042  BASE,
043  /**
044   * the amount is a surcharge applied on the base price.
045   */
046  SURCHARGE,
047  /**
048   * the amount is a deduction applied on the base price.
049   */
050  DEDUCTION,
051  /**
052   * the amount is a discount applied on the base price.
053   */
054  DISCOUNT,
055  /**
056   * the amount is the tax component of the total price.
057   */
058  TAX,
059  /**
060   * the amount is of informational character, it has not been applied in the
061   * calculation of the total price.
062   */
063  INFORMATIONAL,
064  /**
065   * added to help the parsers
066   */
067  NULL;
068
069  public static InvoicePriceComponentType fromCode(String codeString) throws FHIRException {
070    if (codeString == null || "".equals(codeString))
071      return null;
072    if ("base".equals(codeString))
073      return BASE;
074    if ("surcharge".equals(codeString))
075      return SURCHARGE;
076    if ("deduction".equals(codeString))
077      return DEDUCTION;
078    if ("discount".equals(codeString))
079      return DISCOUNT;
080    if ("tax".equals(codeString))
081      return TAX;
082    if ("informational".equals(codeString))
083      return INFORMATIONAL;
084    throw new FHIRException("Unknown InvoicePriceComponentType code '" + codeString + "'");
085  }
086
087  public String toCode() {
088    switch (this) {
089    case BASE:
090      return "base";
091    case SURCHARGE:
092      return "surcharge";
093    case DEDUCTION:
094      return "deduction";
095    case DISCOUNT:
096      return "discount";
097    case TAX:
098      return "tax";
099    case INFORMATIONAL:
100      return "informational";
101    case NULL:
102      return null;
103    default:
104      return "?";
105    }
106  }
107
108  public String getSystem() {
109    return "http://hl7.org/fhir/invoice-priceComponentType";
110  }
111
112  public String getDefinition() {
113    switch (this) {
114    case BASE:
115      return "the amount is the base price used for calculating the total price before applying surcharges, discount or taxes.";
116    case SURCHARGE:
117      return "the amount is a surcharge applied on the base price.";
118    case DEDUCTION:
119      return "the amount is a deduction applied on the base price.";
120    case DISCOUNT:
121      return "the amount is a discount applied on the base price.";
122    case TAX:
123      return "the amount is the tax component of the total price.";
124    case INFORMATIONAL:
125      return "the amount is of informational character, it has not been applied in the calculation of the total price.";
126    case NULL:
127      return null;
128    default:
129      return "?";
130    }
131  }
132
133  public String getDisplay() {
134    switch (this) {
135    case BASE:
136      return "base price";
137    case SURCHARGE:
138      return "surcharge";
139    case DEDUCTION:
140      return "deduction";
141    case DISCOUNT:
142      return "discount";
143    case TAX:
144      return "tax";
145    case INFORMATIONAL:
146      return "informational";
147    case NULL:
148      return null;
149    default:
150      return "?";
151    }
152  }
153
154}