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