001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * Financial instrument which may be used to reimburse or pay for health care products and services. Includes both insurance and self-payment.
050 */
051@ResourceDef(name="Coverage", profile="http://hl7.org/fhir/StructureDefinition/Coverage")
052public class Coverage extends DomainResource {
053
054    public enum CoverageStatus {
055        /**
056         * The instance is currently in-force.
057         */
058        ACTIVE, 
059        /**
060         * The instance is withdrawn, rescinded or reversed.
061         */
062        CANCELLED, 
063        /**
064         * A new instance the contents of which is not complete.
065         */
066        DRAFT, 
067        /**
068         * The instance was entered in error.
069         */
070        ENTEREDINERROR, 
071        /**
072         * added to help the parsers with the generic types
073         */
074        NULL;
075        public static CoverageStatus fromCode(String codeString) throws FHIRException {
076            if (codeString == null || "".equals(codeString))
077                return null;
078        if ("active".equals(codeString))
079          return ACTIVE;
080        if ("cancelled".equals(codeString))
081          return CANCELLED;
082        if ("draft".equals(codeString))
083          return DRAFT;
084        if ("entered-in-error".equals(codeString))
085          return ENTEREDINERROR;
086        if (Configuration.isAcceptInvalidEnums())
087          return null;
088        else
089          throw new FHIRException("Unknown CoverageStatus code '"+codeString+"'");
090        }
091        public String toCode() {
092          switch (this) {
093            case ACTIVE: return "active";
094            case CANCELLED: return "cancelled";
095            case DRAFT: return "draft";
096            case ENTEREDINERROR: return "entered-in-error";
097            case NULL: return null;
098            default: return "?";
099          }
100        }
101        public String getSystem() {
102          switch (this) {
103            case ACTIVE: return "http://hl7.org/fhir/fm-status";
104            case CANCELLED: return "http://hl7.org/fhir/fm-status";
105            case DRAFT: return "http://hl7.org/fhir/fm-status";
106            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
107            case NULL: return null;
108            default: return "?";
109          }
110        }
111        public String getDefinition() {
112          switch (this) {
113            case ACTIVE: return "The instance is currently in-force.";
114            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
115            case DRAFT: return "A new instance the contents of which is not complete.";
116            case ENTEREDINERROR: return "The instance was entered in error.";
117            case NULL: return null;
118            default: return "?";
119          }
120        }
121        public String getDisplay() {
122          switch (this) {
123            case ACTIVE: return "Active";
124            case CANCELLED: return "Cancelled";
125            case DRAFT: return "Draft";
126            case ENTEREDINERROR: return "Entered in Error";
127            case NULL: return null;
128            default: return "?";
129          }
130        }
131    }
132
133  public static class CoverageStatusEnumFactory implements EnumFactory<CoverageStatus> {
134    public CoverageStatus fromCode(String codeString) throws IllegalArgumentException {
135      if (codeString == null || "".equals(codeString))
136            if (codeString == null || "".equals(codeString))
137                return null;
138        if ("active".equals(codeString))
139          return CoverageStatus.ACTIVE;
140        if ("cancelled".equals(codeString))
141          return CoverageStatus.CANCELLED;
142        if ("draft".equals(codeString))
143          return CoverageStatus.DRAFT;
144        if ("entered-in-error".equals(codeString))
145          return CoverageStatus.ENTEREDINERROR;
146        throw new IllegalArgumentException("Unknown CoverageStatus code '"+codeString+"'");
147        }
148        public Enumeration<CoverageStatus> fromType(Base code) throws FHIRException {
149          if (code == null)
150            return null;
151          if (code.isEmpty())
152            return new Enumeration<CoverageStatus>(this);
153          String codeString = ((PrimitiveType) code).asStringValue();
154          if (codeString == null || "".equals(codeString))
155            return null;
156        if ("active".equals(codeString))
157          return new Enumeration<CoverageStatus>(this, CoverageStatus.ACTIVE);
158        if ("cancelled".equals(codeString))
159          return new Enumeration<CoverageStatus>(this, CoverageStatus.CANCELLED);
160        if ("draft".equals(codeString))
161          return new Enumeration<CoverageStatus>(this, CoverageStatus.DRAFT);
162        if ("entered-in-error".equals(codeString))
163          return new Enumeration<CoverageStatus>(this, CoverageStatus.ENTEREDINERROR);
164        throw new FHIRException("Unknown CoverageStatus code '"+codeString+"'");
165        }
166    public String toCode(CoverageStatus code) {
167      if (code == CoverageStatus.ACTIVE)
168        return "active";
169      if (code == CoverageStatus.CANCELLED)
170        return "cancelled";
171      if (code == CoverageStatus.DRAFT)
172        return "draft";
173      if (code == CoverageStatus.ENTEREDINERROR)
174        return "entered-in-error";
175      return "?";
176      }
177    public String toSystem(CoverageStatus code) {
178      return code.getSystem();
179      }
180    }
181
182    @Block()
183    public static class ClassComponent extends BackboneElement implements IBaseBackboneElement {
184        /**
185         * The type of classification for which an insurer-specific class label or number and optional name is provided, for example may be used to identify a class of coverage or employer group, Policy, Plan.
186         */
187        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
188        @Description(shortDefinition="Type of class such as 'group' or 'plan'", formalDefinition="The type of classification for which an insurer-specific class label or number and optional name is provided, for example may be used to identify a class of coverage or employer group, Policy, Plan." )
189        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/coverage-class")
190        protected CodeableConcept type;
191
192        /**
193         * The alphanumeric string value associated with the insurer issued label.
194         */
195        @Child(name = "value", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
196        @Description(shortDefinition="Value associated with the type", formalDefinition="The alphanumeric string value associated with the insurer issued label." )
197        protected StringType value;
198
199        /**
200         * A short description for the class.
201         */
202        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
203        @Description(shortDefinition="Human readable description of the type and value", formalDefinition="A short description for the class." )
204        protected StringType name;
205
206        private static final long serialVersionUID = -1501519769L;
207
208    /**
209     * Constructor
210     */
211      public ClassComponent() {
212        super();
213      }
214
215    /**
216     * Constructor
217     */
218      public ClassComponent(CodeableConcept type, StringType value) {
219        super();
220        this.type = type;
221        this.value = value;
222      }
223
224        /**
225         * @return {@link #type} (The type of classification for which an insurer-specific class label or number and optional name is provided, for example may be used to identify a class of coverage or employer group, Policy, Plan.)
226         */
227        public CodeableConcept getType() { 
228          if (this.type == null)
229            if (Configuration.errorOnAutoCreate())
230              throw new Error("Attempt to auto-create ClassComponent.type");
231            else if (Configuration.doAutoCreate())
232              this.type = new CodeableConcept(); // cc
233          return this.type;
234        }
235
236        public boolean hasType() { 
237          return this.type != null && !this.type.isEmpty();
238        }
239
240        /**
241         * @param value {@link #type} (The type of classification for which an insurer-specific class label or number and optional name is provided, for example may be used to identify a class of coverage or employer group, Policy, Plan.)
242         */
243        public ClassComponent setType(CodeableConcept value) { 
244          this.type = value;
245          return this;
246        }
247
248        /**
249         * @return {@link #value} (The alphanumeric string value associated with the insurer issued label.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
250         */
251        public StringType getValueElement() { 
252          if (this.value == null)
253            if (Configuration.errorOnAutoCreate())
254              throw new Error("Attempt to auto-create ClassComponent.value");
255            else if (Configuration.doAutoCreate())
256              this.value = new StringType(); // bb
257          return this.value;
258        }
259
260        public boolean hasValueElement() { 
261          return this.value != null && !this.value.isEmpty();
262        }
263
264        public boolean hasValue() { 
265          return this.value != null && !this.value.isEmpty();
266        }
267
268        /**
269         * @param value {@link #value} (The alphanumeric string value associated with the insurer issued label.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
270         */
271        public ClassComponent setValueElement(StringType value) { 
272          this.value = value;
273          return this;
274        }
275
276        /**
277         * @return The alphanumeric string value associated with the insurer issued label.
278         */
279        public String getValue() { 
280          return this.value == null ? null : this.value.getValue();
281        }
282
283        /**
284         * @param value The alphanumeric string value associated with the insurer issued label.
285         */
286        public ClassComponent setValue(String value) { 
287            if (this.value == null)
288              this.value = new StringType();
289            this.value.setValue(value);
290          return this;
291        }
292
293        /**
294         * @return {@link #name} (A short description for the class.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
295         */
296        public StringType getNameElement() { 
297          if (this.name == null)
298            if (Configuration.errorOnAutoCreate())
299              throw new Error("Attempt to auto-create ClassComponent.name");
300            else if (Configuration.doAutoCreate())
301              this.name = new StringType(); // bb
302          return this.name;
303        }
304
305        public boolean hasNameElement() { 
306          return this.name != null && !this.name.isEmpty();
307        }
308
309        public boolean hasName() { 
310          return this.name != null && !this.name.isEmpty();
311        }
312
313        /**
314         * @param value {@link #name} (A short description for the class.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
315         */
316        public ClassComponent setNameElement(StringType value) { 
317          this.name = value;
318          return this;
319        }
320
321        /**
322         * @return A short description for the class.
323         */
324        public String getName() { 
325          return this.name == null ? null : this.name.getValue();
326        }
327
328        /**
329         * @param value A short description for the class.
330         */
331        public ClassComponent setName(String value) { 
332          if (Utilities.noString(value))
333            this.name = null;
334          else {
335            if (this.name == null)
336              this.name = new StringType();
337            this.name.setValue(value);
338          }
339          return this;
340        }
341
342        protected void listChildren(List<Property> children) {
343          super.listChildren(children);
344          children.add(new Property("type", "CodeableConcept", "The type of classification for which an insurer-specific class label or number and optional name is provided, for example may be used to identify a class of coverage or employer group, Policy, Plan.", 0, 1, type));
345          children.add(new Property("value", "string", "The alphanumeric string value associated with the insurer issued label.", 0, 1, value));
346          children.add(new Property("name", "string", "A short description for the class.", 0, 1, name));
347        }
348
349        @Override
350        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
351          switch (_hash) {
352          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of classification for which an insurer-specific class label or number and optional name is provided, for example may be used to identify a class of coverage or employer group, Policy, Plan.", 0, 1, type);
353          case 111972721: /*value*/  return new Property("value", "string", "The alphanumeric string value associated with the insurer issued label.", 0, 1, value);
354          case 3373707: /*name*/  return new Property("name", "string", "A short description for the class.", 0, 1, name);
355          default: return super.getNamedProperty(_hash, _name, _checkValid);
356          }
357
358        }
359
360      @Override
361      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
362        switch (hash) {
363        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
364        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
365        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
366        default: return super.getProperty(hash, name, checkValid);
367        }
368
369      }
370
371      @Override
372      public Base setProperty(int hash, String name, Base value) throws FHIRException {
373        switch (hash) {
374        case 3575610: // type
375          this.type = castToCodeableConcept(value); // CodeableConcept
376          return value;
377        case 111972721: // value
378          this.value = castToString(value); // StringType
379          return value;
380        case 3373707: // name
381          this.name = castToString(value); // StringType
382          return value;
383        default: return super.setProperty(hash, name, value);
384        }
385
386      }
387
388      @Override
389      public Base setProperty(String name, Base value) throws FHIRException {
390        if (name.equals("type")) {
391          this.type = castToCodeableConcept(value); // CodeableConcept
392        } else if (name.equals("value")) {
393          this.value = castToString(value); // StringType
394        } else if (name.equals("name")) {
395          this.name = castToString(value); // StringType
396        } else
397          return super.setProperty(name, value);
398        return value;
399      }
400
401      @Override
402      public Base makeProperty(int hash, String name) throws FHIRException {
403        switch (hash) {
404        case 3575610:  return getType(); 
405        case 111972721:  return getValueElement();
406        case 3373707:  return getNameElement();
407        default: return super.makeProperty(hash, name);
408        }
409
410      }
411
412      @Override
413      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
414        switch (hash) {
415        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
416        case 111972721: /*value*/ return new String[] {"string"};
417        case 3373707: /*name*/ return new String[] {"string"};
418        default: return super.getTypesForProperty(hash, name);
419        }
420
421      }
422
423      @Override
424      public Base addChild(String name) throws FHIRException {
425        if (name.equals("type")) {
426          this.type = new CodeableConcept();
427          return this.type;
428        }
429        else if (name.equals("value")) {
430          throw new FHIRException("Cannot call addChild on a primitive type Coverage.value");
431        }
432        else if (name.equals("name")) {
433          throw new FHIRException("Cannot call addChild on a primitive type Coverage.name");
434        }
435        else
436          return super.addChild(name);
437      }
438
439      public ClassComponent copy() {
440        ClassComponent dst = new ClassComponent();
441        copyValues(dst);
442        return dst;
443      }
444
445      public void copyValues(ClassComponent dst) {
446        super.copyValues(dst);
447        dst.type = type == null ? null : type.copy();
448        dst.value = value == null ? null : value.copy();
449        dst.name = name == null ? null : name.copy();
450      }
451
452      @Override
453      public boolean equalsDeep(Base other_) {
454        if (!super.equalsDeep(other_))
455          return false;
456        if (!(other_ instanceof ClassComponent))
457          return false;
458        ClassComponent o = (ClassComponent) other_;
459        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true) && compareDeep(name, o.name, true)
460          ;
461      }
462
463      @Override
464      public boolean equalsShallow(Base other_) {
465        if (!super.equalsShallow(other_))
466          return false;
467        if (!(other_ instanceof ClassComponent))
468          return false;
469        ClassComponent o = (ClassComponent) other_;
470        return compareValues(value, o.value, true) && compareValues(name, o.name, true);
471      }
472
473      public boolean isEmpty() {
474        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value, name);
475      }
476
477  public String fhirType() {
478    return "Coverage.class";
479
480  }
481
482  }
483
484    @Block()
485    public static class CostToBeneficiaryComponent extends BackboneElement implements IBaseBackboneElement {
486        /**
487         * The category of patient centric costs associated with treatment.
488         */
489        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
490        @Description(shortDefinition="Cost category", formalDefinition="The category of patient centric costs associated with treatment." )
491        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/coverage-copay-type")
492        protected CodeableConcept type;
493
494        /**
495         * The amount due from the patient for the cost category.
496         */
497        @Child(name = "value", type = {Quantity.class, Money.class}, order=2, min=1, max=1, modifier=false, summary=true)
498        @Description(shortDefinition="The amount or percentage due from the beneficiary", formalDefinition="The amount due from the patient for the cost category." )
499        protected Type value;
500
501        /**
502         * A suite of codes indicating exceptions or reductions to patient costs and their effective periods.
503         */
504        @Child(name = "exception", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
505        @Description(shortDefinition="Exceptions for patient payments", formalDefinition="A suite of codes indicating exceptions or reductions to patient costs and their effective periods." )
506        protected List<ExemptionComponent> exception;
507
508        private static final long serialVersionUID = -1302829059L;
509
510    /**
511     * Constructor
512     */
513      public CostToBeneficiaryComponent() {
514        super();
515      }
516
517    /**
518     * Constructor
519     */
520      public CostToBeneficiaryComponent(Type value) {
521        super();
522        this.value = value;
523      }
524
525        /**
526         * @return {@link #type} (The category of patient centric costs associated with treatment.)
527         */
528        public CodeableConcept getType() { 
529          if (this.type == null)
530            if (Configuration.errorOnAutoCreate())
531              throw new Error("Attempt to auto-create CostToBeneficiaryComponent.type");
532            else if (Configuration.doAutoCreate())
533              this.type = new CodeableConcept(); // cc
534          return this.type;
535        }
536
537        public boolean hasType() { 
538          return this.type != null && !this.type.isEmpty();
539        }
540
541        /**
542         * @param value {@link #type} (The category of patient centric costs associated with treatment.)
543         */
544        public CostToBeneficiaryComponent setType(CodeableConcept value) { 
545          this.type = value;
546          return this;
547        }
548
549        /**
550         * @return {@link #value} (The amount due from the patient for the cost category.)
551         */
552        public Type getValue() { 
553          return this.value;
554        }
555
556        /**
557         * @return {@link #value} (The amount due from the patient for the cost category.)
558         */
559        public Quantity getValueQuantity() throws FHIRException { 
560          if (this.value == null)
561            this.value = new Quantity();
562          if (!(this.value instanceof Quantity))
563            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
564          return (Quantity) this.value;
565        }
566
567        public boolean hasValueQuantity() { 
568          return this != null && this.value instanceof Quantity;
569        }
570
571        /**
572         * @return {@link #value} (The amount due from the patient for the cost category.)
573         */
574        public Money getValueMoney() throws FHIRException { 
575          if (this.value == null)
576            this.value = new Money();
577          if (!(this.value instanceof Money))
578            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.value.getClass().getName()+" was encountered");
579          return (Money) this.value;
580        }
581
582        public boolean hasValueMoney() { 
583          return this != null && this.value instanceof Money;
584        }
585
586        public boolean hasValue() { 
587          return this.value != null && !this.value.isEmpty();
588        }
589
590        /**
591         * @param value {@link #value} (The amount due from the patient for the cost category.)
592         */
593        public CostToBeneficiaryComponent setValue(Type value) { 
594          if (value != null && !(value instanceof Quantity || value instanceof Money))
595            throw new Error("Not the right type for Coverage.costToBeneficiary.value[x]: "+value.fhirType());
596          this.value = value;
597          return this;
598        }
599
600        /**
601         * @return {@link #exception} (A suite of codes indicating exceptions or reductions to patient costs and their effective periods.)
602         */
603        public List<ExemptionComponent> getException() { 
604          if (this.exception == null)
605            this.exception = new ArrayList<ExemptionComponent>();
606          return this.exception;
607        }
608
609        /**
610         * @return Returns a reference to <code>this</code> for easy method chaining
611         */
612        public CostToBeneficiaryComponent setException(List<ExemptionComponent> theException) { 
613          this.exception = theException;
614          return this;
615        }
616
617        public boolean hasException() { 
618          if (this.exception == null)
619            return false;
620          for (ExemptionComponent item : this.exception)
621            if (!item.isEmpty())
622              return true;
623          return false;
624        }
625
626        public ExemptionComponent addException() { //3
627          ExemptionComponent t = new ExemptionComponent();
628          if (this.exception == null)
629            this.exception = new ArrayList<ExemptionComponent>();
630          this.exception.add(t);
631          return t;
632        }
633
634        public CostToBeneficiaryComponent addException(ExemptionComponent t) { //3
635          if (t == null)
636            return this;
637          if (this.exception == null)
638            this.exception = new ArrayList<ExemptionComponent>();
639          this.exception.add(t);
640          return this;
641        }
642
643        /**
644         * @return The first repetition of repeating field {@link #exception}, creating it if it does not already exist
645         */
646        public ExemptionComponent getExceptionFirstRep() { 
647          if (getException().isEmpty()) {
648            addException();
649          }
650          return getException().get(0);
651        }
652
653        protected void listChildren(List<Property> children) {
654          super.listChildren(children);
655          children.add(new Property("type", "CodeableConcept", "The category of patient centric costs associated with treatment.", 0, 1, type));
656          children.add(new Property("value[x]", "SimpleQuantity|Money", "The amount due from the patient for the cost category.", 0, 1, value));
657          children.add(new Property("exception", "", "A suite of codes indicating exceptions or reductions to patient costs and their effective periods.", 0, java.lang.Integer.MAX_VALUE, exception));
658        }
659
660        @Override
661        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
662          switch (_hash) {
663          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of patient centric costs associated with treatment.", 0, 1, type);
664          case -1410166417: /*value[x]*/  return new Property("value[x]", "SimpleQuantity|Money", "The amount due from the patient for the cost category.", 0, 1, value);
665          case 111972721: /*value*/  return new Property("value[x]", "SimpleQuantity|Money", "The amount due from the patient for the cost category.", 0, 1, value);
666          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "SimpleQuantity|Money", "The amount due from the patient for the cost category.", 0, 1, value);
667          case 2026560975: /*valueMoney*/  return new Property("value[x]", "SimpleQuantity|Money", "The amount due from the patient for the cost category.", 0, 1, value);
668          case 1481625679: /*exception*/  return new Property("exception", "", "A suite of codes indicating exceptions or reductions to patient costs and their effective periods.", 0, java.lang.Integer.MAX_VALUE, exception);
669          default: return super.getNamedProperty(_hash, _name, _checkValid);
670          }
671
672        }
673
674      @Override
675      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
676        switch (hash) {
677        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
678        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
679        case 1481625679: /*exception*/ return this.exception == null ? new Base[0] : this.exception.toArray(new Base[this.exception.size()]); // ExemptionComponent
680        default: return super.getProperty(hash, name, checkValid);
681        }
682
683      }
684
685      @Override
686      public Base setProperty(int hash, String name, Base value) throws FHIRException {
687        switch (hash) {
688        case 3575610: // type
689          this.type = castToCodeableConcept(value); // CodeableConcept
690          return value;
691        case 111972721: // value
692          this.value = castToType(value); // Type
693          return value;
694        case 1481625679: // exception
695          this.getException().add((ExemptionComponent) value); // ExemptionComponent
696          return value;
697        default: return super.setProperty(hash, name, value);
698        }
699
700      }
701
702      @Override
703      public Base setProperty(String name, Base value) throws FHIRException {
704        if (name.equals("type")) {
705          this.type = castToCodeableConcept(value); // CodeableConcept
706        } else if (name.equals("value[x]")) {
707          this.value = castToType(value); // Type
708        } else if (name.equals("exception")) {
709          this.getException().add((ExemptionComponent) value);
710        } else
711          return super.setProperty(name, value);
712        return value;
713      }
714
715      @Override
716      public Base makeProperty(int hash, String name) throws FHIRException {
717        switch (hash) {
718        case 3575610:  return getType(); 
719        case -1410166417:  return getValue(); 
720        case 111972721:  return getValue(); 
721        case 1481625679:  return addException(); 
722        default: return super.makeProperty(hash, name);
723        }
724
725      }
726
727      @Override
728      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
729        switch (hash) {
730        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
731        case 111972721: /*value*/ return new String[] {"SimpleQuantity", "Money"};
732        case 1481625679: /*exception*/ return new String[] {};
733        default: return super.getTypesForProperty(hash, name);
734        }
735
736      }
737
738      @Override
739      public Base addChild(String name) throws FHIRException {
740        if (name.equals("type")) {
741          this.type = new CodeableConcept();
742          return this.type;
743        }
744        else if (name.equals("valueQuantity")) {
745          this.value = new Quantity();
746          return this.value;
747        }
748        else if (name.equals("valueMoney")) {
749          this.value = new Money();
750          return this.value;
751        }
752        else if (name.equals("exception")) {
753          return addException();
754        }
755        else
756          return super.addChild(name);
757      }
758
759      public CostToBeneficiaryComponent copy() {
760        CostToBeneficiaryComponent dst = new CostToBeneficiaryComponent();
761        copyValues(dst);
762        return dst;
763      }
764
765      public void copyValues(CostToBeneficiaryComponent dst) {
766        super.copyValues(dst);
767        dst.type = type == null ? null : type.copy();
768        dst.value = value == null ? null : value.copy();
769        if (exception != null) {
770          dst.exception = new ArrayList<ExemptionComponent>();
771          for (ExemptionComponent i : exception)
772            dst.exception.add(i.copy());
773        };
774      }
775
776      @Override
777      public boolean equalsDeep(Base other_) {
778        if (!super.equalsDeep(other_))
779          return false;
780        if (!(other_ instanceof CostToBeneficiaryComponent))
781          return false;
782        CostToBeneficiaryComponent o = (CostToBeneficiaryComponent) other_;
783        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true) && compareDeep(exception, o.exception, true)
784          ;
785      }
786
787      @Override
788      public boolean equalsShallow(Base other_) {
789        if (!super.equalsShallow(other_))
790          return false;
791        if (!(other_ instanceof CostToBeneficiaryComponent))
792          return false;
793        CostToBeneficiaryComponent o = (CostToBeneficiaryComponent) other_;
794        return true;
795      }
796
797      public boolean isEmpty() {
798        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value, exception);
799      }
800
801  public String fhirType() {
802    return "Coverage.costToBeneficiary";
803
804  }
805
806  }
807
808    @Block()
809    public static class ExemptionComponent extends BackboneElement implements IBaseBackboneElement {
810        /**
811         * The code for the specific exception.
812         */
813        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
814        @Description(shortDefinition="Exception category", formalDefinition="The code for the specific exception." )
815        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/coverage-financial-exception")
816        protected CodeableConcept type;
817
818        /**
819         * The timeframe during when the exception is in force.
820         */
821        @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
822        @Description(shortDefinition="The effective period of the exception", formalDefinition="The timeframe during when the exception is in force." )
823        protected Period period;
824
825        private static final long serialVersionUID = 523191991L;
826
827    /**
828     * Constructor
829     */
830      public ExemptionComponent() {
831        super();
832      }
833
834    /**
835     * Constructor
836     */
837      public ExemptionComponent(CodeableConcept type) {
838        super();
839        this.type = type;
840      }
841
842        /**
843         * @return {@link #type} (The code for the specific exception.)
844         */
845        public CodeableConcept getType() { 
846          if (this.type == null)
847            if (Configuration.errorOnAutoCreate())
848              throw new Error("Attempt to auto-create ExemptionComponent.type");
849            else if (Configuration.doAutoCreate())
850              this.type = new CodeableConcept(); // cc
851          return this.type;
852        }
853
854        public boolean hasType() { 
855          return this.type != null && !this.type.isEmpty();
856        }
857
858        /**
859         * @param value {@link #type} (The code for the specific exception.)
860         */
861        public ExemptionComponent setType(CodeableConcept value) { 
862          this.type = value;
863          return this;
864        }
865
866        /**
867         * @return {@link #period} (The timeframe during when the exception is in force.)
868         */
869        public Period getPeriod() { 
870          if (this.period == null)
871            if (Configuration.errorOnAutoCreate())
872              throw new Error("Attempt to auto-create ExemptionComponent.period");
873            else if (Configuration.doAutoCreate())
874              this.period = new Period(); // cc
875          return this.period;
876        }
877
878        public boolean hasPeriod() { 
879          return this.period != null && !this.period.isEmpty();
880        }
881
882        /**
883         * @param value {@link #period} (The timeframe during when the exception is in force.)
884         */
885        public ExemptionComponent setPeriod(Period value) { 
886          this.period = value;
887          return this;
888        }
889
890        protected void listChildren(List<Property> children) {
891          super.listChildren(children);
892          children.add(new Property("type", "CodeableConcept", "The code for the specific exception.", 0, 1, type));
893          children.add(new Property("period", "Period", "The timeframe during when the exception is in force.", 0, 1, period));
894        }
895
896        @Override
897        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
898          switch (_hash) {
899          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The code for the specific exception.", 0, 1, type);
900          case -991726143: /*period*/  return new Property("period", "Period", "The timeframe during when the exception is in force.", 0, 1, period);
901          default: return super.getNamedProperty(_hash, _name, _checkValid);
902          }
903
904        }
905
906      @Override
907      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
908        switch (hash) {
909        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
910        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
911        default: return super.getProperty(hash, name, checkValid);
912        }
913
914      }
915
916      @Override
917      public Base setProperty(int hash, String name, Base value) throws FHIRException {
918        switch (hash) {
919        case 3575610: // type
920          this.type = castToCodeableConcept(value); // CodeableConcept
921          return value;
922        case -991726143: // period
923          this.period = castToPeriod(value); // Period
924          return value;
925        default: return super.setProperty(hash, name, value);
926        }
927
928      }
929
930      @Override
931      public Base setProperty(String name, Base value) throws FHIRException {
932        if (name.equals("type")) {
933          this.type = castToCodeableConcept(value); // CodeableConcept
934        } else if (name.equals("period")) {
935          this.period = castToPeriod(value); // Period
936        } else
937          return super.setProperty(name, value);
938        return value;
939      }
940
941      @Override
942      public Base makeProperty(int hash, String name) throws FHIRException {
943        switch (hash) {
944        case 3575610:  return getType(); 
945        case -991726143:  return getPeriod(); 
946        default: return super.makeProperty(hash, name);
947        }
948
949      }
950
951      @Override
952      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
953        switch (hash) {
954        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
955        case -991726143: /*period*/ return new String[] {"Period"};
956        default: return super.getTypesForProperty(hash, name);
957        }
958
959      }
960
961      @Override
962      public Base addChild(String name) throws FHIRException {
963        if (name.equals("type")) {
964          this.type = new CodeableConcept();
965          return this.type;
966        }
967        else if (name.equals("period")) {
968          this.period = new Period();
969          return this.period;
970        }
971        else
972          return super.addChild(name);
973      }
974
975      public ExemptionComponent copy() {
976        ExemptionComponent dst = new ExemptionComponent();
977        copyValues(dst);
978        return dst;
979      }
980
981      public void copyValues(ExemptionComponent dst) {
982        super.copyValues(dst);
983        dst.type = type == null ? null : type.copy();
984        dst.period = period == null ? null : period.copy();
985      }
986
987      @Override
988      public boolean equalsDeep(Base other_) {
989        if (!super.equalsDeep(other_))
990          return false;
991        if (!(other_ instanceof ExemptionComponent))
992          return false;
993        ExemptionComponent o = (ExemptionComponent) other_;
994        return compareDeep(type, o.type, true) && compareDeep(period, o.period, true);
995      }
996
997      @Override
998      public boolean equalsShallow(Base other_) {
999        if (!super.equalsShallow(other_))
1000          return false;
1001        if (!(other_ instanceof ExemptionComponent))
1002          return false;
1003        ExemptionComponent o = (ExemptionComponent) other_;
1004        return true;
1005      }
1006
1007      public boolean isEmpty() {
1008        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, period);
1009      }
1010
1011  public String fhirType() {
1012    return "Coverage.costToBeneficiary.exception";
1013
1014  }
1015
1016  }
1017
1018    /**
1019     * A unique identifier assigned to this coverage.
1020     */
1021    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1022    @Description(shortDefinition="Business Identifier for the coverage", formalDefinition="A unique identifier assigned to this coverage." )
1023    protected List<Identifier> identifier;
1024
1025    /**
1026     * The status of the resource instance.
1027     */
1028    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1029    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
1030    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
1031    protected Enumeration<CoverageStatus> status;
1032
1033    /**
1034     * The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.
1035     */
1036    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1037    @Description(shortDefinition="Coverage category such as medical or accident", formalDefinition="The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization." )
1038    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/coverage-type")
1039    protected CodeableConcept type;
1040
1041    /**
1042     * The party who 'owns' the insurance policy.
1043     */
1044    @Child(name = "policyHolder", type = {Patient.class, RelatedPerson.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
1045    @Description(shortDefinition="Owner of the policy", formalDefinition="The party who 'owns' the insurance policy." )
1046    protected Reference policyHolder;
1047
1048    /**
1049     * The actual object that is the target of the reference (The party who 'owns' the insurance policy.)
1050     */
1051    protected Resource policyHolderTarget;
1052
1053    /**
1054     * The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.
1055     */
1056    @Child(name = "subscriber", type = {Patient.class, RelatedPerson.class}, order=4, min=0, max=1, modifier=false, summary=true)
1057    @Description(shortDefinition="Subscriber to the policy", formalDefinition="The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due." )
1058    protected Reference subscriber;
1059
1060    /**
1061     * The actual object that is the target of the reference (The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.)
1062     */
1063    protected Resource subscriberTarget;
1064
1065    /**
1066     * The insurer assigned ID for the Subscriber.
1067     */
1068    @Child(name = "subscriberId", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1069    @Description(shortDefinition="ID assigned to the subscriber", formalDefinition="The insurer assigned ID for the Subscriber." )
1070    protected StringType subscriberId;
1071
1072    /**
1073     * The party who benefits from the insurance coverage; the patient when products and/or services are provided.
1074     */
1075    @Child(name = "beneficiary", type = {Patient.class}, order=6, min=1, max=1, modifier=false, summary=true)
1076    @Description(shortDefinition="Plan beneficiary", formalDefinition="The party who benefits from the insurance coverage; the patient when products and/or services are provided." )
1077    protected Reference beneficiary;
1078
1079    /**
1080     * The actual object that is the target of the reference (The party who benefits from the insurance coverage; the patient when products and/or services are provided.)
1081     */
1082    protected Patient beneficiaryTarget;
1083
1084    /**
1085     * A unique identifier for a dependent under the coverage.
1086     */
1087    @Child(name = "dependent", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1088    @Description(shortDefinition="Dependent number", formalDefinition="A unique identifier for a dependent under the coverage." )
1089    protected StringType dependent;
1090
1091    /**
1092     * The relationship of beneficiary (patient) to the subscriber.
1093     */
1094    @Child(name = "relationship", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
1095    @Description(shortDefinition="Beneficiary relationship to the subscriber", formalDefinition="The relationship of beneficiary (patient) to the subscriber." )
1096    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscriber-relationship")
1097    protected CodeableConcept relationship;
1098
1099    /**
1100     * Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.
1101     */
1102    @Child(name = "period", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=true)
1103    @Description(shortDefinition="Coverage start and end dates", formalDefinition="Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force." )
1104    protected Period period;
1105
1106    /**
1107     * The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements.
1108     */
1109    @Child(name = "payor", type = {Organization.class, Patient.class, RelatedPerson.class}, order=10, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1110    @Description(shortDefinition="Issuer of the policy", formalDefinition="The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements." )
1111    protected List<Reference> payor;
1112    /**
1113     * The actual objects that are the target of the reference (The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements.)
1114     */
1115    protected List<Resource> payorTarget;
1116
1117
1118    /**
1119     * A suite of underwriter specific classifiers.
1120     */
1121    @Child(name = "class", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1122    @Description(shortDefinition="Additional coverage classifications", formalDefinition="A suite of underwriter specific classifiers." )
1123    protected List<ClassComponent> class_;
1124
1125    /**
1126     * The order of applicability of this coverage relative to other coverages which are currently in force. Note, there may be gaps in the numbering and this does not imply primary, secondary etc. as the specific positioning of coverages depends upon the episode of care.
1127     */
1128    @Child(name = "order", type = {PositiveIntType.class}, order=12, min=0, max=1, modifier=false, summary=true)
1129    @Description(shortDefinition="Relative order of the coverage", formalDefinition="The order of applicability of this coverage relative to other coverages which are currently in force. Note, there may be gaps in the numbering and this does not imply primary, secondary etc. as the specific positioning of coverages depends upon the episode of care." )
1130    protected PositiveIntType order;
1131
1132    /**
1133     * The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.
1134     */
1135    @Child(name = "network", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=true)
1136    @Description(shortDefinition="Insurer network", formalDefinition="The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply." )
1137    protected StringType network;
1138
1139    /**
1140     * A suite of codes indicating the cost category and associated amount which have been detailed in the policy and may have been  included on the health card.
1141     */
1142    @Child(name = "costToBeneficiary", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1143    @Description(shortDefinition="Patient payments for services/products", formalDefinition="A suite of codes indicating the cost category and associated amount which have been detailed in the policy and may have been  included on the health card." )
1144    protected List<CostToBeneficiaryComponent> costToBeneficiary;
1145
1146    /**
1147     * When 'subrogation=true' this insurance instance has been included not for adjudication but to provide insurers with the details to recover costs.
1148     */
1149    @Child(name = "subrogation", type = {BooleanType.class}, order=15, min=0, max=1, modifier=false, summary=false)
1150    @Description(shortDefinition="Reimbursement to insurer", formalDefinition="When 'subrogation=true' this insurance instance has been included not for adjudication but to provide insurers with the details to recover costs." )
1151    protected BooleanType subrogation;
1152
1153    /**
1154     * The policy(s) which constitute this insurance coverage.
1155     */
1156    @Child(name = "contract", type = {Contract.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1157    @Description(shortDefinition="Contract details", formalDefinition="The policy(s) which constitute this insurance coverage." )
1158    protected List<Reference> contract;
1159    /**
1160     * The actual objects that are the target of the reference (The policy(s) which constitute this insurance coverage.)
1161     */
1162    protected List<Contract> contractTarget;
1163
1164
1165    private static final long serialVersionUID = 212315315L;
1166
1167  /**
1168   * Constructor
1169   */
1170    public Coverage() {
1171      super();
1172    }
1173
1174  /**
1175   * Constructor
1176   */
1177    public Coverage(Enumeration<CoverageStatus> status, Reference beneficiary) {
1178      super();
1179      this.status = status;
1180      this.beneficiary = beneficiary;
1181    }
1182
1183    /**
1184     * @return {@link #identifier} (A unique identifier assigned to this coverage.)
1185     */
1186    public List<Identifier> getIdentifier() { 
1187      if (this.identifier == null)
1188        this.identifier = new ArrayList<Identifier>();
1189      return this.identifier;
1190    }
1191
1192    /**
1193     * @return Returns a reference to <code>this</code> for easy method chaining
1194     */
1195    public Coverage setIdentifier(List<Identifier> theIdentifier) { 
1196      this.identifier = theIdentifier;
1197      return this;
1198    }
1199
1200    public boolean hasIdentifier() { 
1201      if (this.identifier == null)
1202        return false;
1203      for (Identifier item : this.identifier)
1204        if (!item.isEmpty())
1205          return true;
1206      return false;
1207    }
1208
1209    public Identifier addIdentifier() { //3
1210      Identifier t = new Identifier();
1211      if (this.identifier == null)
1212        this.identifier = new ArrayList<Identifier>();
1213      this.identifier.add(t);
1214      return t;
1215    }
1216
1217    public Coverage addIdentifier(Identifier t) { //3
1218      if (t == null)
1219        return this;
1220      if (this.identifier == null)
1221        this.identifier = new ArrayList<Identifier>();
1222      this.identifier.add(t);
1223      return this;
1224    }
1225
1226    /**
1227     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1228     */
1229    public Identifier getIdentifierFirstRep() { 
1230      if (getIdentifier().isEmpty()) {
1231        addIdentifier();
1232      }
1233      return getIdentifier().get(0);
1234    }
1235
1236    /**
1237     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1238     */
1239    public Enumeration<CoverageStatus> getStatusElement() { 
1240      if (this.status == null)
1241        if (Configuration.errorOnAutoCreate())
1242          throw new Error("Attempt to auto-create Coverage.status");
1243        else if (Configuration.doAutoCreate())
1244          this.status = new Enumeration<CoverageStatus>(new CoverageStatusEnumFactory()); // bb
1245      return this.status;
1246    }
1247
1248    public boolean hasStatusElement() { 
1249      return this.status != null && !this.status.isEmpty();
1250    }
1251
1252    public boolean hasStatus() { 
1253      return this.status != null && !this.status.isEmpty();
1254    }
1255
1256    /**
1257     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1258     */
1259    public Coverage setStatusElement(Enumeration<CoverageStatus> value) { 
1260      this.status = value;
1261      return this;
1262    }
1263
1264    /**
1265     * @return The status of the resource instance.
1266     */
1267    public CoverageStatus getStatus() { 
1268      return this.status == null ? null : this.status.getValue();
1269    }
1270
1271    /**
1272     * @param value The status of the resource instance.
1273     */
1274    public Coverage setStatus(CoverageStatus value) { 
1275        if (this.status == null)
1276          this.status = new Enumeration<CoverageStatus>(new CoverageStatusEnumFactory());
1277        this.status.setValue(value);
1278      return this;
1279    }
1280
1281    /**
1282     * @return {@link #type} (The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.)
1283     */
1284    public CodeableConcept getType() { 
1285      if (this.type == null)
1286        if (Configuration.errorOnAutoCreate())
1287          throw new Error("Attempt to auto-create Coverage.type");
1288        else if (Configuration.doAutoCreate())
1289          this.type = new CodeableConcept(); // cc
1290      return this.type;
1291    }
1292
1293    public boolean hasType() { 
1294      return this.type != null && !this.type.isEmpty();
1295    }
1296
1297    /**
1298     * @param value {@link #type} (The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.)
1299     */
1300    public Coverage setType(CodeableConcept value) { 
1301      this.type = value;
1302      return this;
1303    }
1304
1305    /**
1306     * @return {@link #policyHolder} (The party who 'owns' the insurance policy.)
1307     */
1308    public Reference getPolicyHolder() { 
1309      if (this.policyHolder == null)
1310        if (Configuration.errorOnAutoCreate())
1311          throw new Error("Attempt to auto-create Coverage.policyHolder");
1312        else if (Configuration.doAutoCreate())
1313          this.policyHolder = new Reference(); // cc
1314      return this.policyHolder;
1315    }
1316
1317    public boolean hasPolicyHolder() { 
1318      return this.policyHolder != null && !this.policyHolder.isEmpty();
1319    }
1320
1321    /**
1322     * @param value {@link #policyHolder} (The party who 'owns' the insurance policy.)
1323     */
1324    public Coverage setPolicyHolder(Reference value) { 
1325      this.policyHolder = value;
1326      return this;
1327    }
1328
1329    /**
1330     * @return {@link #policyHolder} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The party who 'owns' the insurance policy.)
1331     */
1332    public Resource getPolicyHolderTarget() { 
1333      return this.policyHolderTarget;
1334    }
1335
1336    /**
1337     * @param value {@link #policyHolder} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The party who 'owns' the insurance policy.)
1338     */
1339    public Coverage setPolicyHolderTarget(Resource value) { 
1340      this.policyHolderTarget = value;
1341      return this;
1342    }
1343
1344    /**
1345     * @return {@link #subscriber} (The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.)
1346     */
1347    public Reference getSubscriber() { 
1348      if (this.subscriber == null)
1349        if (Configuration.errorOnAutoCreate())
1350          throw new Error("Attempt to auto-create Coverage.subscriber");
1351        else if (Configuration.doAutoCreate())
1352          this.subscriber = new Reference(); // cc
1353      return this.subscriber;
1354    }
1355
1356    public boolean hasSubscriber() { 
1357      return this.subscriber != null && !this.subscriber.isEmpty();
1358    }
1359
1360    /**
1361     * @param value {@link #subscriber} (The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.)
1362     */
1363    public Coverage setSubscriber(Reference value) { 
1364      this.subscriber = value;
1365      return this;
1366    }
1367
1368    /**
1369     * @return {@link #subscriber} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.)
1370     */
1371    public Resource getSubscriberTarget() { 
1372      return this.subscriberTarget;
1373    }
1374
1375    /**
1376     * @param value {@link #subscriber} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.)
1377     */
1378    public Coverage setSubscriberTarget(Resource value) { 
1379      this.subscriberTarget = value;
1380      return this;
1381    }
1382
1383    /**
1384     * @return {@link #subscriberId} (The insurer assigned ID for the Subscriber.). This is the underlying object with id, value and extensions. The accessor "getSubscriberId" gives direct access to the value
1385     */
1386    public StringType getSubscriberIdElement() { 
1387      if (this.subscriberId == null)
1388        if (Configuration.errorOnAutoCreate())
1389          throw new Error("Attempt to auto-create Coverage.subscriberId");
1390        else if (Configuration.doAutoCreate())
1391          this.subscriberId = new StringType(); // bb
1392      return this.subscriberId;
1393    }
1394
1395    public boolean hasSubscriberIdElement() { 
1396      return this.subscriberId != null && !this.subscriberId.isEmpty();
1397    }
1398
1399    public boolean hasSubscriberId() { 
1400      return this.subscriberId != null && !this.subscriberId.isEmpty();
1401    }
1402
1403    /**
1404     * @param value {@link #subscriberId} (The insurer assigned ID for the Subscriber.). This is the underlying object with id, value and extensions. The accessor "getSubscriberId" gives direct access to the value
1405     */
1406    public Coverage setSubscriberIdElement(StringType value) { 
1407      this.subscriberId = value;
1408      return this;
1409    }
1410
1411    /**
1412     * @return The insurer assigned ID for the Subscriber.
1413     */
1414    public String getSubscriberId() { 
1415      return this.subscriberId == null ? null : this.subscriberId.getValue();
1416    }
1417
1418    /**
1419     * @param value The insurer assigned ID for the Subscriber.
1420     */
1421    public Coverage setSubscriberId(String value) { 
1422      if (Utilities.noString(value))
1423        this.subscriberId = null;
1424      else {
1425        if (this.subscriberId == null)
1426          this.subscriberId = new StringType();
1427        this.subscriberId.setValue(value);
1428      }
1429      return this;
1430    }
1431
1432    /**
1433     * @return {@link #beneficiary} (The party who benefits from the insurance coverage; the patient when products and/or services are provided.)
1434     */
1435    public Reference getBeneficiary() { 
1436      if (this.beneficiary == null)
1437        if (Configuration.errorOnAutoCreate())
1438          throw new Error("Attempt to auto-create Coverage.beneficiary");
1439        else if (Configuration.doAutoCreate())
1440          this.beneficiary = new Reference(); // cc
1441      return this.beneficiary;
1442    }
1443
1444    public boolean hasBeneficiary() { 
1445      return this.beneficiary != null && !this.beneficiary.isEmpty();
1446    }
1447
1448    /**
1449     * @param value {@link #beneficiary} (The party who benefits from the insurance coverage; the patient when products and/or services are provided.)
1450     */
1451    public Coverage setBeneficiary(Reference value) { 
1452      this.beneficiary = value;
1453      return this;
1454    }
1455
1456    /**
1457     * @return {@link #beneficiary} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The party who benefits from the insurance coverage; the patient when products and/or services are provided.)
1458     */
1459    public Patient getBeneficiaryTarget() { 
1460      if (this.beneficiaryTarget == null)
1461        if (Configuration.errorOnAutoCreate())
1462          throw new Error("Attempt to auto-create Coverage.beneficiary");
1463        else if (Configuration.doAutoCreate())
1464          this.beneficiaryTarget = new Patient(); // aa
1465      return this.beneficiaryTarget;
1466    }
1467
1468    /**
1469     * @param value {@link #beneficiary} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The party who benefits from the insurance coverage; the patient when products and/or services are provided.)
1470     */
1471    public Coverage setBeneficiaryTarget(Patient value) { 
1472      this.beneficiaryTarget = value;
1473      return this;
1474    }
1475
1476    /**
1477     * @return {@link #dependent} (A unique identifier for a dependent under the coverage.). This is the underlying object with id, value and extensions. The accessor "getDependent" gives direct access to the value
1478     */
1479    public StringType getDependentElement() { 
1480      if (this.dependent == null)
1481        if (Configuration.errorOnAutoCreate())
1482          throw new Error("Attempt to auto-create Coverage.dependent");
1483        else if (Configuration.doAutoCreate())
1484          this.dependent = new StringType(); // bb
1485      return this.dependent;
1486    }
1487
1488    public boolean hasDependentElement() { 
1489      return this.dependent != null && !this.dependent.isEmpty();
1490    }
1491
1492    public boolean hasDependent() { 
1493      return this.dependent != null && !this.dependent.isEmpty();
1494    }
1495
1496    /**
1497     * @param value {@link #dependent} (A unique identifier for a dependent under the coverage.). This is the underlying object with id, value and extensions. The accessor "getDependent" gives direct access to the value
1498     */
1499    public Coverage setDependentElement(StringType value) { 
1500      this.dependent = value;
1501      return this;
1502    }
1503
1504    /**
1505     * @return A unique identifier for a dependent under the coverage.
1506     */
1507    public String getDependent() { 
1508      return this.dependent == null ? null : this.dependent.getValue();
1509    }
1510
1511    /**
1512     * @param value A unique identifier for a dependent under the coverage.
1513     */
1514    public Coverage setDependent(String value) { 
1515      if (Utilities.noString(value))
1516        this.dependent = null;
1517      else {
1518        if (this.dependent == null)
1519          this.dependent = new StringType();
1520        this.dependent.setValue(value);
1521      }
1522      return this;
1523    }
1524
1525    /**
1526     * @return {@link #relationship} (The relationship of beneficiary (patient) to the subscriber.)
1527     */
1528    public CodeableConcept getRelationship() { 
1529      if (this.relationship == null)
1530        if (Configuration.errorOnAutoCreate())
1531          throw new Error("Attempt to auto-create Coverage.relationship");
1532        else if (Configuration.doAutoCreate())
1533          this.relationship = new CodeableConcept(); // cc
1534      return this.relationship;
1535    }
1536
1537    public boolean hasRelationship() { 
1538      return this.relationship != null && !this.relationship.isEmpty();
1539    }
1540
1541    /**
1542     * @param value {@link #relationship} (The relationship of beneficiary (patient) to the subscriber.)
1543     */
1544    public Coverage setRelationship(CodeableConcept value) { 
1545      this.relationship = value;
1546      return this;
1547    }
1548
1549    /**
1550     * @return {@link #period} (Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.)
1551     */
1552    public Period getPeriod() { 
1553      if (this.period == null)
1554        if (Configuration.errorOnAutoCreate())
1555          throw new Error("Attempt to auto-create Coverage.period");
1556        else if (Configuration.doAutoCreate())
1557          this.period = new Period(); // cc
1558      return this.period;
1559    }
1560
1561    public boolean hasPeriod() { 
1562      return this.period != null && !this.period.isEmpty();
1563    }
1564
1565    /**
1566     * @param value {@link #period} (Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.)
1567     */
1568    public Coverage setPeriod(Period value) { 
1569      this.period = value;
1570      return this;
1571    }
1572
1573    /**
1574     * @return {@link #payor} (The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements.)
1575     */
1576    public List<Reference> getPayor() { 
1577      if (this.payor == null)
1578        this.payor = new ArrayList<Reference>();
1579      return this.payor;
1580    }
1581
1582    /**
1583     * @return Returns a reference to <code>this</code> for easy method chaining
1584     */
1585    public Coverage setPayor(List<Reference> thePayor) { 
1586      this.payor = thePayor;
1587      return this;
1588    }
1589
1590    public boolean hasPayor() { 
1591      if (this.payor == null)
1592        return false;
1593      for (Reference item : this.payor)
1594        if (!item.isEmpty())
1595          return true;
1596      return false;
1597    }
1598
1599    public Reference addPayor() { //3
1600      Reference t = new Reference();
1601      if (this.payor == null)
1602        this.payor = new ArrayList<Reference>();
1603      this.payor.add(t);
1604      return t;
1605    }
1606
1607    public Coverage addPayor(Reference t) { //3
1608      if (t == null)
1609        return this;
1610      if (this.payor == null)
1611        this.payor = new ArrayList<Reference>();
1612      this.payor.add(t);
1613      return this;
1614    }
1615
1616    /**
1617     * @return The first repetition of repeating field {@link #payor}, creating it if it does not already exist
1618     */
1619    public Reference getPayorFirstRep() { 
1620      if (getPayor().isEmpty()) {
1621        addPayor();
1622      }
1623      return getPayor().get(0);
1624    }
1625
1626    /**
1627     * @deprecated Use Reference#setResource(IBaseResource) instead
1628     */
1629    @Deprecated
1630    public List<Resource> getPayorTarget() { 
1631      if (this.payorTarget == null)
1632        this.payorTarget = new ArrayList<Resource>();
1633      return this.payorTarget;
1634    }
1635
1636    /**
1637     * @return {@link #class_} (A suite of underwriter specific classifiers.)
1638     */
1639    public List<ClassComponent> getClass_() { 
1640      if (this.class_ == null)
1641        this.class_ = new ArrayList<ClassComponent>();
1642      return this.class_;
1643    }
1644
1645    /**
1646     * @return Returns a reference to <code>this</code> for easy method chaining
1647     */
1648    public Coverage setClass_(List<ClassComponent> theClass_) { 
1649      this.class_ = theClass_;
1650      return this;
1651    }
1652
1653    public boolean hasClass_() { 
1654      if (this.class_ == null)
1655        return false;
1656      for (ClassComponent item : this.class_)
1657        if (!item.isEmpty())
1658          return true;
1659      return false;
1660    }
1661
1662    public ClassComponent addClass_() { //3
1663      ClassComponent t = new ClassComponent();
1664      if (this.class_ == null)
1665        this.class_ = new ArrayList<ClassComponent>();
1666      this.class_.add(t);
1667      return t;
1668    }
1669
1670    public Coverage addClass_(ClassComponent t) { //3
1671      if (t == null)
1672        return this;
1673      if (this.class_ == null)
1674        this.class_ = new ArrayList<ClassComponent>();
1675      this.class_.add(t);
1676      return this;
1677    }
1678
1679    /**
1680     * @return The first repetition of repeating field {@link #class_}, creating it if it does not already exist
1681     */
1682    public ClassComponent getClass_FirstRep() { 
1683      if (getClass_().isEmpty()) {
1684        addClass_();
1685      }
1686      return getClass_().get(0);
1687    }
1688
1689    /**
1690     * @return {@link #order} (The order of applicability of this coverage relative to other coverages which are currently in force. Note, there may be gaps in the numbering and this does not imply primary, secondary etc. as the specific positioning of coverages depends upon the episode of care.). This is the underlying object with id, value and extensions. The accessor "getOrder" gives direct access to the value
1691     */
1692    public PositiveIntType getOrderElement() { 
1693      if (this.order == null)
1694        if (Configuration.errorOnAutoCreate())
1695          throw new Error("Attempt to auto-create Coverage.order");
1696        else if (Configuration.doAutoCreate())
1697          this.order = new PositiveIntType(); // bb
1698      return this.order;
1699    }
1700
1701    public boolean hasOrderElement() { 
1702      return this.order != null && !this.order.isEmpty();
1703    }
1704
1705    public boolean hasOrder() { 
1706      return this.order != null && !this.order.isEmpty();
1707    }
1708
1709    /**
1710     * @param value {@link #order} (The order of applicability of this coverage relative to other coverages which are currently in force. Note, there may be gaps in the numbering and this does not imply primary, secondary etc. as the specific positioning of coverages depends upon the episode of care.). This is the underlying object with id, value and extensions. The accessor "getOrder" gives direct access to the value
1711     */
1712    public Coverage setOrderElement(PositiveIntType value) { 
1713      this.order = value;
1714      return this;
1715    }
1716
1717    /**
1718     * @return The order of applicability of this coverage relative to other coverages which are currently in force. Note, there may be gaps in the numbering and this does not imply primary, secondary etc. as the specific positioning of coverages depends upon the episode of care.
1719     */
1720    public int getOrder() { 
1721      return this.order == null || this.order.isEmpty() ? 0 : this.order.getValue();
1722    }
1723
1724    /**
1725     * @param value The order of applicability of this coverage relative to other coverages which are currently in force. Note, there may be gaps in the numbering and this does not imply primary, secondary etc. as the specific positioning of coverages depends upon the episode of care.
1726     */
1727    public Coverage setOrder(int value) { 
1728        if (this.order == null)
1729          this.order = new PositiveIntType();
1730        this.order.setValue(value);
1731      return this;
1732    }
1733
1734    /**
1735     * @return {@link #network} (The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.). This is the underlying object with id, value and extensions. The accessor "getNetwork" gives direct access to the value
1736     */
1737    public StringType getNetworkElement() { 
1738      if (this.network == null)
1739        if (Configuration.errorOnAutoCreate())
1740          throw new Error("Attempt to auto-create Coverage.network");
1741        else if (Configuration.doAutoCreate())
1742          this.network = new StringType(); // bb
1743      return this.network;
1744    }
1745
1746    public boolean hasNetworkElement() { 
1747      return this.network != null && !this.network.isEmpty();
1748    }
1749
1750    public boolean hasNetwork() { 
1751      return this.network != null && !this.network.isEmpty();
1752    }
1753
1754    /**
1755     * @param value {@link #network} (The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.). This is the underlying object with id, value and extensions. The accessor "getNetwork" gives direct access to the value
1756     */
1757    public Coverage setNetworkElement(StringType value) { 
1758      this.network = value;
1759      return this;
1760    }
1761
1762    /**
1763     * @return The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.
1764     */
1765    public String getNetwork() { 
1766      return this.network == null ? null : this.network.getValue();
1767    }
1768
1769    /**
1770     * @param value The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.
1771     */
1772    public Coverage setNetwork(String value) { 
1773      if (Utilities.noString(value))
1774        this.network = null;
1775      else {
1776        if (this.network == null)
1777          this.network = new StringType();
1778        this.network.setValue(value);
1779      }
1780      return this;
1781    }
1782
1783    /**
1784     * @return {@link #costToBeneficiary} (A suite of codes indicating the cost category and associated amount which have been detailed in the policy and may have been  included on the health card.)
1785     */
1786    public List<CostToBeneficiaryComponent> getCostToBeneficiary() { 
1787      if (this.costToBeneficiary == null)
1788        this.costToBeneficiary = new ArrayList<CostToBeneficiaryComponent>();
1789      return this.costToBeneficiary;
1790    }
1791
1792    /**
1793     * @return Returns a reference to <code>this</code> for easy method chaining
1794     */
1795    public Coverage setCostToBeneficiary(List<CostToBeneficiaryComponent> theCostToBeneficiary) { 
1796      this.costToBeneficiary = theCostToBeneficiary;
1797      return this;
1798    }
1799
1800    public boolean hasCostToBeneficiary() { 
1801      if (this.costToBeneficiary == null)
1802        return false;
1803      for (CostToBeneficiaryComponent item : this.costToBeneficiary)
1804        if (!item.isEmpty())
1805          return true;
1806      return false;
1807    }
1808
1809    public CostToBeneficiaryComponent addCostToBeneficiary() { //3
1810      CostToBeneficiaryComponent t = new CostToBeneficiaryComponent();
1811      if (this.costToBeneficiary == null)
1812        this.costToBeneficiary = new ArrayList<CostToBeneficiaryComponent>();
1813      this.costToBeneficiary.add(t);
1814      return t;
1815    }
1816
1817    public Coverage addCostToBeneficiary(CostToBeneficiaryComponent t) { //3
1818      if (t == null)
1819        return this;
1820      if (this.costToBeneficiary == null)
1821        this.costToBeneficiary = new ArrayList<CostToBeneficiaryComponent>();
1822      this.costToBeneficiary.add(t);
1823      return this;
1824    }
1825
1826    /**
1827     * @return The first repetition of repeating field {@link #costToBeneficiary}, creating it if it does not already exist
1828     */
1829    public CostToBeneficiaryComponent getCostToBeneficiaryFirstRep() { 
1830      if (getCostToBeneficiary().isEmpty()) {
1831        addCostToBeneficiary();
1832      }
1833      return getCostToBeneficiary().get(0);
1834    }
1835
1836    /**
1837     * @return {@link #subrogation} (When 'subrogation=true' this insurance instance has been included not for adjudication but to provide insurers with the details to recover costs.). This is the underlying object with id, value and extensions. The accessor "getSubrogation" gives direct access to the value
1838     */
1839    public BooleanType getSubrogationElement() { 
1840      if (this.subrogation == null)
1841        if (Configuration.errorOnAutoCreate())
1842          throw new Error("Attempt to auto-create Coverage.subrogation");
1843        else if (Configuration.doAutoCreate())
1844          this.subrogation = new BooleanType(); // bb
1845      return this.subrogation;
1846    }
1847
1848    public boolean hasSubrogationElement() { 
1849      return this.subrogation != null && !this.subrogation.isEmpty();
1850    }
1851
1852    public boolean hasSubrogation() { 
1853      return this.subrogation != null && !this.subrogation.isEmpty();
1854    }
1855
1856    /**
1857     * @param value {@link #subrogation} (When 'subrogation=true' this insurance instance has been included not for adjudication but to provide insurers with the details to recover costs.). This is the underlying object with id, value and extensions. The accessor "getSubrogation" gives direct access to the value
1858     */
1859    public Coverage setSubrogationElement(BooleanType value) { 
1860      this.subrogation = value;
1861      return this;
1862    }
1863
1864    /**
1865     * @return When 'subrogation=true' this insurance instance has been included not for adjudication but to provide insurers with the details to recover costs.
1866     */
1867    public boolean getSubrogation() { 
1868      return this.subrogation == null || this.subrogation.isEmpty() ? false : this.subrogation.getValue();
1869    }
1870
1871    /**
1872     * @param value When 'subrogation=true' this insurance instance has been included not for adjudication but to provide insurers with the details to recover costs.
1873     */
1874    public Coverage setSubrogation(boolean value) { 
1875        if (this.subrogation == null)
1876          this.subrogation = new BooleanType();
1877        this.subrogation.setValue(value);
1878      return this;
1879    }
1880
1881    /**
1882     * @return {@link #contract} (The policy(s) which constitute this insurance coverage.)
1883     */
1884    public List<Reference> getContract() { 
1885      if (this.contract == null)
1886        this.contract = new ArrayList<Reference>();
1887      return this.contract;
1888    }
1889
1890    /**
1891     * @return Returns a reference to <code>this</code> for easy method chaining
1892     */
1893    public Coverage setContract(List<Reference> theContract) { 
1894      this.contract = theContract;
1895      return this;
1896    }
1897
1898    public boolean hasContract() { 
1899      if (this.contract == null)
1900        return false;
1901      for (Reference item : this.contract)
1902        if (!item.isEmpty())
1903          return true;
1904      return false;
1905    }
1906
1907    public Reference addContract() { //3
1908      Reference t = new Reference();
1909      if (this.contract == null)
1910        this.contract = new ArrayList<Reference>();
1911      this.contract.add(t);
1912      return t;
1913    }
1914
1915    public Coverage addContract(Reference t) { //3
1916      if (t == null)
1917        return this;
1918      if (this.contract == null)
1919        this.contract = new ArrayList<Reference>();
1920      this.contract.add(t);
1921      return this;
1922    }
1923
1924    /**
1925     * @return The first repetition of repeating field {@link #contract}, creating it if it does not already exist
1926     */
1927    public Reference getContractFirstRep() { 
1928      if (getContract().isEmpty()) {
1929        addContract();
1930      }
1931      return getContract().get(0);
1932    }
1933
1934    /**
1935     * @deprecated Use Reference#setResource(IBaseResource) instead
1936     */
1937    @Deprecated
1938    public List<Contract> getContractTarget() { 
1939      if (this.contractTarget == null)
1940        this.contractTarget = new ArrayList<Contract>();
1941      return this.contractTarget;
1942    }
1943
1944    /**
1945     * @deprecated Use Reference#setResource(IBaseResource) instead
1946     */
1947    @Deprecated
1948    public Contract addContractTarget() { 
1949      Contract r = new Contract();
1950      if (this.contractTarget == null)
1951        this.contractTarget = new ArrayList<Contract>();
1952      this.contractTarget.add(r);
1953      return r;
1954    }
1955
1956      protected void listChildren(List<Property> children) {
1957        super.listChildren(children);
1958        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this coverage.", 0, java.lang.Integer.MAX_VALUE, identifier));
1959        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
1960        children.add(new Property("type", "CodeableConcept", "The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.", 0, 1, type));
1961        children.add(new Property("policyHolder", "Reference(Patient|RelatedPerson|Organization)", "The party who 'owns' the insurance policy.", 0, 1, policyHolder));
1962        children.add(new Property("subscriber", "Reference(Patient|RelatedPerson)", "The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.", 0, 1, subscriber));
1963        children.add(new Property("subscriberId", "string", "The insurer assigned ID for the Subscriber.", 0, 1, subscriberId));
1964        children.add(new Property("beneficiary", "Reference(Patient)", "The party who benefits from the insurance coverage; the patient when products and/or services are provided.", 0, 1, beneficiary));
1965        children.add(new Property("dependent", "string", "A unique identifier for a dependent under the coverage.", 0, 1, dependent));
1966        children.add(new Property("relationship", "CodeableConcept", "The relationship of beneficiary (patient) to the subscriber.", 0, 1, relationship));
1967        children.add(new Property("period", "Period", "Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.", 0, 1, period));
1968        children.add(new Property("payor", "Reference(Organization|Patient|RelatedPerson)", "The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements.", 0, java.lang.Integer.MAX_VALUE, payor));
1969        children.add(new Property("class", "", "A suite of underwriter specific classifiers.", 0, java.lang.Integer.MAX_VALUE, class_));
1970        children.add(new Property("order", "positiveInt", "The order of applicability of this coverage relative to other coverages which are currently in force. Note, there may be gaps in the numbering and this does not imply primary, secondary etc. as the specific positioning of coverages depends upon the episode of care.", 0, 1, order));
1971        children.add(new Property("network", "string", "The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.", 0, 1, network));
1972        children.add(new Property("costToBeneficiary", "", "A suite of codes indicating the cost category and associated amount which have been detailed in the policy and may have been  included on the health card.", 0, java.lang.Integer.MAX_VALUE, costToBeneficiary));
1973        children.add(new Property("subrogation", "boolean", "When 'subrogation=true' this insurance instance has been included not for adjudication but to provide insurers with the details to recover costs.", 0, 1, subrogation));
1974        children.add(new Property("contract", "Reference(Contract)", "The policy(s) which constitute this insurance coverage.", 0, java.lang.Integer.MAX_VALUE, contract));
1975      }
1976
1977      @Override
1978      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1979        switch (_hash) {
1980        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this coverage.", 0, java.lang.Integer.MAX_VALUE, identifier);
1981        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
1982        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.", 0, 1, type);
1983        case 2046898558: /*policyHolder*/  return new Property("policyHolder", "Reference(Patient|RelatedPerson|Organization)", "The party who 'owns' the insurance policy.", 0, 1, policyHolder);
1984        case -1219769240: /*subscriber*/  return new Property("subscriber", "Reference(Patient|RelatedPerson)", "The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.", 0, 1, subscriber);
1985        case 327834531: /*subscriberId*/  return new Property("subscriberId", "string", "The insurer assigned ID for the Subscriber.", 0, 1, subscriberId);
1986        case -565102875: /*beneficiary*/  return new Property("beneficiary", "Reference(Patient)", "The party who benefits from the insurance coverage; the patient when products and/or services are provided.", 0, 1, beneficiary);
1987        case -1109226753: /*dependent*/  return new Property("dependent", "string", "A unique identifier for a dependent under the coverage.", 0, 1, dependent);
1988        case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "The relationship of beneficiary (patient) to the subscriber.", 0, 1, relationship);
1989        case -991726143: /*period*/  return new Property("period", "Period", "Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.", 0, 1, period);
1990        case 106443915: /*payor*/  return new Property("payor", "Reference(Organization|Patient|RelatedPerson)", "The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements.", 0, java.lang.Integer.MAX_VALUE, payor);
1991        case 94742904: /*class*/  return new Property("class", "", "A suite of underwriter specific classifiers.", 0, java.lang.Integer.MAX_VALUE, class_);
1992        case 106006350: /*order*/  return new Property("order", "positiveInt", "The order of applicability of this coverage relative to other coverages which are currently in force. Note, there may be gaps in the numbering and this does not imply primary, secondary etc. as the specific positioning of coverages depends upon the episode of care.", 0, 1, order);
1993        case 1843485230: /*network*/  return new Property("network", "string", "The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.", 0, 1, network);
1994        case -1866474851: /*costToBeneficiary*/  return new Property("costToBeneficiary", "", "A suite of codes indicating the cost category and associated amount which have been detailed in the policy and may have been  included on the health card.", 0, java.lang.Integer.MAX_VALUE, costToBeneficiary);
1995        case 837389739: /*subrogation*/  return new Property("subrogation", "boolean", "When 'subrogation=true' this insurance instance has been included not for adjudication but to provide insurers with the details to recover costs.", 0, 1, subrogation);
1996        case -566947566: /*contract*/  return new Property("contract", "Reference(Contract)", "The policy(s) which constitute this insurance coverage.", 0, java.lang.Integer.MAX_VALUE, contract);
1997        default: return super.getNamedProperty(_hash, _name, _checkValid);
1998        }
1999
2000      }
2001
2002      @Override
2003      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2004        switch (hash) {
2005        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2006        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CoverageStatus>
2007        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2008        case 2046898558: /*policyHolder*/ return this.policyHolder == null ? new Base[0] : new Base[] {this.policyHolder}; // Reference
2009        case -1219769240: /*subscriber*/ return this.subscriber == null ? new Base[0] : new Base[] {this.subscriber}; // Reference
2010        case 327834531: /*subscriberId*/ return this.subscriberId == null ? new Base[0] : new Base[] {this.subscriberId}; // StringType
2011        case -565102875: /*beneficiary*/ return this.beneficiary == null ? new Base[0] : new Base[] {this.beneficiary}; // Reference
2012        case -1109226753: /*dependent*/ return this.dependent == null ? new Base[0] : new Base[] {this.dependent}; // StringType
2013        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
2014        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
2015        case 106443915: /*payor*/ return this.payor == null ? new Base[0] : this.payor.toArray(new Base[this.payor.size()]); // Reference
2016        case 94742904: /*class*/ return this.class_ == null ? new Base[0] : this.class_.toArray(new Base[this.class_.size()]); // ClassComponent
2017        case 106006350: /*order*/ return this.order == null ? new Base[0] : new Base[] {this.order}; // PositiveIntType
2018        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // StringType
2019        case -1866474851: /*costToBeneficiary*/ return this.costToBeneficiary == null ? new Base[0] : this.costToBeneficiary.toArray(new Base[this.costToBeneficiary.size()]); // CostToBeneficiaryComponent
2020        case 837389739: /*subrogation*/ return this.subrogation == null ? new Base[0] : new Base[] {this.subrogation}; // BooleanType
2021        case -566947566: /*contract*/ return this.contract == null ? new Base[0] : this.contract.toArray(new Base[this.contract.size()]); // Reference
2022        default: return super.getProperty(hash, name, checkValid);
2023        }
2024
2025      }
2026
2027      @Override
2028      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2029        switch (hash) {
2030        case -1618432855: // identifier
2031          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2032          return value;
2033        case -892481550: // status
2034          value = new CoverageStatusEnumFactory().fromType(castToCode(value));
2035          this.status = (Enumeration) value; // Enumeration<CoverageStatus>
2036          return value;
2037        case 3575610: // type
2038          this.type = castToCodeableConcept(value); // CodeableConcept
2039          return value;
2040        case 2046898558: // policyHolder
2041          this.policyHolder = castToReference(value); // Reference
2042          return value;
2043        case -1219769240: // subscriber
2044          this.subscriber = castToReference(value); // Reference
2045          return value;
2046        case 327834531: // subscriberId
2047          this.subscriberId = castToString(value); // StringType
2048          return value;
2049        case -565102875: // beneficiary
2050          this.beneficiary = castToReference(value); // Reference
2051          return value;
2052        case -1109226753: // dependent
2053          this.dependent = castToString(value); // StringType
2054          return value;
2055        case -261851592: // relationship
2056          this.relationship = castToCodeableConcept(value); // CodeableConcept
2057          return value;
2058        case -991726143: // period
2059          this.period = castToPeriod(value); // Period
2060          return value;
2061        case 106443915: // payor
2062          this.getPayor().add(castToReference(value)); // Reference
2063          return value;
2064        case 94742904: // class
2065          this.getClass_().add((ClassComponent) value); // ClassComponent
2066          return value;
2067        case 106006350: // order
2068          this.order = castToPositiveInt(value); // PositiveIntType
2069          return value;
2070        case 1843485230: // network
2071          this.network = castToString(value); // StringType
2072          return value;
2073        case -1866474851: // costToBeneficiary
2074          this.getCostToBeneficiary().add((CostToBeneficiaryComponent) value); // CostToBeneficiaryComponent
2075          return value;
2076        case 837389739: // subrogation
2077          this.subrogation = castToBoolean(value); // BooleanType
2078          return value;
2079        case -566947566: // contract
2080          this.getContract().add(castToReference(value)); // Reference
2081          return value;
2082        default: return super.setProperty(hash, name, value);
2083        }
2084
2085      }
2086
2087      @Override
2088      public Base setProperty(String name, Base value) throws FHIRException {
2089        if (name.equals("identifier")) {
2090          this.getIdentifier().add(castToIdentifier(value));
2091        } else if (name.equals("status")) {
2092          value = new CoverageStatusEnumFactory().fromType(castToCode(value));
2093          this.status = (Enumeration) value; // Enumeration<CoverageStatus>
2094        } else if (name.equals("type")) {
2095          this.type = castToCodeableConcept(value); // CodeableConcept
2096        } else if (name.equals("policyHolder")) {
2097          this.policyHolder = castToReference(value); // Reference
2098        } else if (name.equals("subscriber")) {
2099          this.subscriber = castToReference(value); // Reference
2100        } else if (name.equals("subscriberId")) {
2101          this.subscriberId = castToString(value); // StringType
2102        } else if (name.equals("beneficiary")) {
2103          this.beneficiary = castToReference(value); // Reference
2104        } else if (name.equals("dependent")) {
2105          this.dependent = castToString(value); // StringType
2106        } else if (name.equals("relationship")) {
2107          this.relationship = castToCodeableConcept(value); // CodeableConcept
2108        } else if (name.equals("period")) {
2109          this.period = castToPeriod(value); // Period
2110        } else if (name.equals("payor")) {
2111          this.getPayor().add(castToReference(value));
2112        } else if (name.equals("class")) {
2113          this.getClass_().add((ClassComponent) value);
2114        } else if (name.equals("order")) {
2115          this.order = castToPositiveInt(value); // PositiveIntType
2116        } else if (name.equals("network")) {
2117          this.network = castToString(value); // StringType
2118        } else if (name.equals("costToBeneficiary")) {
2119          this.getCostToBeneficiary().add((CostToBeneficiaryComponent) value);
2120        } else if (name.equals("subrogation")) {
2121          this.subrogation = castToBoolean(value); // BooleanType
2122        } else if (name.equals("contract")) {
2123          this.getContract().add(castToReference(value));
2124        } else
2125          return super.setProperty(name, value);
2126        return value;
2127      }
2128
2129      @Override
2130      public Base makeProperty(int hash, String name) throws FHIRException {
2131        switch (hash) {
2132        case -1618432855:  return addIdentifier(); 
2133        case -892481550:  return getStatusElement();
2134        case 3575610:  return getType(); 
2135        case 2046898558:  return getPolicyHolder(); 
2136        case -1219769240:  return getSubscriber(); 
2137        case 327834531:  return getSubscriberIdElement();
2138        case -565102875:  return getBeneficiary(); 
2139        case -1109226753:  return getDependentElement();
2140        case -261851592:  return getRelationship(); 
2141        case -991726143:  return getPeriod(); 
2142        case 106443915:  return addPayor(); 
2143        case 94742904:  return addClass_(); 
2144        case 106006350:  return getOrderElement();
2145        case 1843485230:  return getNetworkElement();
2146        case -1866474851:  return addCostToBeneficiary(); 
2147        case 837389739:  return getSubrogationElement();
2148        case -566947566:  return addContract(); 
2149        default: return super.makeProperty(hash, name);
2150        }
2151
2152      }
2153
2154      @Override
2155      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2156        switch (hash) {
2157        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2158        case -892481550: /*status*/ return new String[] {"code"};
2159        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2160        case 2046898558: /*policyHolder*/ return new String[] {"Reference"};
2161        case -1219769240: /*subscriber*/ return new String[] {"Reference"};
2162        case 327834531: /*subscriberId*/ return new String[] {"string"};
2163        case -565102875: /*beneficiary*/ return new String[] {"Reference"};
2164        case -1109226753: /*dependent*/ return new String[] {"string"};
2165        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
2166        case -991726143: /*period*/ return new String[] {"Period"};
2167        case 106443915: /*payor*/ return new String[] {"Reference"};
2168        case 94742904: /*class*/ return new String[] {};
2169        case 106006350: /*order*/ return new String[] {"positiveInt"};
2170        case 1843485230: /*network*/ return new String[] {"string"};
2171        case -1866474851: /*costToBeneficiary*/ return new String[] {};
2172        case 837389739: /*subrogation*/ return new String[] {"boolean"};
2173        case -566947566: /*contract*/ return new String[] {"Reference"};
2174        default: return super.getTypesForProperty(hash, name);
2175        }
2176
2177      }
2178
2179      @Override
2180      public Base addChild(String name) throws FHIRException {
2181        if (name.equals("identifier")) {
2182          return addIdentifier();
2183        }
2184        else if (name.equals("status")) {
2185          throw new FHIRException("Cannot call addChild on a primitive type Coverage.status");
2186        }
2187        else if (name.equals("type")) {
2188          this.type = new CodeableConcept();
2189          return this.type;
2190        }
2191        else if (name.equals("policyHolder")) {
2192          this.policyHolder = new Reference();
2193          return this.policyHolder;
2194        }
2195        else if (name.equals("subscriber")) {
2196          this.subscriber = new Reference();
2197          return this.subscriber;
2198        }
2199        else if (name.equals("subscriberId")) {
2200          throw new FHIRException("Cannot call addChild on a primitive type Coverage.subscriberId");
2201        }
2202        else if (name.equals("beneficiary")) {
2203          this.beneficiary = new Reference();
2204          return this.beneficiary;
2205        }
2206        else if (name.equals("dependent")) {
2207          throw new FHIRException("Cannot call addChild on a primitive type Coverage.dependent");
2208        }
2209        else if (name.equals("relationship")) {
2210          this.relationship = new CodeableConcept();
2211          return this.relationship;
2212        }
2213        else if (name.equals("period")) {
2214          this.period = new Period();
2215          return this.period;
2216        }
2217        else if (name.equals("payor")) {
2218          return addPayor();
2219        }
2220        else if (name.equals("class")) {
2221          return addClass_();
2222        }
2223        else if (name.equals("order")) {
2224          throw new FHIRException("Cannot call addChild on a primitive type Coverage.order");
2225        }
2226        else if (name.equals("network")) {
2227          throw new FHIRException("Cannot call addChild on a primitive type Coverage.network");
2228        }
2229        else if (name.equals("costToBeneficiary")) {
2230          return addCostToBeneficiary();
2231        }
2232        else if (name.equals("subrogation")) {
2233          throw new FHIRException("Cannot call addChild on a primitive type Coverage.subrogation");
2234        }
2235        else if (name.equals("contract")) {
2236          return addContract();
2237        }
2238        else
2239          return super.addChild(name);
2240      }
2241
2242  public String fhirType() {
2243    return "Coverage";
2244
2245  }
2246
2247      public Coverage copy() {
2248        Coverage dst = new Coverage();
2249        copyValues(dst);
2250        return dst;
2251      }
2252
2253      public void copyValues(Coverage dst) {
2254        super.copyValues(dst);
2255        if (identifier != null) {
2256          dst.identifier = new ArrayList<Identifier>();
2257          for (Identifier i : identifier)
2258            dst.identifier.add(i.copy());
2259        };
2260        dst.status = status == null ? null : status.copy();
2261        dst.type = type == null ? null : type.copy();
2262        dst.policyHolder = policyHolder == null ? null : policyHolder.copy();
2263        dst.subscriber = subscriber == null ? null : subscriber.copy();
2264        dst.subscriberId = subscriberId == null ? null : subscriberId.copy();
2265        dst.beneficiary = beneficiary == null ? null : beneficiary.copy();
2266        dst.dependent = dependent == null ? null : dependent.copy();
2267        dst.relationship = relationship == null ? null : relationship.copy();
2268        dst.period = period == null ? null : period.copy();
2269        if (payor != null) {
2270          dst.payor = new ArrayList<Reference>();
2271          for (Reference i : payor)
2272            dst.payor.add(i.copy());
2273        };
2274        if (class_ != null) {
2275          dst.class_ = new ArrayList<ClassComponent>();
2276          for (ClassComponent i : class_)
2277            dst.class_.add(i.copy());
2278        };
2279        dst.order = order == null ? null : order.copy();
2280        dst.network = network == null ? null : network.copy();
2281        if (costToBeneficiary != null) {
2282          dst.costToBeneficiary = new ArrayList<CostToBeneficiaryComponent>();
2283          for (CostToBeneficiaryComponent i : costToBeneficiary)
2284            dst.costToBeneficiary.add(i.copy());
2285        };
2286        dst.subrogation = subrogation == null ? null : subrogation.copy();
2287        if (contract != null) {
2288          dst.contract = new ArrayList<Reference>();
2289          for (Reference i : contract)
2290            dst.contract.add(i.copy());
2291        };
2292      }
2293
2294      protected Coverage typedCopy() {
2295        return copy();
2296      }
2297
2298      @Override
2299      public boolean equalsDeep(Base other_) {
2300        if (!super.equalsDeep(other_))
2301          return false;
2302        if (!(other_ instanceof Coverage))
2303          return false;
2304        Coverage o = (Coverage) other_;
2305        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
2306           && compareDeep(policyHolder, o.policyHolder, true) && compareDeep(subscriber, o.subscriber, true)
2307           && compareDeep(subscriberId, o.subscriberId, true) && compareDeep(beneficiary, o.beneficiary, true)
2308           && compareDeep(dependent, o.dependent, true) && compareDeep(relationship, o.relationship, true)
2309           && compareDeep(period, o.period, true) && compareDeep(payor, o.payor, true) && compareDeep(class_, o.class_, true)
2310           && compareDeep(order, o.order, true) && compareDeep(network, o.network, true) && compareDeep(costToBeneficiary, o.costToBeneficiary, true)
2311           && compareDeep(subrogation, o.subrogation, true) && compareDeep(contract, o.contract, true);
2312      }
2313
2314      @Override
2315      public boolean equalsShallow(Base other_) {
2316        if (!super.equalsShallow(other_))
2317          return false;
2318        if (!(other_ instanceof Coverage))
2319          return false;
2320        Coverage o = (Coverage) other_;
2321        return compareValues(status, o.status, true) && compareValues(subscriberId, o.subscriberId, true) && compareValues(dependent, o.dependent, true)
2322           && compareValues(order, o.order, true) && compareValues(network, o.network, true) && compareValues(subrogation, o.subrogation, true)
2323          ;
2324      }
2325
2326      public boolean isEmpty() {
2327        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
2328          , policyHolder, subscriber, subscriberId, beneficiary, dependent, relationship, period
2329          , payor, class_, order, network, costToBeneficiary, subrogation, contract);
2330      }
2331
2332  @Override
2333  public ResourceType getResourceType() {
2334    return ResourceType.Coverage;
2335   }
2336
2337 /**
2338   * Search parameter: <b>identifier</b>
2339   * <p>
2340   * Description: <b>The primary identifier of the insured and the coverage</b><br>
2341   * Type: <b>token</b><br>
2342   * Path: <b>Coverage.identifier</b><br>
2343   * </p>
2344   */
2345  @SearchParamDefinition(name="identifier", path="Coverage.identifier", description="The primary identifier of the insured and the coverage", type="token" )
2346  public static final String SP_IDENTIFIER = "identifier";
2347 /**
2348   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2349   * <p>
2350   * Description: <b>The primary identifier of the insured and the coverage</b><br>
2351   * Type: <b>token</b><br>
2352   * Path: <b>Coverage.identifier</b><br>
2353   * </p>
2354   */
2355  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2356
2357 /**
2358   * Search parameter: <b>payor</b>
2359   * <p>
2360   * Description: <b>The identity of the insurer or party paying for services</b><br>
2361   * Type: <b>reference</b><br>
2362   * Path: <b>Coverage.payor</b><br>
2363   * </p>
2364   */
2365  @SearchParamDefinition(name="payor", path="Coverage.payor", description="The identity of the insurer or party paying for services", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Organization.class, Patient.class, RelatedPerson.class } )
2366  public static final String SP_PAYOR = "payor";
2367 /**
2368   * <b>Fluent Client</b> search parameter constant for <b>payor</b>
2369   * <p>
2370   * Description: <b>The identity of the insurer or party paying for services</b><br>
2371   * Type: <b>reference</b><br>
2372   * Path: <b>Coverage.payor</b><br>
2373   * </p>
2374   */
2375  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYOR);
2376
2377/**
2378   * Constant for fluent queries to be used to add include statements. Specifies
2379   * the path value of "<b>Coverage:payor</b>".
2380   */
2381  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYOR = new ca.uhn.fhir.model.api.Include("Coverage:payor").toLocked();
2382
2383 /**
2384   * Search parameter: <b>subscriber</b>
2385   * <p>
2386   * Description: <b>Reference to the subscriber</b><br>
2387   * Type: <b>reference</b><br>
2388   * Path: <b>Coverage.subscriber</b><br>
2389   * </p>
2390   */
2391  @SearchParamDefinition(name="subscriber", path="Coverage.subscriber", description="Reference to the subscriber", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Patient.class, RelatedPerson.class } )
2392  public static final String SP_SUBSCRIBER = "subscriber";
2393 /**
2394   * <b>Fluent Client</b> search parameter constant for <b>subscriber</b>
2395   * <p>
2396   * Description: <b>Reference to the subscriber</b><br>
2397   * Type: <b>reference</b><br>
2398   * Path: <b>Coverage.subscriber</b><br>
2399   * </p>
2400   */
2401  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBSCRIBER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBSCRIBER);
2402
2403/**
2404   * Constant for fluent queries to be used to add include statements. Specifies
2405   * the path value of "<b>Coverage:subscriber</b>".
2406   */
2407  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBSCRIBER = new ca.uhn.fhir.model.api.Include("Coverage:subscriber").toLocked();
2408
2409 /**
2410   * Search parameter: <b>beneficiary</b>
2411   * <p>
2412   * Description: <b>Covered party</b><br>
2413   * Type: <b>reference</b><br>
2414   * Path: <b>Coverage.beneficiary</b><br>
2415   * </p>
2416   */
2417  @SearchParamDefinition(name="beneficiary", path="Coverage.beneficiary", description="Covered party", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
2418  public static final String SP_BENEFICIARY = "beneficiary";
2419 /**
2420   * <b>Fluent Client</b> search parameter constant for <b>beneficiary</b>
2421   * <p>
2422   * Description: <b>Covered party</b><br>
2423   * Type: <b>reference</b><br>
2424   * Path: <b>Coverage.beneficiary</b><br>
2425   * </p>
2426   */
2427  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BENEFICIARY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BENEFICIARY);
2428
2429/**
2430   * Constant for fluent queries to be used to add include statements. Specifies
2431   * the path value of "<b>Coverage:beneficiary</b>".
2432   */
2433  public static final ca.uhn.fhir.model.api.Include INCLUDE_BENEFICIARY = new ca.uhn.fhir.model.api.Include("Coverage:beneficiary").toLocked();
2434
2435 /**
2436   * Search parameter: <b>patient</b>
2437   * <p>
2438   * Description: <b>Retrieve coverages for a patient</b><br>
2439   * Type: <b>reference</b><br>
2440   * Path: <b>Coverage.beneficiary</b><br>
2441   * </p>
2442   */
2443  @SearchParamDefinition(name="patient", path="Coverage.beneficiary", description="Retrieve coverages for a patient", type="reference", target={Patient.class } )
2444  public static final String SP_PATIENT = "patient";
2445 /**
2446   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2447   * <p>
2448   * Description: <b>Retrieve coverages for a patient</b><br>
2449   * Type: <b>reference</b><br>
2450   * Path: <b>Coverage.beneficiary</b><br>
2451   * </p>
2452   */
2453  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2454
2455/**
2456   * Constant for fluent queries to be used to add include statements. Specifies
2457   * the path value of "<b>Coverage:patient</b>".
2458   */
2459  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Coverage:patient").toLocked();
2460
2461 /**
2462   * Search parameter: <b>class-value</b>
2463   * <p>
2464   * Description: <b>Value of the class (eg. Plan number, group number)</b><br>
2465   * Type: <b>string</b><br>
2466   * Path: <b>Coverage.class.value</b><br>
2467   * </p>
2468   */
2469  @SearchParamDefinition(name="class-value", path="Coverage.class.value", description="Value of the class (eg. Plan number, group number)", type="string" )
2470  public static final String SP_CLASS_VALUE = "class-value";
2471 /**
2472   * <b>Fluent Client</b> search parameter constant for <b>class-value</b>
2473   * <p>
2474   * Description: <b>Value of the class (eg. Plan number, group number)</b><br>
2475   * Type: <b>string</b><br>
2476   * Path: <b>Coverage.class.value</b><br>
2477   * </p>
2478   */
2479  public static final ca.uhn.fhir.rest.gclient.StringClientParam CLASS_VALUE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_CLASS_VALUE);
2480
2481 /**
2482   * Search parameter: <b>type</b>
2483   * <p>
2484   * Description: <b>The kind of coverage (health plan, auto, Workers Compensation)</b><br>
2485   * Type: <b>token</b><br>
2486   * Path: <b>Coverage.type</b><br>
2487   * </p>
2488   */
2489  @SearchParamDefinition(name="type", path="Coverage.type", description="The kind of coverage (health plan, auto, Workers Compensation)", type="token" )
2490  public static final String SP_TYPE = "type";
2491 /**
2492   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2493   * <p>
2494   * Description: <b>The kind of coverage (health plan, auto, Workers Compensation)</b><br>
2495   * Type: <b>token</b><br>
2496   * Path: <b>Coverage.type</b><br>
2497   * </p>
2498   */
2499  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2500
2501 /**
2502   * Search parameter: <b>dependent</b>
2503   * <p>
2504   * Description: <b>Dependent number</b><br>
2505   * Type: <b>string</b><br>
2506   * Path: <b>Coverage.dependent</b><br>
2507   * </p>
2508   */
2509  @SearchParamDefinition(name="dependent", path="Coverage.dependent", description="Dependent number", type="string" )
2510  public static final String SP_DEPENDENT = "dependent";
2511 /**
2512   * <b>Fluent Client</b> search parameter constant for <b>dependent</b>
2513   * <p>
2514   * Description: <b>Dependent number</b><br>
2515   * Type: <b>string</b><br>
2516   * Path: <b>Coverage.dependent</b><br>
2517   * </p>
2518   */
2519  public static final ca.uhn.fhir.rest.gclient.StringClientParam DEPENDENT = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DEPENDENT);
2520
2521 /**
2522   * Search parameter: <b>class-type</b>
2523   * <p>
2524   * Description: <b>Coverage class (eg. plan, group)</b><br>
2525   * Type: <b>token</b><br>
2526   * Path: <b>Coverage.class.type</b><br>
2527   * </p>
2528   */
2529  @SearchParamDefinition(name="class-type", path="Coverage.class.type", description="Coverage class (eg. plan, group)", type="token" )
2530  public static final String SP_CLASS_TYPE = "class-type";
2531 /**
2532   * <b>Fluent Client</b> search parameter constant for <b>class-type</b>
2533   * <p>
2534   * Description: <b>Coverage class (eg. plan, group)</b><br>
2535   * Type: <b>token</b><br>
2536   * Path: <b>Coverage.class.type</b><br>
2537   * </p>
2538   */
2539  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLASS_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLASS_TYPE);
2540
2541 /**
2542   * Search parameter: <b>policy-holder</b>
2543   * <p>
2544   * Description: <b>Reference to the policyholder</b><br>
2545   * Type: <b>reference</b><br>
2546   * Path: <b>Coverage.policyHolder</b><br>
2547   * </p>
2548   */
2549  @SearchParamDefinition(name="policy-holder", path="Coverage.policyHolder", description="Reference to the policyholder", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Organization.class, Patient.class, RelatedPerson.class } )
2550  public static final String SP_POLICY_HOLDER = "policy-holder";
2551 /**
2552   * <b>Fluent Client</b> search parameter constant for <b>policy-holder</b>
2553   * <p>
2554   * Description: <b>Reference to the policyholder</b><br>
2555   * Type: <b>reference</b><br>
2556   * Path: <b>Coverage.policyHolder</b><br>
2557   * </p>
2558   */
2559  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam POLICY_HOLDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_POLICY_HOLDER);
2560
2561/**
2562   * Constant for fluent queries to be used to add include statements. Specifies
2563   * the path value of "<b>Coverage:policy-holder</b>".
2564   */
2565  public static final ca.uhn.fhir.model.api.Include INCLUDE_POLICY_HOLDER = new ca.uhn.fhir.model.api.Include("Coverage:policy-holder").toLocked();
2566
2567 /**
2568   * Search parameter: <b>status</b>
2569   * <p>
2570   * Description: <b>The status of the Coverage</b><br>
2571   * Type: <b>token</b><br>
2572   * Path: <b>Coverage.status</b><br>
2573   * </p>
2574   */
2575  @SearchParamDefinition(name="status", path="Coverage.status", description="The status of the Coverage", type="token" )
2576  public static final String SP_STATUS = "status";
2577 /**
2578   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2579   * <p>
2580   * Description: <b>The status of the Coverage</b><br>
2581   * Type: <b>token</b><br>
2582   * Path: <b>Coverage.status</b><br>
2583   * </p>
2584   */
2585  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2586
2587
2588}