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