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