001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * Details of a Health Insurance product/plan provided by an organization.
052 */
053@ResourceDef(name="InsurancePlan", profile="http://hl7.org/fhir/StructureDefinition/InsurancePlan")
054public class InsurancePlan extends DomainResource {
055
056    @Block()
057    public static class InsurancePlanCoverageComponent extends BackboneElement implements IBaseBackboneElement {
058        /**
059         * Type of coverage  (Medical; Dental; Mental Health; Substance Abuse; Vision; Drug; Short Term; Long Term Care; Hospice; Home Health).
060         */
061        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
062        @Description(shortDefinition="Type of coverage", formalDefinition="Type of coverage  (Medical; Dental; Mental Health; Substance Abuse; Vision; Drug; Short Term; Long Term Care; Hospice; Home Health)." )
063        protected CodeableConcept type;
064
065        /**
066         * Reference to the network that providing the type of coverage.
067         */
068        @Child(name = "network", type = {Organization.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
069        @Description(shortDefinition="What networks provide coverage", formalDefinition="Reference to the network that providing the type of coverage." )
070        protected List<Reference> network;
071
072        /**
073         * Specific benefits under this type of coverage.
074         */
075        @Child(name = "benefit", type = {}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
076        @Description(shortDefinition="List of benefits", formalDefinition="Specific benefits under this type of coverage." )
077        protected List<CoverageBenefitComponent> benefit;
078
079        private static final long serialVersionUID = 79927205L;
080
081    /**
082     * Constructor
083     */
084      public InsurancePlanCoverageComponent() {
085        super();
086      }
087
088    /**
089     * Constructor
090     */
091      public InsurancePlanCoverageComponent(CodeableConcept type, CoverageBenefitComponent benefit) {
092        super();
093        this.setType(type);
094        this.addBenefit(benefit);
095      }
096
097        /**
098         * @return {@link #type} (Type of coverage  (Medical; Dental; Mental Health; Substance Abuse; Vision; Drug; Short Term; Long Term Care; Hospice; Home Health).)
099         */
100        public CodeableConcept getType() { 
101          if (this.type == null)
102            if (Configuration.errorOnAutoCreate())
103              throw new Error("Attempt to auto-create InsurancePlanCoverageComponent.type");
104            else if (Configuration.doAutoCreate())
105              this.type = new CodeableConcept(); // cc
106          return this.type;
107        }
108
109        public boolean hasType() { 
110          return this.type != null && !this.type.isEmpty();
111        }
112
113        /**
114         * @param value {@link #type} (Type of coverage  (Medical; Dental; Mental Health; Substance Abuse; Vision; Drug; Short Term; Long Term Care; Hospice; Home Health).)
115         */
116        public InsurancePlanCoverageComponent setType(CodeableConcept value) { 
117          this.type = value;
118          return this;
119        }
120
121        /**
122         * @return {@link #network} (Reference to the network that providing the type of coverage.)
123         */
124        public List<Reference> getNetwork() { 
125          if (this.network == null)
126            this.network = new ArrayList<Reference>();
127          return this.network;
128        }
129
130        /**
131         * @return Returns a reference to <code>this</code> for easy method chaining
132         */
133        public InsurancePlanCoverageComponent setNetwork(List<Reference> theNetwork) { 
134          this.network = theNetwork;
135          return this;
136        }
137
138        public boolean hasNetwork() { 
139          if (this.network == null)
140            return false;
141          for (Reference item : this.network)
142            if (!item.isEmpty())
143              return true;
144          return false;
145        }
146
147        public Reference addNetwork() { //3
148          Reference t = new Reference();
149          if (this.network == null)
150            this.network = new ArrayList<Reference>();
151          this.network.add(t);
152          return t;
153        }
154
155        public InsurancePlanCoverageComponent addNetwork(Reference t) { //3
156          if (t == null)
157            return this;
158          if (this.network == null)
159            this.network = new ArrayList<Reference>();
160          this.network.add(t);
161          return this;
162        }
163
164        /**
165         * @return The first repetition of repeating field {@link #network}, creating it if it does not already exist {3}
166         */
167        public Reference getNetworkFirstRep() { 
168          if (getNetwork().isEmpty()) {
169            addNetwork();
170          }
171          return getNetwork().get(0);
172        }
173
174        /**
175         * @return {@link #benefit} (Specific benefits under this type of coverage.)
176         */
177        public List<CoverageBenefitComponent> getBenefit() { 
178          if (this.benefit == null)
179            this.benefit = new ArrayList<CoverageBenefitComponent>();
180          return this.benefit;
181        }
182
183        /**
184         * @return Returns a reference to <code>this</code> for easy method chaining
185         */
186        public InsurancePlanCoverageComponent setBenefit(List<CoverageBenefitComponent> theBenefit) { 
187          this.benefit = theBenefit;
188          return this;
189        }
190
191        public boolean hasBenefit() { 
192          if (this.benefit == null)
193            return false;
194          for (CoverageBenefitComponent item : this.benefit)
195            if (!item.isEmpty())
196              return true;
197          return false;
198        }
199
200        public CoverageBenefitComponent addBenefit() { //3
201          CoverageBenefitComponent t = new CoverageBenefitComponent();
202          if (this.benefit == null)
203            this.benefit = new ArrayList<CoverageBenefitComponent>();
204          this.benefit.add(t);
205          return t;
206        }
207
208        public InsurancePlanCoverageComponent addBenefit(CoverageBenefitComponent t) { //3
209          if (t == null)
210            return this;
211          if (this.benefit == null)
212            this.benefit = new ArrayList<CoverageBenefitComponent>();
213          this.benefit.add(t);
214          return this;
215        }
216
217        /**
218         * @return The first repetition of repeating field {@link #benefit}, creating it if it does not already exist {3}
219         */
220        public CoverageBenefitComponent getBenefitFirstRep() { 
221          if (getBenefit().isEmpty()) {
222            addBenefit();
223          }
224          return getBenefit().get(0);
225        }
226
227        protected void listChildren(List<Property> children) {
228          super.listChildren(children);
229          children.add(new Property("type", "CodeableConcept", "Type of coverage  (Medical; Dental; Mental Health; Substance Abuse; Vision; Drug; Short Term; Long Term Care; Hospice; Home Health).", 0, 1, type));
230          children.add(new Property("network", "Reference(Organization)", "Reference to the network that providing the type of coverage.", 0, java.lang.Integer.MAX_VALUE, network));
231          children.add(new Property("benefit", "", "Specific benefits under this type of coverage.", 0, java.lang.Integer.MAX_VALUE, benefit));
232        }
233
234        @Override
235        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
236          switch (_hash) {
237          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of coverage  (Medical; Dental; Mental Health; Substance Abuse; Vision; Drug; Short Term; Long Term Care; Hospice; Home Health).", 0, 1, type);
238          case 1843485230: /*network*/  return new Property("network", "Reference(Organization)", "Reference to the network that providing the type of coverage.", 0, java.lang.Integer.MAX_VALUE, network);
239          case -222710633: /*benefit*/  return new Property("benefit", "", "Specific benefits under this type of coverage.", 0, java.lang.Integer.MAX_VALUE, benefit);
240          default: return super.getNamedProperty(_hash, _name, _checkValid);
241          }
242
243        }
244
245      @Override
246      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
247        switch (hash) {
248        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
249        case 1843485230: /*network*/ return this.network == null ? new Base[0] : this.network.toArray(new Base[this.network.size()]); // Reference
250        case -222710633: /*benefit*/ return this.benefit == null ? new Base[0] : this.benefit.toArray(new Base[this.benefit.size()]); // CoverageBenefitComponent
251        default: return super.getProperty(hash, name, checkValid);
252        }
253
254      }
255
256      @Override
257      public Base setProperty(int hash, String name, Base value) throws FHIRException {
258        switch (hash) {
259        case 3575610: // type
260          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
261          return value;
262        case 1843485230: // network
263          this.getNetwork().add(TypeConvertor.castToReference(value)); // Reference
264          return value;
265        case -222710633: // benefit
266          this.getBenefit().add((CoverageBenefitComponent) value); // CoverageBenefitComponent
267          return value;
268        default: return super.setProperty(hash, name, value);
269        }
270
271      }
272
273      @Override
274      public Base setProperty(String name, Base value) throws FHIRException {
275        if (name.equals("type")) {
276          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
277        } else if (name.equals("network")) {
278          this.getNetwork().add(TypeConvertor.castToReference(value));
279        } else if (name.equals("benefit")) {
280          this.getBenefit().add((CoverageBenefitComponent) value);
281        } else
282          return super.setProperty(name, value);
283        return value;
284      }
285
286      @Override
287      public Base makeProperty(int hash, String name) throws FHIRException {
288        switch (hash) {
289        case 3575610:  return getType();
290        case 1843485230:  return addNetwork(); 
291        case -222710633:  return addBenefit(); 
292        default: return super.makeProperty(hash, name);
293        }
294
295      }
296
297      @Override
298      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
299        switch (hash) {
300        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
301        case 1843485230: /*network*/ return new String[] {"Reference"};
302        case -222710633: /*benefit*/ return new String[] {};
303        default: return super.getTypesForProperty(hash, name);
304        }
305
306      }
307
308      @Override
309      public Base addChild(String name) throws FHIRException {
310        if (name.equals("type")) {
311          this.type = new CodeableConcept();
312          return this.type;
313        }
314        else if (name.equals("network")) {
315          return addNetwork();
316        }
317        else if (name.equals("benefit")) {
318          return addBenefit();
319        }
320        else
321          return super.addChild(name);
322      }
323
324      public InsurancePlanCoverageComponent copy() {
325        InsurancePlanCoverageComponent dst = new InsurancePlanCoverageComponent();
326        copyValues(dst);
327        return dst;
328      }
329
330      public void copyValues(InsurancePlanCoverageComponent dst) {
331        super.copyValues(dst);
332        dst.type = type == null ? null : type.copy();
333        if (network != null) {
334          dst.network = new ArrayList<Reference>();
335          for (Reference i : network)
336            dst.network.add(i.copy());
337        };
338        if (benefit != null) {
339          dst.benefit = new ArrayList<CoverageBenefitComponent>();
340          for (CoverageBenefitComponent i : benefit)
341            dst.benefit.add(i.copy());
342        };
343      }
344
345      @Override
346      public boolean equalsDeep(Base other_) {
347        if (!super.equalsDeep(other_))
348          return false;
349        if (!(other_ instanceof InsurancePlanCoverageComponent))
350          return false;
351        InsurancePlanCoverageComponent o = (InsurancePlanCoverageComponent) other_;
352        return compareDeep(type, o.type, true) && compareDeep(network, o.network, true) && compareDeep(benefit, o.benefit, true)
353          ;
354      }
355
356      @Override
357      public boolean equalsShallow(Base other_) {
358        if (!super.equalsShallow(other_))
359          return false;
360        if (!(other_ instanceof InsurancePlanCoverageComponent))
361          return false;
362        InsurancePlanCoverageComponent o = (InsurancePlanCoverageComponent) other_;
363        return true;
364      }
365
366      public boolean isEmpty() {
367        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, network, benefit);
368      }
369
370  public String fhirType() {
371    return "InsurancePlan.coverage";
372
373  }
374
375  }
376
377    @Block()
378    public static class CoverageBenefitComponent extends BackboneElement implements IBaseBackboneElement {
379        /**
380         * Type of benefit (primary care; speciality care; inpatient; outpatient).
381         */
382        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
383        @Description(shortDefinition="Type of benefit", formalDefinition="Type of benefit (primary care; speciality care; inpatient; outpatient)." )
384        protected CodeableConcept type;
385
386        /**
387         * The referral requirements to have access/coverage for this benefit.
388         */
389        @Child(name = "requirement", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
390        @Description(shortDefinition="Referral requirements", formalDefinition="The referral requirements to have access/coverage for this benefit." )
391        protected StringType requirement;
392
393        /**
394         * The specific limits on the benefit.
395         */
396        @Child(name = "limit", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
397        @Description(shortDefinition="Benefit limits", formalDefinition="The specific limits on the benefit." )
398        protected List<CoverageBenefitLimitComponent> limit;
399
400        private static final long serialVersionUID = -113658449L;
401
402    /**
403     * Constructor
404     */
405      public CoverageBenefitComponent() {
406        super();
407      }
408
409    /**
410     * Constructor
411     */
412      public CoverageBenefitComponent(CodeableConcept type) {
413        super();
414        this.setType(type);
415      }
416
417        /**
418         * @return {@link #type} (Type of benefit (primary care; speciality care; inpatient; outpatient).)
419         */
420        public CodeableConcept getType() { 
421          if (this.type == null)
422            if (Configuration.errorOnAutoCreate())
423              throw new Error("Attempt to auto-create CoverageBenefitComponent.type");
424            else if (Configuration.doAutoCreate())
425              this.type = new CodeableConcept(); // cc
426          return this.type;
427        }
428
429        public boolean hasType() { 
430          return this.type != null && !this.type.isEmpty();
431        }
432
433        /**
434         * @param value {@link #type} (Type of benefit (primary care; speciality care; inpatient; outpatient).)
435         */
436        public CoverageBenefitComponent setType(CodeableConcept value) { 
437          this.type = value;
438          return this;
439        }
440
441        /**
442         * @return {@link #requirement} (The referral requirements to have access/coverage for this benefit.). This is the underlying object with id, value and extensions. The accessor "getRequirement" gives direct access to the value
443         */
444        public StringType getRequirementElement() { 
445          if (this.requirement == null)
446            if (Configuration.errorOnAutoCreate())
447              throw new Error("Attempt to auto-create CoverageBenefitComponent.requirement");
448            else if (Configuration.doAutoCreate())
449              this.requirement = new StringType(); // bb
450          return this.requirement;
451        }
452
453        public boolean hasRequirementElement() { 
454          return this.requirement != null && !this.requirement.isEmpty();
455        }
456
457        public boolean hasRequirement() { 
458          return this.requirement != null && !this.requirement.isEmpty();
459        }
460
461        /**
462         * @param value {@link #requirement} (The referral requirements to have access/coverage for this benefit.). This is the underlying object with id, value and extensions. The accessor "getRequirement" gives direct access to the value
463         */
464        public CoverageBenefitComponent setRequirementElement(StringType value) { 
465          this.requirement = value;
466          return this;
467        }
468
469        /**
470         * @return The referral requirements to have access/coverage for this benefit.
471         */
472        public String getRequirement() { 
473          return this.requirement == null ? null : this.requirement.getValue();
474        }
475
476        /**
477         * @param value The referral requirements to have access/coverage for this benefit.
478         */
479        public CoverageBenefitComponent setRequirement(String value) { 
480          if (Utilities.noString(value))
481            this.requirement = null;
482          else {
483            if (this.requirement == null)
484              this.requirement = new StringType();
485            this.requirement.setValue(value);
486          }
487          return this;
488        }
489
490        /**
491         * @return {@link #limit} (The specific limits on the benefit.)
492         */
493        public List<CoverageBenefitLimitComponent> getLimit() { 
494          if (this.limit == null)
495            this.limit = new ArrayList<CoverageBenefitLimitComponent>();
496          return this.limit;
497        }
498
499        /**
500         * @return Returns a reference to <code>this</code> for easy method chaining
501         */
502        public CoverageBenefitComponent setLimit(List<CoverageBenefitLimitComponent> theLimit) { 
503          this.limit = theLimit;
504          return this;
505        }
506
507        public boolean hasLimit() { 
508          if (this.limit == null)
509            return false;
510          for (CoverageBenefitLimitComponent item : this.limit)
511            if (!item.isEmpty())
512              return true;
513          return false;
514        }
515
516        public CoverageBenefitLimitComponent addLimit() { //3
517          CoverageBenefitLimitComponent t = new CoverageBenefitLimitComponent();
518          if (this.limit == null)
519            this.limit = new ArrayList<CoverageBenefitLimitComponent>();
520          this.limit.add(t);
521          return t;
522        }
523
524        public CoverageBenefitComponent addLimit(CoverageBenefitLimitComponent t) { //3
525          if (t == null)
526            return this;
527          if (this.limit == null)
528            this.limit = new ArrayList<CoverageBenefitLimitComponent>();
529          this.limit.add(t);
530          return this;
531        }
532
533        /**
534         * @return The first repetition of repeating field {@link #limit}, creating it if it does not already exist {3}
535         */
536        public CoverageBenefitLimitComponent getLimitFirstRep() { 
537          if (getLimit().isEmpty()) {
538            addLimit();
539          }
540          return getLimit().get(0);
541        }
542
543        protected void listChildren(List<Property> children) {
544          super.listChildren(children);
545          children.add(new Property("type", "CodeableConcept", "Type of benefit (primary care; speciality care; inpatient; outpatient).", 0, 1, type));
546          children.add(new Property("requirement", "string", "The referral requirements to have access/coverage for this benefit.", 0, 1, requirement));
547          children.add(new Property("limit", "", "The specific limits on the benefit.", 0, java.lang.Integer.MAX_VALUE, limit));
548        }
549
550        @Override
551        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
552          switch (_hash) {
553          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of benefit (primary care; speciality care; inpatient; outpatient).", 0, 1, type);
554          case 363387971: /*requirement*/  return new Property("requirement", "string", "The referral requirements to have access/coverage for this benefit.", 0, 1, requirement);
555          case 102976443: /*limit*/  return new Property("limit", "", "The specific limits on the benefit.", 0, java.lang.Integer.MAX_VALUE, limit);
556          default: return super.getNamedProperty(_hash, _name, _checkValid);
557          }
558
559        }
560
561      @Override
562      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
563        switch (hash) {
564        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
565        case 363387971: /*requirement*/ return this.requirement == null ? new Base[0] : new Base[] {this.requirement}; // StringType
566        case 102976443: /*limit*/ return this.limit == null ? new Base[0] : this.limit.toArray(new Base[this.limit.size()]); // CoverageBenefitLimitComponent
567        default: return super.getProperty(hash, name, checkValid);
568        }
569
570      }
571
572      @Override
573      public Base setProperty(int hash, String name, Base value) throws FHIRException {
574        switch (hash) {
575        case 3575610: // type
576          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
577          return value;
578        case 363387971: // requirement
579          this.requirement = TypeConvertor.castToString(value); // StringType
580          return value;
581        case 102976443: // limit
582          this.getLimit().add((CoverageBenefitLimitComponent) value); // CoverageBenefitLimitComponent
583          return value;
584        default: return super.setProperty(hash, name, value);
585        }
586
587      }
588
589      @Override
590      public Base setProperty(String name, Base value) throws FHIRException {
591        if (name.equals("type")) {
592          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
593        } else if (name.equals("requirement")) {
594          this.requirement = TypeConvertor.castToString(value); // StringType
595        } else if (name.equals("limit")) {
596          this.getLimit().add((CoverageBenefitLimitComponent) value);
597        } else
598          return super.setProperty(name, value);
599        return value;
600      }
601
602      @Override
603      public Base makeProperty(int hash, String name) throws FHIRException {
604        switch (hash) {
605        case 3575610:  return getType();
606        case 363387971:  return getRequirementElement();
607        case 102976443:  return addLimit(); 
608        default: return super.makeProperty(hash, name);
609        }
610
611      }
612
613      @Override
614      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
615        switch (hash) {
616        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
617        case 363387971: /*requirement*/ return new String[] {"string"};
618        case 102976443: /*limit*/ return new String[] {};
619        default: return super.getTypesForProperty(hash, name);
620        }
621
622      }
623
624      @Override
625      public Base addChild(String name) throws FHIRException {
626        if (name.equals("type")) {
627          this.type = new CodeableConcept();
628          return this.type;
629        }
630        else if (name.equals("requirement")) {
631          throw new FHIRException("Cannot call addChild on a primitive type InsurancePlan.coverage.benefit.requirement");
632        }
633        else if (name.equals("limit")) {
634          return addLimit();
635        }
636        else
637          return super.addChild(name);
638      }
639
640      public CoverageBenefitComponent copy() {
641        CoverageBenefitComponent dst = new CoverageBenefitComponent();
642        copyValues(dst);
643        return dst;
644      }
645
646      public void copyValues(CoverageBenefitComponent dst) {
647        super.copyValues(dst);
648        dst.type = type == null ? null : type.copy();
649        dst.requirement = requirement == null ? null : requirement.copy();
650        if (limit != null) {
651          dst.limit = new ArrayList<CoverageBenefitLimitComponent>();
652          for (CoverageBenefitLimitComponent i : limit)
653            dst.limit.add(i.copy());
654        };
655      }
656
657      @Override
658      public boolean equalsDeep(Base other_) {
659        if (!super.equalsDeep(other_))
660          return false;
661        if (!(other_ instanceof CoverageBenefitComponent))
662          return false;
663        CoverageBenefitComponent o = (CoverageBenefitComponent) other_;
664        return compareDeep(type, o.type, true) && compareDeep(requirement, o.requirement, true) && compareDeep(limit, o.limit, true)
665          ;
666      }
667
668      @Override
669      public boolean equalsShallow(Base other_) {
670        if (!super.equalsShallow(other_))
671          return false;
672        if (!(other_ instanceof CoverageBenefitComponent))
673          return false;
674        CoverageBenefitComponent o = (CoverageBenefitComponent) other_;
675        return compareValues(requirement, o.requirement, true);
676      }
677
678      public boolean isEmpty() {
679        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, requirement, limit
680          );
681      }
682
683  public String fhirType() {
684    return "InsurancePlan.coverage.benefit";
685
686  }
687
688  }
689
690    @Block()
691    public static class CoverageBenefitLimitComponent extends BackboneElement implements IBaseBackboneElement {
692        /**
693         * The maximum amount of a service item a plan will pay for a covered benefit.  For examples. wellness visits, or eyeglasses.
694         */
695        @Child(name = "value", type = {Quantity.class}, order=1, min=0, max=1, modifier=false, summary=false)
696        @Description(shortDefinition="Maximum value allowed", formalDefinition="The maximum amount of a service item a plan will pay for a covered benefit.  For examples. wellness visits, or eyeglasses." )
697        protected Quantity value;
698
699        /**
700         * The specific limit on the benefit.
701         */
702        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
703        @Description(shortDefinition="Benefit limit details", formalDefinition="The specific limit on the benefit." )
704        protected CodeableConcept code;
705
706        private static final long serialVersionUID = -304318128L;
707
708    /**
709     * Constructor
710     */
711      public CoverageBenefitLimitComponent() {
712        super();
713      }
714
715        /**
716         * @return {@link #value} (The maximum amount of a service item a plan will pay for a covered benefit.  For examples. wellness visits, or eyeglasses.)
717         */
718        public Quantity getValue() { 
719          if (this.value == null)
720            if (Configuration.errorOnAutoCreate())
721              throw new Error("Attempt to auto-create CoverageBenefitLimitComponent.value");
722            else if (Configuration.doAutoCreate())
723              this.value = new Quantity(); // cc
724          return this.value;
725        }
726
727        public boolean hasValue() { 
728          return this.value != null && !this.value.isEmpty();
729        }
730
731        /**
732         * @param value {@link #value} (The maximum amount of a service item a plan will pay for a covered benefit.  For examples. wellness visits, or eyeglasses.)
733         */
734        public CoverageBenefitLimitComponent setValue(Quantity value) { 
735          this.value = value;
736          return this;
737        }
738
739        /**
740         * @return {@link #code} (The specific limit on the benefit.)
741         */
742        public CodeableConcept getCode() { 
743          if (this.code == null)
744            if (Configuration.errorOnAutoCreate())
745              throw new Error("Attempt to auto-create CoverageBenefitLimitComponent.code");
746            else if (Configuration.doAutoCreate())
747              this.code = new CodeableConcept(); // cc
748          return this.code;
749        }
750
751        public boolean hasCode() { 
752          return this.code != null && !this.code.isEmpty();
753        }
754
755        /**
756         * @param value {@link #code} (The specific limit on the benefit.)
757         */
758        public CoverageBenefitLimitComponent setCode(CodeableConcept value) { 
759          this.code = value;
760          return this;
761        }
762
763        protected void listChildren(List<Property> children) {
764          super.listChildren(children);
765          children.add(new Property("value", "Quantity", "The maximum amount of a service item a plan will pay for a covered benefit.  For examples. wellness visits, or eyeglasses.", 0, 1, value));
766          children.add(new Property("code", "CodeableConcept", "The specific limit on the benefit.", 0, 1, code));
767        }
768
769        @Override
770        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
771          switch (_hash) {
772          case 111972721: /*value*/  return new Property("value", "Quantity", "The maximum amount of a service item a plan will pay for a covered benefit.  For examples. wellness visits, or eyeglasses.", 0, 1, value);
773          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "The specific limit on the benefit.", 0, 1, code);
774          default: return super.getNamedProperty(_hash, _name, _checkValid);
775          }
776
777        }
778
779      @Override
780      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
781        switch (hash) {
782        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Quantity
783        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
784        default: return super.getProperty(hash, name, checkValid);
785        }
786
787      }
788
789      @Override
790      public Base setProperty(int hash, String name, Base value) throws FHIRException {
791        switch (hash) {
792        case 111972721: // value
793          this.value = TypeConvertor.castToQuantity(value); // Quantity
794          return value;
795        case 3059181: // code
796          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
797          return value;
798        default: return super.setProperty(hash, name, value);
799        }
800
801      }
802
803      @Override
804      public Base setProperty(String name, Base value) throws FHIRException {
805        if (name.equals("value")) {
806          this.value = TypeConvertor.castToQuantity(value); // Quantity
807        } else if (name.equals("code")) {
808          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
809        } else
810          return super.setProperty(name, value);
811        return value;
812      }
813
814      @Override
815      public Base makeProperty(int hash, String name) throws FHIRException {
816        switch (hash) {
817        case 111972721:  return getValue();
818        case 3059181:  return getCode();
819        default: return super.makeProperty(hash, name);
820        }
821
822      }
823
824      @Override
825      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
826        switch (hash) {
827        case 111972721: /*value*/ return new String[] {"Quantity"};
828        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
829        default: return super.getTypesForProperty(hash, name);
830        }
831
832      }
833
834      @Override
835      public Base addChild(String name) throws FHIRException {
836        if (name.equals("value")) {
837          this.value = new Quantity();
838          return this.value;
839        }
840        else if (name.equals("code")) {
841          this.code = new CodeableConcept();
842          return this.code;
843        }
844        else
845          return super.addChild(name);
846      }
847
848      public CoverageBenefitLimitComponent copy() {
849        CoverageBenefitLimitComponent dst = new CoverageBenefitLimitComponent();
850        copyValues(dst);
851        return dst;
852      }
853
854      public void copyValues(CoverageBenefitLimitComponent dst) {
855        super.copyValues(dst);
856        dst.value = value == null ? null : value.copy();
857        dst.code = code == null ? null : code.copy();
858      }
859
860      @Override
861      public boolean equalsDeep(Base other_) {
862        if (!super.equalsDeep(other_))
863          return false;
864        if (!(other_ instanceof CoverageBenefitLimitComponent))
865          return false;
866        CoverageBenefitLimitComponent o = (CoverageBenefitLimitComponent) other_;
867        return compareDeep(value, o.value, true) && compareDeep(code, o.code, true);
868      }
869
870      @Override
871      public boolean equalsShallow(Base other_) {
872        if (!super.equalsShallow(other_))
873          return false;
874        if (!(other_ instanceof CoverageBenefitLimitComponent))
875          return false;
876        CoverageBenefitLimitComponent o = (CoverageBenefitLimitComponent) other_;
877        return true;
878      }
879
880      public boolean isEmpty() {
881        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, code);
882      }
883
884  public String fhirType() {
885    return "InsurancePlan.coverage.benefit.limit";
886
887  }
888
889  }
890
891    @Block()
892    public static class InsurancePlanPlanComponent extends BackboneElement implements IBaseBackboneElement {
893        /**
894         * Business identifiers assigned to this health insurance plan which remain constant as the resource is updated and propagates from server to server.
895         */
896        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
897        @Description(shortDefinition="Business Identifier for Product", formalDefinition="Business identifiers assigned to this health insurance plan which remain constant as the resource is updated and propagates from server to server." )
898        protected List<Identifier> identifier;
899
900        /**
901         * Type of plan. For example, "Platinum" or "High Deductable".
902         */
903        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
904        @Description(shortDefinition="Type of plan", formalDefinition="Type of plan. For example, \"Platinum\" or \"High Deductable\"." )
905        protected CodeableConcept type;
906
907        /**
908         * The geographic region in which a health insurance plan's benefits apply.
909         */
910        @Child(name = "coverageArea", type = {Location.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
911        @Description(shortDefinition="Where product applies", formalDefinition="The geographic region in which a health insurance plan's benefits apply." )
912        protected List<Reference> coverageArea;
913
914        /**
915         * Reference to the network that providing the type of coverage.
916         */
917        @Child(name = "network", type = {Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
918        @Description(shortDefinition="What networks provide coverage", formalDefinition="Reference to the network that providing the type of coverage." )
919        protected List<Reference> network;
920
921        /**
922         * Overall costs associated with the plan.
923         */
924        @Child(name = "generalCost", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
925        @Description(shortDefinition="Overall costs", formalDefinition="Overall costs associated with the plan." )
926        protected List<InsurancePlanPlanGeneralCostComponent> generalCost;
927
928        /**
929         * Costs associated with the coverage provided by the product.
930         */
931        @Child(name = "specificCost", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
932        @Description(shortDefinition="Specific costs", formalDefinition="Costs associated with the coverage provided by the product." )
933        protected List<InsurancePlanPlanSpecificCostComponent> specificCost;
934
935        private static final long serialVersionUID = -782831938L;
936
937    /**
938     * Constructor
939     */
940      public InsurancePlanPlanComponent() {
941        super();
942      }
943
944        /**
945         * @return {@link #identifier} (Business identifiers assigned to this health insurance plan which remain constant as the resource is updated and propagates from server to server.)
946         */
947        public List<Identifier> getIdentifier() { 
948          if (this.identifier == null)
949            this.identifier = new ArrayList<Identifier>();
950          return this.identifier;
951        }
952
953        /**
954         * @return Returns a reference to <code>this</code> for easy method chaining
955         */
956        public InsurancePlanPlanComponent setIdentifier(List<Identifier> theIdentifier) { 
957          this.identifier = theIdentifier;
958          return this;
959        }
960
961        public boolean hasIdentifier() { 
962          if (this.identifier == null)
963            return false;
964          for (Identifier item : this.identifier)
965            if (!item.isEmpty())
966              return true;
967          return false;
968        }
969
970        public Identifier addIdentifier() { //3
971          Identifier t = new Identifier();
972          if (this.identifier == null)
973            this.identifier = new ArrayList<Identifier>();
974          this.identifier.add(t);
975          return t;
976        }
977
978        public InsurancePlanPlanComponent addIdentifier(Identifier t) { //3
979          if (t == null)
980            return this;
981          if (this.identifier == null)
982            this.identifier = new ArrayList<Identifier>();
983          this.identifier.add(t);
984          return this;
985        }
986
987        /**
988         * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
989         */
990        public Identifier getIdentifierFirstRep() { 
991          if (getIdentifier().isEmpty()) {
992            addIdentifier();
993          }
994          return getIdentifier().get(0);
995        }
996
997        /**
998         * @return {@link #type} (Type of plan. For example, "Platinum" or "High Deductable".)
999         */
1000        public CodeableConcept getType() { 
1001          if (this.type == null)
1002            if (Configuration.errorOnAutoCreate())
1003              throw new Error("Attempt to auto-create InsurancePlanPlanComponent.type");
1004            else if (Configuration.doAutoCreate())
1005              this.type = new CodeableConcept(); // cc
1006          return this.type;
1007        }
1008
1009        public boolean hasType() { 
1010          return this.type != null && !this.type.isEmpty();
1011        }
1012
1013        /**
1014         * @param value {@link #type} (Type of plan. For example, "Platinum" or "High Deductable".)
1015         */
1016        public InsurancePlanPlanComponent setType(CodeableConcept value) { 
1017          this.type = value;
1018          return this;
1019        }
1020
1021        /**
1022         * @return {@link #coverageArea} (The geographic region in which a health insurance plan's benefits apply.)
1023         */
1024        public List<Reference> getCoverageArea() { 
1025          if (this.coverageArea == null)
1026            this.coverageArea = new ArrayList<Reference>();
1027          return this.coverageArea;
1028        }
1029
1030        /**
1031         * @return Returns a reference to <code>this</code> for easy method chaining
1032         */
1033        public InsurancePlanPlanComponent setCoverageArea(List<Reference> theCoverageArea) { 
1034          this.coverageArea = theCoverageArea;
1035          return this;
1036        }
1037
1038        public boolean hasCoverageArea() { 
1039          if (this.coverageArea == null)
1040            return false;
1041          for (Reference item : this.coverageArea)
1042            if (!item.isEmpty())
1043              return true;
1044          return false;
1045        }
1046
1047        public Reference addCoverageArea() { //3
1048          Reference t = new Reference();
1049          if (this.coverageArea == null)
1050            this.coverageArea = new ArrayList<Reference>();
1051          this.coverageArea.add(t);
1052          return t;
1053        }
1054
1055        public InsurancePlanPlanComponent addCoverageArea(Reference t) { //3
1056          if (t == null)
1057            return this;
1058          if (this.coverageArea == null)
1059            this.coverageArea = new ArrayList<Reference>();
1060          this.coverageArea.add(t);
1061          return this;
1062        }
1063
1064        /**
1065         * @return The first repetition of repeating field {@link #coverageArea}, creating it if it does not already exist {3}
1066         */
1067        public Reference getCoverageAreaFirstRep() { 
1068          if (getCoverageArea().isEmpty()) {
1069            addCoverageArea();
1070          }
1071          return getCoverageArea().get(0);
1072        }
1073
1074        /**
1075         * @return {@link #network} (Reference to the network that providing the type of coverage.)
1076         */
1077        public List<Reference> getNetwork() { 
1078          if (this.network == null)
1079            this.network = new ArrayList<Reference>();
1080          return this.network;
1081        }
1082
1083        /**
1084         * @return Returns a reference to <code>this</code> for easy method chaining
1085         */
1086        public InsurancePlanPlanComponent setNetwork(List<Reference> theNetwork) { 
1087          this.network = theNetwork;
1088          return this;
1089        }
1090
1091        public boolean hasNetwork() { 
1092          if (this.network == null)
1093            return false;
1094          for (Reference item : this.network)
1095            if (!item.isEmpty())
1096              return true;
1097          return false;
1098        }
1099
1100        public Reference addNetwork() { //3
1101          Reference t = new Reference();
1102          if (this.network == null)
1103            this.network = new ArrayList<Reference>();
1104          this.network.add(t);
1105          return t;
1106        }
1107
1108        public InsurancePlanPlanComponent addNetwork(Reference t) { //3
1109          if (t == null)
1110            return this;
1111          if (this.network == null)
1112            this.network = new ArrayList<Reference>();
1113          this.network.add(t);
1114          return this;
1115        }
1116
1117        /**
1118         * @return The first repetition of repeating field {@link #network}, creating it if it does not already exist {3}
1119         */
1120        public Reference getNetworkFirstRep() { 
1121          if (getNetwork().isEmpty()) {
1122            addNetwork();
1123          }
1124          return getNetwork().get(0);
1125        }
1126
1127        /**
1128         * @return {@link #generalCost} (Overall costs associated with the plan.)
1129         */
1130        public List<InsurancePlanPlanGeneralCostComponent> getGeneralCost() { 
1131          if (this.generalCost == null)
1132            this.generalCost = new ArrayList<InsurancePlanPlanGeneralCostComponent>();
1133          return this.generalCost;
1134        }
1135
1136        /**
1137         * @return Returns a reference to <code>this</code> for easy method chaining
1138         */
1139        public InsurancePlanPlanComponent setGeneralCost(List<InsurancePlanPlanGeneralCostComponent> theGeneralCost) { 
1140          this.generalCost = theGeneralCost;
1141          return this;
1142        }
1143
1144        public boolean hasGeneralCost() { 
1145          if (this.generalCost == null)
1146            return false;
1147          for (InsurancePlanPlanGeneralCostComponent item : this.generalCost)
1148            if (!item.isEmpty())
1149              return true;
1150          return false;
1151        }
1152
1153        public InsurancePlanPlanGeneralCostComponent addGeneralCost() { //3
1154          InsurancePlanPlanGeneralCostComponent t = new InsurancePlanPlanGeneralCostComponent();
1155          if (this.generalCost == null)
1156            this.generalCost = new ArrayList<InsurancePlanPlanGeneralCostComponent>();
1157          this.generalCost.add(t);
1158          return t;
1159        }
1160
1161        public InsurancePlanPlanComponent addGeneralCost(InsurancePlanPlanGeneralCostComponent t) { //3
1162          if (t == null)
1163            return this;
1164          if (this.generalCost == null)
1165            this.generalCost = new ArrayList<InsurancePlanPlanGeneralCostComponent>();
1166          this.generalCost.add(t);
1167          return this;
1168        }
1169
1170        /**
1171         * @return The first repetition of repeating field {@link #generalCost}, creating it if it does not already exist {3}
1172         */
1173        public InsurancePlanPlanGeneralCostComponent getGeneralCostFirstRep() { 
1174          if (getGeneralCost().isEmpty()) {
1175            addGeneralCost();
1176          }
1177          return getGeneralCost().get(0);
1178        }
1179
1180        /**
1181         * @return {@link #specificCost} (Costs associated with the coverage provided by the product.)
1182         */
1183        public List<InsurancePlanPlanSpecificCostComponent> getSpecificCost() { 
1184          if (this.specificCost == null)
1185            this.specificCost = new ArrayList<InsurancePlanPlanSpecificCostComponent>();
1186          return this.specificCost;
1187        }
1188
1189        /**
1190         * @return Returns a reference to <code>this</code> for easy method chaining
1191         */
1192        public InsurancePlanPlanComponent setSpecificCost(List<InsurancePlanPlanSpecificCostComponent> theSpecificCost) { 
1193          this.specificCost = theSpecificCost;
1194          return this;
1195        }
1196
1197        public boolean hasSpecificCost() { 
1198          if (this.specificCost == null)
1199            return false;
1200          for (InsurancePlanPlanSpecificCostComponent item : this.specificCost)
1201            if (!item.isEmpty())
1202              return true;
1203          return false;
1204        }
1205
1206        public InsurancePlanPlanSpecificCostComponent addSpecificCost() { //3
1207          InsurancePlanPlanSpecificCostComponent t = new InsurancePlanPlanSpecificCostComponent();
1208          if (this.specificCost == null)
1209            this.specificCost = new ArrayList<InsurancePlanPlanSpecificCostComponent>();
1210          this.specificCost.add(t);
1211          return t;
1212        }
1213
1214        public InsurancePlanPlanComponent addSpecificCost(InsurancePlanPlanSpecificCostComponent t) { //3
1215          if (t == null)
1216            return this;
1217          if (this.specificCost == null)
1218            this.specificCost = new ArrayList<InsurancePlanPlanSpecificCostComponent>();
1219          this.specificCost.add(t);
1220          return this;
1221        }
1222
1223        /**
1224         * @return The first repetition of repeating field {@link #specificCost}, creating it if it does not already exist {3}
1225         */
1226        public InsurancePlanPlanSpecificCostComponent getSpecificCostFirstRep() { 
1227          if (getSpecificCost().isEmpty()) {
1228            addSpecificCost();
1229          }
1230          return getSpecificCost().get(0);
1231        }
1232
1233        protected void listChildren(List<Property> children) {
1234          super.listChildren(children);
1235          children.add(new Property("identifier", "Identifier", "Business identifiers assigned to this health insurance plan which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
1236          children.add(new Property("type", "CodeableConcept", "Type of plan. For example, \"Platinum\" or \"High Deductable\".", 0, 1, type));
1237          children.add(new Property("coverageArea", "Reference(Location)", "The geographic region in which a health insurance plan's benefits apply.", 0, java.lang.Integer.MAX_VALUE, coverageArea));
1238          children.add(new Property("network", "Reference(Organization)", "Reference to the network that providing the type of coverage.", 0, java.lang.Integer.MAX_VALUE, network));
1239          children.add(new Property("generalCost", "", "Overall costs associated with the plan.", 0, java.lang.Integer.MAX_VALUE, generalCost));
1240          children.add(new Property("specificCost", "", "Costs associated with the coverage provided by the product.", 0, java.lang.Integer.MAX_VALUE, specificCost));
1241        }
1242
1243        @Override
1244        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1245          switch (_hash) {
1246          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifiers assigned to this health insurance plan which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
1247          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of plan. For example, \"Platinum\" or \"High Deductable\".", 0, 1, type);
1248          case -1532328299: /*coverageArea*/  return new Property("coverageArea", "Reference(Location)", "The geographic region in which a health insurance plan's benefits apply.", 0, java.lang.Integer.MAX_VALUE, coverageArea);
1249          case 1843485230: /*network*/  return new Property("network", "Reference(Organization)", "Reference to the network that providing the type of coverage.", 0, java.lang.Integer.MAX_VALUE, network);
1250          case 878344405: /*generalCost*/  return new Property("generalCost", "", "Overall costs associated with the plan.", 0, java.lang.Integer.MAX_VALUE, generalCost);
1251          case -1205656545: /*specificCost*/  return new Property("specificCost", "", "Costs associated with the coverage provided by the product.", 0, java.lang.Integer.MAX_VALUE, specificCost);
1252          default: return super.getNamedProperty(_hash, _name, _checkValid);
1253          }
1254
1255        }
1256
1257      @Override
1258      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1259        switch (hash) {
1260        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1261        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1262        case -1532328299: /*coverageArea*/ return this.coverageArea == null ? new Base[0] : this.coverageArea.toArray(new Base[this.coverageArea.size()]); // Reference
1263        case 1843485230: /*network*/ return this.network == null ? new Base[0] : this.network.toArray(new Base[this.network.size()]); // Reference
1264        case 878344405: /*generalCost*/ return this.generalCost == null ? new Base[0] : this.generalCost.toArray(new Base[this.generalCost.size()]); // InsurancePlanPlanGeneralCostComponent
1265        case -1205656545: /*specificCost*/ return this.specificCost == null ? new Base[0] : this.specificCost.toArray(new Base[this.specificCost.size()]); // InsurancePlanPlanSpecificCostComponent
1266        default: return super.getProperty(hash, name, checkValid);
1267        }
1268
1269      }
1270
1271      @Override
1272      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1273        switch (hash) {
1274        case -1618432855: // identifier
1275          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1276          return value;
1277        case 3575610: // type
1278          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1279          return value;
1280        case -1532328299: // coverageArea
1281          this.getCoverageArea().add(TypeConvertor.castToReference(value)); // Reference
1282          return value;
1283        case 1843485230: // network
1284          this.getNetwork().add(TypeConvertor.castToReference(value)); // Reference
1285          return value;
1286        case 878344405: // generalCost
1287          this.getGeneralCost().add((InsurancePlanPlanGeneralCostComponent) value); // InsurancePlanPlanGeneralCostComponent
1288          return value;
1289        case -1205656545: // specificCost
1290          this.getSpecificCost().add((InsurancePlanPlanSpecificCostComponent) value); // InsurancePlanPlanSpecificCostComponent
1291          return value;
1292        default: return super.setProperty(hash, name, value);
1293        }
1294
1295      }
1296
1297      @Override
1298      public Base setProperty(String name, Base value) throws FHIRException {
1299        if (name.equals("identifier")) {
1300          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1301        } else if (name.equals("type")) {
1302          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1303        } else if (name.equals("coverageArea")) {
1304          this.getCoverageArea().add(TypeConvertor.castToReference(value));
1305        } else if (name.equals("network")) {
1306          this.getNetwork().add(TypeConvertor.castToReference(value));
1307        } else if (name.equals("generalCost")) {
1308          this.getGeneralCost().add((InsurancePlanPlanGeneralCostComponent) value);
1309        } else if (name.equals("specificCost")) {
1310          this.getSpecificCost().add((InsurancePlanPlanSpecificCostComponent) value);
1311        } else
1312          return super.setProperty(name, value);
1313        return value;
1314      }
1315
1316      @Override
1317      public Base makeProperty(int hash, String name) throws FHIRException {
1318        switch (hash) {
1319        case -1618432855:  return addIdentifier(); 
1320        case 3575610:  return getType();
1321        case -1532328299:  return addCoverageArea(); 
1322        case 1843485230:  return addNetwork(); 
1323        case 878344405:  return addGeneralCost(); 
1324        case -1205656545:  return addSpecificCost(); 
1325        default: return super.makeProperty(hash, name);
1326        }
1327
1328      }
1329
1330      @Override
1331      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1332        switch (hash) {
1333        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1334        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1335        case -1532328299: /*coverageArea*/ return new String[] {"Reference"};
1336        case 1843485230: /*network*/ return new String[] {"Reference"};
1337        case 878344405: /*generalCost*/ return new String[] {};
1338        case -1205656545: /*specificCost*/ return new String[] {};
1339        default: return super.getTypesForProperty(hash, name);
1340        }
1341
1342      }
1343
1344      @Override
1345      public Base addChild(String name) throws FHIRException {
1346        if (name.equals("identifier")) {
1347          return addIdentifier();
1348        }
1349        else if (name.equals("type")) {
1350          this.type = new CodeableConcept();
1351          return this.type;
1352        }
1353        else if (name.equals("coverageArea")) {
1354          return addCoverageArea();
1355        }
1356        else if (name.equals("network")) {
1357          return addNetwork();
1358        }
1359        else if (name.equals("generalCost")) {
1360          return addGeneralCost();
1361        }
1362        else if (name.equals("specificCost")) {
1363          return addSpecificCost();
1364        }
1365        else
1366          return super.addChild(name);
1367      }
1368
1369      public InsurancePlanPlanComponent copy() {
1370        InsurancePlanPlanComponent dst = new InsurancePlanPlanComponent();
1371        copyValues(dst);
1372        return dst;
1373      }
1374
1375      public void copyValues(InsurancePlanPlanComponent dst) {
1376        super.copyValues(dst);
1377        if (identifier != null) {
1378          dst.identifier = new ArrayList<Identifier>();
1379          for (Identifier i : identifier)
1380            dst.identifier.add(i.copy());
1381        };
1382        dst.type = type == null ? null : type.copy();
1383        if (coverageArea != null) {
1384          dst.coverageArea = new ArrayList<Reference>();
1385          for (Reference i : coverageArea)
1386            dst.coverageArea.add(i.copy());
1387        };
1388        if (network != null) {
1389          dst.network = new ArrayList<Reference>();
1390          for (Reference i : network)
1391            dst.network.add(i.copy());
1392        };
1393        if (generalCost != null) {
1394          dst.generalCost = new ArrayList<InsurancePlanPlanGeneralCostComponent>();
1395          for (InsurancePlanPlanGeneralCostComponent i : generalCost)
1396            dst.generalCost.add(i.copy());
1397        };
1398        if (specificCost != null) {
1399          dst.specificCost = new ArrayList<InsurancePlanPlanSpecificCostComponent>();
1400          for (InsurancePlanPlanSpecificCostComponent i : specificCost)
1401            dst.specificCost.add(i.copy());
1402        };
1403      }
1404
1405      @Override
1406      public boolean equalsDeep(Base other_) {
1407        if (!super.equalsDeep(other_))
1408          return false;
1409        if (!(other_ instanceof InsurancePlanPlanComponent))
1410          return false;
1411        InsurancePlanPlanComponent o = (InsurancePlanPlanComponent) other_;
1412        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(coverageArea, o.coverageArea, true)
1413           && compareDeep(network, o.network, true) && compareDeep(generalCost, o.generalCost, true) && compareDeep(specificCost, o.specificCost, true)
1414          ;
1415      }
1416
1417      @Override
1418      public boolean equalsShallow(Base other_) {
1419        if (!super.equalsShallow(other_))
1420          return false;
1421        if (!(other_ instanceof InsurancePlanPlanComponent))
1422          return false;
1423        InsurancePlanPlanComponent o = (InsurancePlanPlanComponent) other_;
1424        return true;
1425      }
1426
1427      public boolean isEmpty() {
1428        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, coverageArea
1429          , network, generalCost, specificCost);
1430      }
1431
1432  public String fhirType() {
1433    return "InsurancePlan.plan";
1434
1435  }
1436
1437  }
1438
1439    @Block()
1440    public static class InsurancePlanPlanGeneralCostComponent extends BackboneElement implements IBaseBackboneElement {
1441        /**
1442         * Type of cost.
1443         */
1444        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1445        @Description(shortDefinition="Type of cost", formalDefinition="Type of cost." )
1446        protected CodeableConcept type;
1447
1448        /**
1449         * Number of participants enrolled in the plan.
1450         */
1451        @Child(name = "groupSize", type = {PositiveIntType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1452        @Description(shortDefinition="Number of enrollees", formalDefinition="Number of participants enrolled in the plan." )
1453        protected PositiveIntType groupSize;
1454
1455        /**
1456         * Value of the cost.
1457         */
1458        @Child(name = "cost", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
1459        @Description(shortDefinition="Cost value", formalDefinition="Value of the cost." )
1460        protected Money cost;
1461
1462        /**
1463         * Additional information about the general costs associated with this plan.
1464         */
1465        @Child(name = "comment", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1466        @Description(shortDefinition="Additional cost information", formalDefinition="Additional information about the general costs associated with this plan." )
1467        protected StringType comment;
1468
1469        private static final long serialVersionUID = 1563949866L;
1470
1471    /**
1472     * Constructor
1473     */
1474      public InsurancePlanPlanGeneralCostComponent() {
1475        super();
1476      }
1477
1478        /**
1479         * @return {@link #type} (Type of cost.)
1480         */
1481        public CodeableConcept getType() { 
1482          if (this.type == null)
1483            if (Configuration.errorOnAutoCreate())
1484              throw new Error("Attempt to auto-create InsurancePlanPlanGeneralCostComponent.type");
1485            else if (Configuration.doAutoCreate())
1486              this.type = new CodeableConcept(); // cc
1487          return this.type;
1488        }
1489
1490        public boolean hasType() { 
1491          return this.type != null && !this.type.isEmpty();
1492        }
1493
1494        /**
1495         * @param value {@link #type} (Type of cost.)
1496         */
1497        public InsurancePlanPlanGeneralCostComponent setType(CodeableConcept value) { 
1498          this.type = value;
1499          return this;
1500        }
1501
1502        /**
1503         * @return {@link #groupSize} (Number of participants enrolled in the plan.). This is the underlying object with id, value and extensions. The accessor "getGroupSize" gives direct access to the value
1504         */
1505        public PositiveIntType getGroupSizeElement() { 
1506          if (this.groupSize == null)
1507            if (Configuration.errorOnAutoCreate())
1508              throw new Error("Attempt to auto-create InsurancePlanPlanGeneralCostComponent.groupSize");
1509            else if (Configuration.doAutoCreate())
1510              this.groupSize = new PositiveIntType(); // bb
1511          return this.groupSize;
1512        }
1513
1514        public boolean hasGroupSizeElement() { 
1515          return this.groupSize != null && !this.groupSize.isEmpty();
1516        }
1517
1518        public boolean hasGroupSize() { 
1519          return this.groupSize != null && !this.groupSize.isEmpty();
1520        }
1521
1522        /**
1523         * @param value {@link #groupSize} (Number of participants enrolled in the plan.). This is the underlying object with id, value and extensions. The accessor "getGroupSize" gives direct access to the value
1524         */
1525        public InsurancePlanPlanGeneralCostComponent setGroupSizeElement(PositiveIntType value) { 
1526          this.groupSize = value;
1527          return this;
1528        }
1529
1530        /**
1531         * @return Number of participants enrolled in the plan.
1532         */
1533        public int getGroupSize() { 
1534          return this.groupSize == null || this.groupSize.isEmpty() ? 0 : this.groupSize.getValue();
1535        }
1536
1537        /**
1538         * @param value Number of participants enrolled in the plan.
1539         */
1540        public InsurancePlanPlanGeneralCostComponent setGroupSize(int value) { 
1541            if (this.groupSize == null)
1542              this.groupSize = new PositiveIntType();
1543            this.groupSize.setValue(value);
1544          return this;
1545        }
1546
1547        /**
1548         * @return {@link #cost} (Value of the cost.)
1549         */
1550        public Money getCost() { 
1551          if (this.cost == null)
1552            if (Configuration.errorOnAutoCreate())
1553              throw new Error("Attempt to auto-create InsurancePlanPlanGeneralCostComponent.cost");
1554            else if (Configuration.doAutoCreate())
1555              this.cost = new Money(); // cc
1556          return this.cost;
1557        }
1558
1559        public boolean hasCost() { 
1560          return this.cost != null && !this.cost.isEmpty();
1561        }
1562
1563        /**
1564         * @param value {@link #cost} (Value of the cost.)
1565         */
1566        public InsurancePlanPlanGeneralCostComponent setCost(Money value) { 
1567          this.cost = value;
1568          return this;
1569        }
1570
1571        /**
1572         * @return {@link #comment} (Additional information about the general costs associated with this plan.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
1573         */
1574        public StringType getCommentElement() { 
1575          if (this.comment == null)
1576            if (Configuration.errorOnAutoCreate())
1577              throw new Error("Attempt to auto-create InsurancePlanPlanGeneralCostComponent.comment");
1578            else if (Configuration.doAutoCreate())
1579              this.comment = new StringType(); // bb
1580          return this.comment;
1581        }
1582
1583        public boolean hasCommentElement() { 
1584          return this.comment != null && !this.comment.isEmpty();
1585        }
1586
1587        public boolean hasComment() { 
1588          return this.comment != null && !this.comment.isEmpty();
1589        }
1590
1591        /**
1592         * @param value {@link #comment} (Additional information about the general costs associated with this plan.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
1593         */
1594        public InsurancePlanPlanGeneralCostComponent setCommentElement(StringType value) { 
1595          this.comment = value;
1596          return this;
1597        }
1598
1599        /**
1600         * @return Additional information about the general costs associated with this plan.
1601         */
1602        public String getComment() { 
1603          return this.comment == null ? null : this.comment.getValue();
1604        }
1605
1606        /**
1607         * @param value Additional information about the general costs associated with this plan.
1608         */
1609        public InsurancePlanPlanGeneralCostComponent setComment(String value) { 
1610          if (Utilities.noString(value))
1611            this.comment = null;
1612          else {
1613            if (this.comment == null)
1614              this.comment = new StringType();
1615            this.comment.setValue(value);
1616          }
1617          return this;
1618        }
1619
1620        protected void listChildren(List<Property> children) {
1621          super.listChildren(children);
1622          children.add(new Property("type", "CodeableConcept", "Type of cost.", 0, 1, type));
1623          children.add(new Property("groupSize", "positiveInt", "Number of participants enrolled in the plan.", 0, 1, groupSize));
1624          children.add(new Property("cost", "Money", "Value of the cost.", 0, 1, cost));
1625          children.add(new Property("comment", "string", "Additional information about the general costs associated with this plan.", 0, 1, comment));
1626        }
1627
1628        @Override
1629        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1630          switch (_hash) {
1631          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of cost.", 0, 1, type);
1632          case -1483017440: /*groupSize*/  return new Property("groupSize", "positiveInt", "Number of participants enrolled in the plan.", 0, 1, groupSize);
1633          case 3059661: /*cost*/  return new Property("cost", "Money", "Value of the cost.", 0, 1, cost);
1634          case 950398559: /*comment*/  return new Property("comment", "string", "Additional information about the general costs associated with this plan.", 0, 1, comment);
1635          default: return super.getNamedProperty(_hash, _name, _checkValid);
1636          }
1637
1638        }
1639
1640      @Override
1641      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1642        switch (hash) {
1643        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1644        case -1483017440: /*groupSize*/ return this.groupSize == null ? new Base[0] : new Base[] {this.groupSize}; // PositiveIntType
1645        case 3059661: /*cost*/ return this.cost == null ? new Base[0] : new Base[] {this.cost}; // Money
1646        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
1647        default: return super.getProperty(hash, name, checkValid);
1648        }
1649
1650      }
1651
1652      @Override
1653      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1654        switch (hash) {
1655        case 3575610: // type
1656          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1657          return value;
1658        case -1483017440: // groupSize
1659          this.groupSize = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1660          return value;
1661        case 3059661: // cost
1662          this.cost = TypeConvertor.castToMoney(value); // Money
1663          return value;
1664        case 950398559: // comment
1665          this.comment = TypeConvertor.castToString(value); // StringType
1666          return value;
1667        default: return super.setProperty(hash, name, value);
1668        }
1669
1670      }
1671
1672      @Override
1673      public Base setProperty(String name, Base value) throws FHIRException {
1674        if (name.equals("type")) {
1675          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1676        } else if (name.equals("groupSize")) {
1677          this.groupSize = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1678        } else if (name.equals("cost")) {
1679          this.cost = TypeConvertor.castToMoney(value); // Money
1680        } else if (name.equals("comment")) {
1681          this.comment = TypeConvertor.castToString(value); // StringType
1682        } else
1683          return super.setProperty(name, value);
1684        return value;
1685      }
1686
1687      @Override
1688      public Base makeProperty(int hash, String name) throws FHIRException {
1689        switch (hash) {
1690        case 3575610:  return getType();
1691        case -1483017440:  return getGroupSizeElement();
1692        case 3059661:  return getCost();
1693        case 950398559:  return getCommentElement();
1694        default: return super.makeProperty(hash, name);
1695        }
1696
1697      }
1698
1699      @Override
1700      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1701        switch (hash) {
1702        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1703        case -1483017440: /*groupSize*/ return new String[] {"positiveInt"};
1704        case 3059661: /*cost*/ return new String[] {"Money"};
1705        case 950398559: /*comment*/ return new String[] {"string"};
1706        default: return super.getTypesForProperty(hash, name);
1707        }
1708
1709      }
1710
1711      @Override
1712      public Base addChild(String name) throws FHIRException {
1713        if (name.equals("type")) {
1714          this.type = new CodeableConcept();
1715          return this.type;
1716        }
1717        else if (name.equals("groupSize")) {
1718          throw new FHIRException("Cannot call addChild on a primitive type InsurancePlan.plan.generalCost.groupSize");
1719        }
1720        else if (name.equals("cost")) {
1721          this.cost = new Money();
1722          return this.cost;
1723        }
1724        else if (name.equals("comment")) {
1725          throw new FHIRException("Cannot call addChild on a primitive type InsurancePlan.plan.generalCost.comment");
1726        }
1727        else
1728          return super.addChild(name);
1729      }
1730
1731      public InsurancePlanPlanGeneralCostComponent copy() {
1732        InsurancePlanPlanGeneralCostComponent dst = new InsurancePlanPlanGeneralCostComponent();
1733        copyValues(dst);
1734        return dst;
1735      }
1736
1737      public void copyValues(InsurancePlanPlanGeneralCostComponent dst) {
1738        super.copyValues(dst);
1739        dst.type = type == null ? null : type.copy();
1740        dst.groupSize = groupSize == null ? null : groupSize.copy();
1741        dst.cost = cost == null ? null : cost.copy();
1742        dst.comment = comment == null ? null : comment.copy();
1743      }
1744
1745      @Override
1746      public boolean equalsDeep(Base other_) {
1747        if (!super.equalsDeep(other_))
1748          return false;
1749        if (!(other_ instanceof InsurancePlanPlanGeneralCostComponent))
1750          return false;
1751        InsurancePlanPlanGeneralCostComponent o = (InsurancePlanPlanGeneralCostComponent) other_;
1752        return compareDeep(type, o.type, true) && compareDeep(groupSize, o.groupSize, true) && compareDeep(cost, o.cost, true)
1753           && compareDeep(comment, o.comment, true);
1754      }
1755
1756      @Override
1757      public boolean equalsShallow(Base other_) {
1758        if (!super.equalsShallow(other_))
1759          return false;
1760        if (!(other_ instanceof InsurancePlanPlanGeneralCostComponent))
1761          return false;
1762        InsurancePlanPlanGeneralCostComponent o = (InsurancePlanPlanGeneralCostComponent) other_;
1763        return compareValues(groupSize, o.groupSize, true) && compareValues(comment, o.comment, true);
1764      }
1765
1766      public boolean isEmpty() {
1767        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, groupSize, cost, comment
1768          );
1769      }
1770
1771  public String fhirType() {
1772    return "InsurancePlan.plan.generalCost";
1773
1774  }
1775
1776  }
1777
1778    @Block()
1779    public static class InsurancePlanPlanSpecificCostComponent extends BackboneElement implements IBaseBackboneElement {
1780        /**
1781         * General category of benefit (Medical; Dental; Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health).
1782         */
1783        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1784        @Description(shortDefinition="General category of benefit", formalDefinition="General category of benefit (Medical; Dental; Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health)." )
1785        protected CodeableConcept category;
1786
1787        /**
1788         * List of the specific benefits under this category of benefit.
1789         */
1790        @Child(name = "benefit", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1791        @Description(shortDefinition="Benefits list", formalDefinition="List of the specific benefits under this category of benefit." )
1792        protected List<PlanBenefitComponent> benefit;
1793
1794        private static final long serialVersionUID = 922585525L;
1795
1796    /**
1797     * Constructor
1798     */
1799      public InsurancePlanPlanSpecificCostComponent() {
1800        super();
1801      }
1802
1803    /**
1804     * Constructor
1805     */
1806      public InsurancePlanPlanSpecificCostComponent(CodeableConcept category) {
1807        super();
1808        this.setCategory(category);
1809      }
1810
1811        /**
1812         * @return {@link #category} (General category of benefit (Medical; Dental; Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health).)
1813         */
1814        public CodeableConcept getCategory() { 
1815          if (this.category == null)
1816            if (Configuration.errorOnAutoCreate())
1817              throw new Error("Attempt to auto-create InsurancePlanPlanSpecificCostComponent.category");
1818            else if (Configuration.doAutoCreate())
1819              this.category = new CodeableConcept(); // cc
1820          return this.category;
1821        }
1822
1823        public boolean hasCategory() { 
1824          return this.category != null && !this.category.isEmpty();
1825        }
1826
1827        /**
1828         * @param value {@link #category} (General category of benefit (Medical; Dental; Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health).)
1829         */
1830        public InsurancePlanPlanSpecificCostComponent setCategory(CodeableConcept value) { 
1831          this.category = value;
1832          return this;
1833        }
1834
1835        /**
1836         * @return {@link #benefit} (List of the specific benefits under this category of benefit.)
1837         */
1838        public List<PlanBenefitComponent> getBenefit() { 
1839          if (this.benefit == null)
1840            this.benefit = new ArrayList<PlanBenefitComponent>();
1841          return this.benefit;
1842        }
1843
1844        /**
1845         * @return Returns a reference to <code>this</code> for easy method chaining
1846         */
1847        public InsurancePlanPlanSpecificCostComponent setBenefit(List<PlanBenefitComponent> theBenefit) { 
1848          this.benefit = theBenefit;
1849          return this;
1850        }
1851
1852        public boolean hasBenefit() { 
1853          if (this.benefit == null)
1854            return false;
1855          for (PlanBenefitComponent item : this.benefit)
1856            if (!item.isEmpty())
1857              return true;
1858          return false;
1859        }
1860
1861        public PlanBenefitComponent addBenefit() { //3
1862          PlanBenefitComponent t = new PlanBenefitComponent();
1863          if (this.benefit == null)
1864            this.benefit = new ArrayList<PlanBenefitComponent>();
1865          this.benefit.add(t);
1866          return t;
1867        }
1868
1869        public InsurancePlanPlanSpecificCostComponent addBenefit(PlanBenefitComponent t) { //3
1870          if (t == null)
1871            return this;
1872          if (this.benefit == null)
1873            this.benefit = new ArrayList<PlanBenefitComponent>();
1874          this.benefit.add(t);
1875          return this;
1876        }
1877
1878        /**
1879         * @return The first repetition of repeating field {@link #benefit}, creating it if it does not already exist {3}
1880         */
1881        public PlanBenefitComponent getBenefitFirstRep() { 
1882          if (getBenefit().isEmpty()) {
1883            addBenefit();
1884          }
1885          return getBenefit().get(0);
1886        }
1887
1888        protected void listChildren(List<Property> children) {
1889          super.listChildren(children);
1890          children.add(new Property("category", "CodeableConcept", "General category of benefit (Medical; Dental; Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health).", 0, 1, category));
1891          children.add(new Property("benefit", "", "List of the specific benefits under this category of benefit.", 0, java.lang.Integer.MAX_VALUE, benefit));
1892        }
1893
1894        @Override
1895        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1896          switch (_hash) {
1897          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "General category of benefit (Medical; Dental; Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health).", 0, 1, category);
1898          case -222710633: /*benefit*/  return new Property("benefit", "", "List of the specific benefits under this category of benefit.", 0, java.lang.Integer.MAX_VALUE, benefit);
1899          default: return super.getNamedProperty(_hash, _name, _checkValid);
1900          }
1901
1902        }
1903
1904      @Override
1905      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1906        switch (hash) {
1907        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1908        case -222710633: /*benefit*/ return this.benefit == null ? new Base[0] : this.benefit.toArray(new Base[this.benefit.size()]); // PlanBenefitComponent
1909        default: return super.getProperty(hash, name, checkValid);
1910        }
1911
1912      }
1913
1914      @Override
1915      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1916        switch (hash) {
1917        case 50511102: // category
1918          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1919          return value;
1920        case -222710633: // benefit
1921          this.getBenefit().add((PlanBenefitComponent) value); // PlanBenefitComponent
1922          return value;
1923        default: return super.setProperty(hash, name, value);
1924        }
1925
1926      }
1927
1928      @Override
1929      public Base setProperty(String name, Base value) throws FHIRException {
1930        if (name.equals("category")) {
1931          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1932        } else if (name.equals("benefit")) {
1933          this.getBenefit().add((PlanBenefitComponent) value);
1934        } else
1935          return super.setProperty(name, value);
1936        return value;
1937      }
1938
1939      @Override
1940      public Base makeProperty(int hash, String name) throws FHIRException {
1941        switch (hash) {
1942        case 50511102:  return getCategory();
1943        case -222710633:  return addBenefit(); 
1944        default: return super.makeProperty(hash, name);
1945        }
1946
1947      }
1948
1949      @Override
1950      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1951        switch (hash) {
1952        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1953        case -222710633: /*benefit*/ return new String[] {};
1954        default: return super.getTypesForProperty(hash, name);
1955        }
1956
1957      }
1958
1959      @Override
1960      public Base addChild(String name) throws FHIRException {
1961        if (name.equals("category")) {
1962          this.category = new CodeableConcept();
1963          return this.category;
1964        }
1965        else if (name.equals("benefit")) {
1966          return addBenefit();
1967        }
1968        else
1969          return super.addChild(name);
1970      }
1971
1972      public InsurancePlanPlanSpecificCostComponent copy() {
1973        InsurancePlanPlanSpecificCostComponent dst = new InsurancePlanPlanSpecificCostComponent();
1974        copyValues(dst);
1975        return dst;
1976      }
1977
1978      public void copyValues(InsurancePlanPlanSpecificCostComponent dst) {
1979        super.copyValues(dst);
1980        dst.category = category == null ? null : category.copy();
1981        if (benefit != null) {
1982          dst.benefit = new ArrayList<PlanBenefitComponent>();
1983          for (PlanBenefitComponent i : benefit)
1984            dst.benefit.add(i.copy());
1985        };
1986      }
1987
1988      @Override
1989      public boolean equalsDeep(Base other_) {
1990        if (!super.equalsDeep(other_))
1991          return false;
1992        if (!(other_ instanceof InsurancePlanPlanSpecificCostComponent))
1993          return false;
1994        InsurancePlanPlanSpecificCostComponent o = (InsurancePlanPlanSpecificCostComponent) other_;
1995        return compareDeep(category, o.category, true) && compareDeep(benefit, o.benefit, true);
1996      }
1997
1998      @Override
1999      public boolean equalsShallow(Base other_) {
2000        if (!super.equalsShallow(other_))
2001          return false;
2002        if (!(other_ instanceof InsurancePlanPlanSpecificCostComponent))
2003          return false;
2004        InsurancePlanPlanSpecificCostComponent o = (InsurancePlanPlanSpecificCostComponent) other_;
2005        return true;
2006      }
2007
2008      public boolean isEmpty() {
2009        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, benefit);
2010      }
2011
2012  public String fhirType() {
2013    return "InsurancePlan.plan.specificCost";
2014
2015  }
2016
2017  }
2018
2019    @Block()
2020    public static class PlanBenefitComponent extends BackboneElement implements IBaseBackboneElement {
2021        /**
2022         * Type of specific benefit (preventative; primary care office visit; speciality office visit; hospitalization; emergency room; urgent care).
2023         */
2024        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
2025        @Description(shortDefinition="Type of specific benefit", formalDefinition="Type of specific benefit (preventative; primary care office visit; speciality office visit; hospitalization; emergency room; urgent care)." )
2026        protected CodeableConcept type;
2027
2028        /**
2029         * List of the costs associated with a specific benefit.
2030         */
2031        @Child(name = "cost", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2032        @Description(shortDefinition="List of the costs", formalDefinition="List of the costs associated with a specific benefit." )
2033        protected List<PlanBenefitCostComponent> cost;
2034
2035        private static final long serialVersionUID = 792296200L;
2036
2037    /**
2038     * Constructor
2039     */
2040      public PlanBenefitComponent() {
2041        super();
2042      }
2043
2044    /**
2045     * Constructor
2046     */
2047      public PlanBenefitComponent(CodeableConcept type) {
2048        super();
2049        this.setType(type);
2050      }
2051
2052        /**
2053         * @return {@link #type} (Type of specific benefit (preventative; primary care office visit; speciality office visit; hospitalization; emergency room; urgent care).)
2054         */
2055        public CodeableConcept getType() { 
2056          if (this.type == null)
2057            if (Configuration.errorOnAutoCreate())
2058              throw new Error("Attempt to auto-create PlanBenefitComponent.type");
2059            else if (Configuration.doAutoCreate())
2060              this.type = new CodeableConcept(); // cc
2061          return this.type;
2062        }
2063
2064        public boolean hasType() { 
2065          return this.type != null && !this.type.isEmpty();
2066        }
2067
2068        /**
2069         * @param value {@link #type} (Type of specific benefit (preventative; primary care office visit; speciality office visit; hospitalization; emergency room; urgent care).)
2070         */
2071        public PlanBenefitComponent setType(CodeableConcept value) { 
2072          this.type = value;
2073          return this;
2074        }
2075
2076        /**
2077         * @return {@link #cost} (List of the costs associated with a specific benefit.)
2078         */
2079        public List<PlanBenefitCostComponent> getCost() { 
2080          if (this.cost == null)
2081            this.cost = new ArrayList<PlanBenefitCostComponent>();
2082          return this.cost;
2083        }
2084
2085        /**
2086         * @return Returns a reference to <code>this</code> for easy method chaining
2087         */
2088        public PlanBenefitComponent setCost(List<PlanBenefitCostComponent> theCost) { 
2089          this.cost = theCost;
2090          return this;
2091        }
2092
2093        public boolean hasCost() { 
2094          if (this.cost == null)
2095            return false;
2096          for (PlanBenefitCostComponent item : this.cost)
2097            if (!item.isEmpty())
2098              return true;
2099          return false;
2100        }
2101
2102        public PlanBenefitCostComponent addCost() { //3
2103          PlanBenefitCostComponent t = new PlanBenefitCostComponent();
2104          if (this.cost == null)
2105            this.cost = new ArrayList<PlanBenefitCostComponent>();
2106          this.cost.add(t);
2107          return t;
2108        }
2109
2110        public PlanBenefitComponent addCost(PlanBenefitCostComponent t) { //3
2111          if (t == null)
2112            return this;
2113          if (this.cost == null)
2114            this.cost = new ArrayList<PlanBenefitCostComponent>();
2115          this.cost.add(t);
2116          return this;
2117        }
2118
2119        /**
2120         * @return The first repetition of repeating field {@link #cost}, creating it if it does not already exist {3}
2121         */
2122        public PlanBenefitCostComponent getCostFirstRep() { 
2123          if (getCost().isEmpty()) {
2124            addCost();
2125          }
2126          return getCost().get(0);
2127        }
2128
2129        protected void listChildren(List<Property> children) {
2130          super.listChildren(children);
2131          children.add(new Property("type", "CodeableConcept", "Type of specific benefit (preventative; primary care office visit; speciality office visit; hospitalization; emergency room; urgent care).", 0, 1, type));
2132          children.add(new Property("cost", "", "List of the costs associated with a specific benefit.", 0, java.lang.Integer.MAX_VALUE, cost));
2133        }
2134
2135        @Override
2136        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2137          switch (_hash) {
2138          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of specific benefit (preventative; primary care office visit; speciality office visit; hospitalization; emergency room; urgent care).", 0, 1, type);
2139          case 3059661: /*cost*/  return new Property("cost", "", "List of the costs associated with a specific benefit.", 0, java.lang.Integer.MAX_VALUE, cost);
2140          default: return super.getNamedProperty(_hash, _name, _checkValid);
2141          }
2142
2143        }
2144
2145      @Override
2146      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2147        switch (hash) {
2148        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2149        case 3059661: /*cost*/ return this.cost == null ? new Base[0] : this.cost.toArray(new Base[this.cost.size()]); // PlanBenefitCostComponent
2150        default: return super.getProperty(hash, name, checkValid);
2151        }
2152
2153      }
2154
2155      @Override
2156      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2157        switch (hash) {
2158        case 3575610: // type
2159          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2160          return value;
2161        case 3059661: // cost
2162          this.getCost().add((PlanBenefitCostComponent) value); // PlanBenefitCostComponent
2163          return value;
2164        default: return super.setProperty(hash, name, value);
2165        }
2166
2167      }
2168
2169      @Override
2170      public Base setProperty(String name, Base value) throws FHIRException {
2171        if (name.equals("type")) {
2172          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2173        } else if (name.equals("cost")) {
2174          this.getCost().add((PlanBenefitCostComponent) value);
2175        } else
2176          return super.setProperty(name, value);
2177        return value;
2178      }
2179
2180      @Override
2181      public Base makeProperty(int hash, String name) throws FHIRException {
2182        switch (hash) {
2183        case 3575610:  return getType();
2184        case 3059661:  return addCost(); 
2185        default: return super.makeProperty(hash, name);
2186        }
2187
2188      }
2189
2190      @Override
2191      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2192        switch (hash) {
2193        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2194        case 3059661: /*cost*/ return new String[] {};
2195        default: return super.getTypesForProperty(hash, name);
2196        }
2197
2198      }
2199
2200      @Override
2201      public Base addChild(String name) throws FHIRException {
2202        if (name.equals("type")) {
2203          this.type = new CodeableConcept();
2204          return this.type;
2205        }
2206        else if (name.equals("cost")) {
2207          return addCost();
2208        }
2209        else
2210          return super.addChild(name);
2211      }
2212
2213      public PlanBenefitComponent copy() {
2214        PlanBenefitComponent dst = new PlanBenefitComponent();
2215        copyValues(dst);
2216        return dst;
2217      }
2218
2219      public void copyValues(PlanBenefitComponent dst) {
2220        super.copyValues(dst);
2221        dst.type = type == null ? null : type.copy();
2222        if (cost != null) {
2223          dst.cost = new ArrayList<PlanBenefitCostComponent>();
2224          for (PlanBenefitCostComponent i : cost)
2225            dst.cost.add(i.copy());
2226        };
2227      }
2228
2229      @Override
2230      public boolean equalsDeep(Base other_) {
2231        if (!super.equalsDeep(other_))
2232          return false;
2233        if (!(other_ instanceof PlanBenefitComponent))
2234          return false;
2235        PlanBenefitComponent o = (PlanBenefitComponent) other_;
2236        return compareDeep(type, o.type, true) && compareDeep(cost, o.cost, true);
2237      }
2238
2239      @Override
2240      public boolean equalsShallow(Base other_) {
2241        if (!super.equalsShallow(other_))
2242          return false;
2243        if (!(other_ instanceof PlanBenefitComponent))
2244          return false;
2245        PlanBenefitComponent o = (PlanBenefitComponent) other_;
2246        return true;
2247      }
2248
2249      public boolean isEmpty() {
2250        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, cost);
2251      }
2252
2253  public String fhirType() {
2254    return "InsurancePlan.plan.specificCost.benefit";
2255
2256  }
2257
2258  }
2259
2260    @Block()
2261    public static class PlanBenefitCostComponent extends BackboneElement implements IBaseBackboneElement {
2262        /**
2263         * Type of cost (copay; individual cap; family cap; coinsurance; deductible).
2264         */
2265        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
2266        @Description(shortDefinition="Type of cost", formalDefinition="Type of cost (copay; individual cap; family cap; coinsurance; deductible)." )
2267        protected CodeableConcept type;
2268
2269        /**
2270         * Whether the cost applies to in-network or out-of-network providers (in-network; out-of-network; other).
2271         */
2272        @Child(name = "applicability", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2273        @Description(shortDefinition="in-network | out-of-network | other", formalDefinition="Whether the cost applies to in-network or out-of-network providers (in-network; out-of-network; other)." )
2274        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/insuranceplan-applicability")
2275        protected CodeableConcept applicability;
2276
2277        /**
2278         * Additional information about the cost, such as information about funding sources (e.g. HSA, HRA, FSA, RRA).
2279         */
2280        @Child(name = "qualifiers", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2281        @Description(shortDefinition="Additional information about the cost", formalDefinition="Additional information about the cost, such as information about funding sources (e.g. HSA, HRA, FSA, RRA)." )
2282        protected List<CodeableConcept> qualifiers;
2283
2284        /**
2285         * The actual cost value. (some of the costs may be represented as percentages rather than currency, e.g. 10% coinsurance).
2286         */
2287        @Child(name = "value", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
2288        @Description(shortDefinition="The actual cost value", formalDefinition="The actual cost value. (some of the costs may be represented as percentages rather than currency, e.g. 10% coinsurance)." )
2289        protected Quantity value;
2290
2291        private static final long serialVersionUID = -340688733L;
2292
2293    /**
2294     * Constructor
2295     */
2296      public PlanBenefitCostComponent() {
2297        super();
2298      }
2299
2300    /**
2301     * Constructor
2302     */
2303      public PlanBenefitCostComponent(CodeableConcept type) {
2304        super();
2305        this.setType(type);
2306      }
2307
2308        /**
2309         * @return {@link #type} (Type of cost (copay; individual cap; family cap; coinsurance; deductible).)
2310         */
2311        public CodeableConcept getType() { 
2312          if (this.type == null)
2313            if (Configuration.errorOnAutoCreate())
2314              throw new Error("Attempt to auto-create PlanBenefitCostComponent.type");
2315            else if (Configuration.doAutoCreate())
2316              this.type = new CodeableConcept(); // cc
2317          return this.type;
2318        }
2319
2320        public boolean hasType() { 
2321          return this.type != null && !this.type.isEmpty();
2322        }
2323
2324        /**
2325         * @param value {@link #type} (Type of cost (copay; individual cap; family cap; coinsurance; deductible).)
2326         */
2327        public PlanBenefitCostComponent setType(CodeableConcept value) { 
2328          this.type = value;
2329          return this;
2330        }
2331
2332        /**
2333         * @return {@link #applicability} (Whether the cost applies to in-network or out-of-network providers (in-network; out-of-network; other).)
2334         */
2335        public CodeableConcept getApplicability() { 
2336          if (this.applicability == null)
2337            if (Configuration.errorOnAutoCreate())
2338              throw new Error("Attempt to auto-create PlanBenefitCostComponent.applicability");
2339            else if (Configuration.doAutoCreate())
2340              this.applicability = new CodeableConcept(); // cc
2341          return this.applicability;
2342        }
2343
2344        public boolean hasApplicability() { 
2345          return this.applicability != null && !this.applicability.isEmpty();
2346        }
2347
2348        /**
2349         * @param value {@link #applicability} (Whether the cost applies to in-network or out-of-network providers (in-network; out-of-network; other).)
2350         */
2351        public PlanBenefitCostComponent setApplicability(CodeableConcept value) { 
2352          this.applicability = value;
2353          return this;
2354        }
2355
2356        /**
2357         * @return {@link #qualifiers} (Additional information about the cost, such as information about funding sources (e.g. HSA, HRA, FSA, RRA).)
2358         */
2359        public List<CodeableConcept> getQualifiers() { 
2360          if (this.qualifiers == null)
2361            this.qualifiers = new ArrayList<CodeableConcept>();
2362          return this.qualifiers;
2363        }
2364
2365        /**
2366         * @return Returns a reference to <code>this</code> for easy method chaining
2367         */
2368        public PlanBenefitCostComponent setQualifiers(List<CodeableConcept> theQualifiers) { 
2369          this.qualifiers = theQualifiers;
2370          return this;
2371        }
2372
2373        public boolean hasQualifiers() { 
2374          if (this.qualifiers == null)
2375            return false;
2376          for (CodeableConcept item : this.qualifiers)
2377            if (!item.isEmpty())
2378              return true;
2379          return false;
2380        }
2381
2382        public CodeableConcept addQualifiers() { //3
2383          CodeableConcept t = new CodeableConcept();
2384          if (this.qualifiers == null)
2385            this.qualifiers = new ArrayList<CodeableConcept>();
2386          this.qualifiers.add(t);
2387          return t;
2388        }
2389
2390        public PlanBenefitCostComponent addQualifiers(CodeableConcept t) { //3
2391          if (t == null)
2392            return this;
2393          if (this.qualifiers == null)
2394            this.qualifiers = new ArrayList<CodeableConcept>();
2395          this.qualifiers.add(t);
2396          return this;
2397        }
2398
2399        /**
2400         * @return The first repetition of repeating field {@link #qualifiers}, creating it if it does not already exist {3}
2401         */
2402        public CodeableConcept getQualifiersFirstRep() { 
2403          if (getQualifiers().isEmpty()) {
2404            addQualifiers();
2405          }
2406          return getQualifiers().get(0);
2407        }
2408
2409        /**
2410         * @return {@link #value} (The actual cost value. (some of the costs may be represented as percentages rather than currency, e.g. 10% coinsurance).)
2411         */
2412        public Quantity getValue() { 
2413          if (this.value == null)
2414            if (Configuration.errorOnAutoCreate())
2415              throw new Error("Attempt to auto-create PlanBenefitCostComponent.value");
2416            else if (Configuration.doAutoCreate())
2417              this.value = new Quantity(); // cc
2418          return this.value;
2419        }
2420
2421        public boolean hasValue() { 
2422          return this.value != null && !this.value.isEmpty();
2423        }
2424
2425        /**
2426         * @param value {@link #value} (The actual cost value. (some of the costs may be represented as percentages rather than currency, e.g. 10% coinsurance).)
2427         */
2428        public PlanBenefitCostComponent setValue(Quantity value) { 
2429          this.value = value;
2430          return this;
2431        }
2432
2433        protected void listChildren(List<Property> children) {
2434          super.listChildren(children);
2435          children.add(new Property("type", "CodeableConcept", "Type of cost (copay; individual cap; family cap; coinsurance; deductible).", 0, 1, type));
2436          children.add(new Property("applicability", "CodeableConcept", "Whether the cost applies to in-network or out-of-network providers (in-network; out-of-network; other).", 0, 1, applicability));
2437          children.add(new Property("qualifiers", "CodeableConcept", "Additional information about the cost, such as information about funding sources (e.g. HSA, HRA, FSA, RRA).", 0, java.lang.Integer.MAX_VALUE, qualifiers));
2438          children.add(new Property("value", "Quantity", "The actual cost value. (some of the costs may be represented as percentages rather than currency, e.g. 10% coinsurance).", 0, 1, value));
2439        }
2440
2441        @Override
2442        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2443          switch (_hash) {
2444          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of cost (copay; individual cap; family cap; coinsurance; deductible).", 0, 1, type);
2445          case -1526770491: /*applicability*/  return new Property("applicability", "CodeableConcept", "Whether the cost applies to in-network or out-of-network providers (in-network; out-of-network; other).", 0, 1, applicability);
2446          case -31447799: /*qualifiers*/  return new Property("qualifiers", "CodeableConcept", "Additional information about the cost, such as information about funding sources (e.g. HSA, HRA, FSA, RRA).", 0, java.lang.Integer.MAX_VALUE, qualifiers);
2447          case 111972721: /*value*/  return new Property("value", "Quantity", "The actual cost value. (some of the costs may be represented as percentages rather than currency, e.g. 10% coinsurance).", 0, 1, value);
2448          default: return super.getNamedProperty(_hash, _name, _checkValid);
2449          }
2450
2451        }
2452
2453      @Override
2454      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2455        switch (hash) {
2456        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2457        case -1526770491: /*applicability*/ return this.applicability == null ? new Base[0] : new Base[] {this.applicability}; // CodeableConcept
2458        case -31447799: /*qualifiers*/ return this.qualifiers == null ? new Base[0] : this.qualifiers.toArray(new Base[this.qualifiers.size()]); // CodeableConcept
2459        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Quantity
2460        default: return super.getProperty(hash, name, checkValid);
2461        }
2462
2463      }
2464
2465      @Override
2466      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2467        switch (hash) {
2468        case 3575610: // type
2469          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2470          return value;
2471        case -1526770491: // applicability
2472          this.applicability = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2473          return value;
2474        case -31447799: // qualifiers
2475          this.getQualifiers().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2476          return value;
2477        case 111972721: // value
2478          this.value = TypeConvertor.castToQuantity(value); // Quantity
2479          return value;
2480        default: return super.setProperty(hash, name, value);
2481        }
2482
2483      }
2484
2485      @Override
2486      public Base setProperty(String name, Base value) throws FHIRException {
2487        if (name.equals("type")) {
2488          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2489        } else if (name.equals("applicability")) {
2490          this.applicability = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2491        } else if (name.equals("qualifiers")) {
2492          this.getQualifiers().add(TypeConvertor.castToCodeableConcept(value));
2493        } else if (name.equals("value")) {
2494          this.value = TypeConvertor.castToQuantity(value); // Quantity
2495        } else
2496          return super.setProperty(name, value);
2497        return value;
2498      }
2499
2500      @Override
2501      public Base makeProperty(int hash, String name) throws FHIRException {
2502        switch (hash) {
2503        case 3575610:  return getType();
2504        case -1526770491:  return getApplicability();
2505        case -31447799:  return addQualifiers(); 
2506        case 111972721:  return getValue();
2507        default: return super.makeProperty(hash, name);
2508        }
2509
2510      }
2511
2512      @Override
2513      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2514        switch (hash) {
2515        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2516        case -1526770491: /*applicability*/ return new String[] {"CodeableConcept"};
2517        case -31447799: /*qualifiers*/ return new String[] {"CodeableConcept"};
2518        case 111972721: /*value*/ return new String[] {"Quantity"};
2519        default: return super.getTypesForProperty(hash, name);
2520        }
2521
2522      }
2523
2524      @Override
2525      public Base addChild(String name) throws FHIRException {
2526        if (name.equals("type")) {
2527          this.type = new CodeableConcept();
2528          return this.type;
2529        }
2530        else if (name.equals("applicability")) {
2531          this.applicability = new CodeableConcept();
2532          return this.applicability;
2533        }
2534        else if (name.equals("qualifiers")) {
2535          return addQualifiers();
2536        }
2537        else if (name.equals("value")) {
2538          this.value = new Quantity();
2539          return this.value;
2540        }
2541        else
2542          return super.addChild(name);
2543      }
2544
2545      public PlanBenefitCostComponent copy() {
2546        PlanBenefitCostComponent dst = new PlanBenefitCostComponent();
2547        copyValues(dst);
2548        return dst;
2549      }
2550
2551      public void copyValues(PlanBenefitCostComponent dst) {
2552        super.copyValues(dst);
2553        dst.type = type == null ? null : type.copy();
2554        dst.applicability = applicability == null ? null : applicability.copy();
2555        if (qualifiers != null) {
2556          dst.qualifiers = new ArrayList<CodeableConcept>();
2557          for (CodeableConcept i : qualifiers)
2558            dst.qualifiers.add(i.copy());
2559        };
2560        dst.value = value == null ? null : value.copy();
2561      }
2562
2563      @Override
2564      public boolean equalsDeep(Base other_) {
2565        if (!super.equalsDeep(other_))
2566          return false;
2567        if (!(other_ instanceof PlanBenefitCostComponent))
2568          return false;
2569        PlanBenefitCostComponent o = (PlanBenefitCostComponent) other_;
2570        return compareDeep(type, o.type, true) && compareDeep(applicability, o.applicability, true) && compareDeep(qualifiers, o.qualifiers, true)
2571           && compareDeep(value, o.value, true);
2572      }
2573
2574      @Override
2575      public boolean equalsShallow(Base other_) {
2576        if (!super.equalsShallow(other_))
2577          return false;
2578        if (!(other_ instanceof PlanBenefitCostComponent))
2579          return false;
2580        PlanBenefitCostComponent o = (PlanBenefitCostComponent) other_;
2581        return true;
2582      }
2583
2584      public boolean isEmpty() {
2585        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, applicability, qualifiers
2586          , value);
2587      }
2588
2589  public String fhirType() {
2590    return "InsurancePlan.plan.specificCost.benefit.cost";
2591
2592  }
2593
2594  }
2595
2596    /**
2597     * Business identifiers assigned to this health insurance product which remain constant as the resource is updated and propagates from server to server.
2598     */
2599    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2600    @Description(shortDefinition="Business Identifier for Product", formalDefinition="Business identifiers assigned to this health insurance product which remain constant as the resource is updated and propagates from server to server." )
2601    protected List<Identifier> identifier;
2602
2603    /**
2604     * The current state of the health insurance product.
2605     */
2606    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
2607    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The current state of the health insurance product." )
2608    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
2609    protected Enumeration<PublicationStatus> status;
2610
2611    /**
2612     * The kind of health insurance product.
2613     */
2614    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2615    @Description(shortDefinition="Kind of product", formalDefinition="The kind of health insurance product." )
2616    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/insuranceplan-type")
2617    protected List<CodeableConcept> type;
2618
2619    /**
2620     * Official name of the health insurance product as designated by the owner.
2621     */
2622    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2623    @Description(shortDefinition="Official name", formalDefinition="Official name of the health insurance product as designated by the owner." )
2624    protected StringType name;
2625
2626    /**
2627     * A list of alternate names that the product is known as, or was known as in the past.
2628     */
2629    @Child(name = "alias", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2630    @Description(shortDefinition="Alternate names", formalDefinition="A list of alternate names that the product is known as, or was known as in the past." )
2631    protected List<StringType> alias;
2632
2633    /**
2634     * The period of time that the health insurance product is available.
2635     */
2636    @Child(name = "period", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=false)
2637    @Description(shortDefinition="When the product is available", formalDefinition="The period of time that the health insurance product is available." )
2638    protected Period period;
2639
2640    /**
2641     * The entity that is providing  the health insurance product and underwriting the risk.  This is typically an insurance carriers, other third-party payers, or health plan sponsors comonly referred to as 'payers'.
2642     */
2643    @Child(name = "ownedBy", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=true)
2644    @Description(shortDefinition="Plan issuer", formalDefinition="The entity that is providing  the health insurance product and underwriting the risk.  This is typically an insurance carriers, other third-party payers, or health plan sponsors comonly referred to as 'payers'." )
2645    protected Reference ownedBy;
2646
2647    /**
2648     * An organization which administer other services such as underwriting, customer service and/or claims processing on behalf of the health insurance product owner.
2649     */
2650    @Child(name = "administeredBy", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true)
2651    @Description(shortDefinition="Product administrator", formalDefinition="An organization which administer other services such as underwriting, customer service and/or claims processing on behalf of the health insurance product owner." )
2652    protected Reference administeredBy;
2653
2654    /**
2655     * The geographic region in which a health insurance product's benefits apply.
2656     */
2657    @Child(name = "coverageArea", type = {Location.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2658    @Description(shortDefinition="Where product applies", formalDefinition="The geographic region in which a health insurance product's benefits apply." )
2659    protected List<Reference> coverageArea;
2660
2661    /**
2662     * The contact details of communication devices available relevant to the specific Insurance Plan/Product. This can include addresses, phone numbers, fax numbers, mobile numbers, email addresses and web sites.
2663     */
2664    @Child(name = "contact", type = {ExtendedContactDetail.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2665    @Description(shortDefinition="Official contact details relevant to the health insurance plan/product", formalDefinition="The contact details of communication devices available relevant to the specific Insurance Plan/Product. This can include addresses, phone numbers, fax numbers, mobile numbers, email addresses and web sites." )
2666    protected List<ExtendedContactDetail> contact;
2667
2668    /**
2669     * The technical endpoints providing access to services operated for the health insurance product.
2670     */
2671    @Child(name = "endpoint", type = {Endpoint.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2672    @Description(shortDefinition="Technical endpoint", formalDefinition="The technical endpoints providing access to services operated for the health insurance product." )
2673    protected List<Reference> endpoint;
2674
2675    /**
2676     * Reference to the network included in the health insurance product.
2677     */
2678    @Child(name = "network", type = {Organization.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2679    @Description(shortDefinition="What networks are Included", formalDefinition="Reference to the network included in the health insurance product." )
2680    protected List<Reference> network;
2681
2682    /**
2683     * Details about the coverage offered by the insurance product.
2684     */
2685    @Child(name = "coverage", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2686    @Description(shortDefinition="Coverage details", formalDefinition="Details about the coverage offered by the insurance product." )
2687    protected List<InsurancePlanCoverageComponent> coverage;
2688
2689    /**
2690     * Details about an insurance plan.
2691     */
2692    @Child(name = "plan", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2693    @Description(shortDefinition="Plan details", formalDefinition="Details about an insurance plan." )
2694    protected List<InsurancePlanPlanComponent> plan;
2695
2696    private static final long serialVersionUID = -292692522L;
2697
2698  /**
2699   * Constructor
2700   */
2701    public InsurancePlan() {
2702      super();
2703    }
2704
2705    /**
2706     * @return {@link #identifier} (Business identifiers assigned to this health insurance product which remain constant as the resource is updated and propagates from server to server.)
2707     */
2708    public List<Identifier> getIdentifier() { 
2709      if (this.identifier == null)
2710        this.identifier = new ArrayList<Identifier>();
2711      return this.identifier;
2712    }
2713
2714    /**
2715     * @return Returns a reference to <code>this</code> for easy method chaining
2716     */
2717    public InsurancePlan setIdentifier(List<Identifier> theIdentifier) { 
2718      this.identifier = theIdentifier;
2719      return this;
2720    }
2721
2722    public boolean hasIdentifier() { 
2723      if (this.identifier == null)
2724        return false;
2725      for (Identifier item : this.identifier)
2726        if (!item.isEmpty())
2727          return true;
2728      return false;
2729    }
2730
2731    public Identifier addIdentifier() { //3
2732      Identifier t = new Identifier();
2733      if (this.identifier == null)
2734        this.identifier = new ArrayList<Identifier>();
2735      this.identifier.add(t);
2736      return t;
2737    }
2738
2739    public InsurancePlan addIdentifier(Identifier t) { //3
2740      if (t == null)
2741        return this;
2742      if (this.identifier == null)
2743        this.identifier = new ArrayList<Identifier>();
2744      this.identifier.add(t);
2745      return this;
2746    }
2747
2748    /**
2749     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
2750     */
2751    public Identifier getIdentifierFirstRep() { 
2752      if (getIdentifier().isEmpty()) {
2753        addIdentifier();
2754      }
2755      return getIdentifier().get(0);
2756    }
2757
2758    /**
2759     * @return {@link #status} (The current state of the health insurance product.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2760     */
2761    public Enumeration<PublicationStatus> getStatusElement() { 
2762      if (this.status == null)
2763        if (Configuration.errorOnAutoCreate())
2764          throw new Error("Attempt to auto-create InsurancePlan.status");
2765        else if (Configuration.doAutoCreate())
2766          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
2767      return this.status;
2768    }
2769
2770    public boolean hasStatusElement() { 
2771      return this.status != null && !this.status.isEmpty();
2772    }
2773
2774    public boolean hasStatus() { 
2775      return this.status != null && !this.status.isEmpty();
2776    }
2777
2778    /**
2779     * @param value {@link #status} (The current state of the health insurance product.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2780     */
2781    public InsurancePlan setStatusElement(Enumeration<PublicationStatus> value) { 
2782      this.status = value;
2783      return this;
2784    }
2785
2786    /**
2787     * @return The current state of the health insurance product.
2788     */
2789    public PublicationStatus getStatus() { 
2790      return this.status == null ? null : this.status.getValue();
2791    }
2792
2793    /**
2794     * @param value The current state of the health insurance product.
2795     */
2796    public InsurancePlan setStatus(PublicationStatus value) { 
2797      if (value == null)
2798        this.status = null;
2799      else {
2800        if (this.status == null)
2801          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
2802        this.status.setValue(value);
2803      }
2804      return this;
2805    }
2806
2807    /**
2808     * @return {@link #type} (The kind of health insurance product.)
2809     */
2810    public List<CodeableConcept> getType() { 
2811      if (this.type == null)
2812        this.type = new ArrayList<CodeableConcept>();
2813      return this.type;
2814    }
2815
2816    /**
2817     * @return Returns a reference to <code>this</code> for easy method chaining
2818     */
2819    public InsurancePlan setType(List<CodeableConcept> theType) { 
2820      this.type = theType;
2821      return this;
2822    }
2823
2824    public boolean hasType() { 
2825      if (this.type == null)
2826        return false;
2827      for (CodeableConcept item : this.type)
2828        if (!item.isEmpty())
2829          return true;
2830      return false;
2831    }
2832
2833    public CodeableConcept addType() { //3
2834      CodeableConcept t = new CodeableConcept();
2835      if (this.type == null)
2836        this.type = new ArrayList<CodeableConcept>();
2837      this.type.add(t);
2838      return t;
2839    }
2840
2841    public InsurancePlan addType(CodeableConcept t) { //3
2842      if (t == null)
2843        return this;
2844      if (this.type == null)
2845        this.type = new ArrayList<CodeableConcept>();
2846      this.type.add(t);
2847      return this;
2848    }
2849
2850    /**
2851     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
2852     */
2853    public CodeableConcept getTypeFirstRep() { 
2854      if (getType().isEmpty()) {
2855        addType();
2856      }
2857      return getType().get(0);
2858    }
2859
2860    /**
2861     * @return {@link #name} (Official name of the health insurance product as designated by the owner.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2862     */
2863    public StringType getNameElement() { 
2864      if (this.name == null)
2865        if (Configuration.errorOnAutoCreate())
2866          throw new Error("Attempt to auto-create InsurancePlan.name");
2867        else if (Configuration.doAutoCreate())
2868          this.name = new StringType(); // bb
2869      return this.name;
2870    }
2871
2872    public boolean hasNameElement() { 
2873      return this.name != null && !this.name.isEmpty();
2874    }
2875
2876    public boolean hasName() { 
2877      return this.name != null && !this.name.isEmpty();
2878    }
2879
2880    /**
2881     * @param value {@link #name} (Official name of the health insurance product as designated by the owner.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2882     */
2883    public InsurancePlan setNameElement(StringType value) { 
2884      this.name = value;
2885      return this;
2886    }
2887
2888    /**
2889     * @return Official name of the health insurance product as designated by the owner.
2890     */
2891    public String getName() { 
2892      return this.name == null ? null : this.name.getValue();
2893    }
2894
2895    /**
2896     * @param value Official name of the health insurance product as designated by the owner.
2897     */
2898    public InsurancePlan setName(String value) { 
2899      if (Utilities.noString(value))
2900        this.name = null;
2901      else {
2902        if (this.name == null)
2903          this.name = new StringType();
2904        this.name.setValue(value);
2905      }
2906      return this;
2907    }
2908
2909    /**
2910     * @return {@link #alias} (A list of alternate names that the product is known as, or was known as in the past.)
2911     */
2912    public List<StringType> getAlias() { 
2913      if (this.alias == null)
2914        this.alias = new ArrayList<StringType>();
2915      return this.alias;
2916    }
2917
2918    /**
2919     * @return Returns a reference to <code>this</code> for easy method chaining
2920     */
2921    public InsurancePlan setAlias(List<StringType> theAlias) { 
2922      this.alias = theAlias;
2923      return this;
2924    }
2925
2926    public boolean hasAlias() { 
2927      if (this.alias == null)
2928        return false;
2929      for (StringType item : this.alias)
2930        if (!item.isEmpty())
2931          return true;
2932      return false;
2933    }
2934
2935    /**
2936     * @return {@link #alias} (A list of alternate names that the product is known as, or was known as in the past.)
2937     */
2938    public StringType addAliasElement() {//2 
2939      StringType t = new StringType();
2940      if (this.alias == null)
2941        this.alias = new ArrayList<StringType>();
2942      this.alias.add(t);
2943      return t;
2944    }
2945
2946    /**
2947     * @param value {@link #alias} (A list of alternate names that the product is known as, or was known as in the past.)
2948     */
2949    public InsurancePlan addAlias(String value) { //1
2950      StringType t = new StringType();
2951      t.setValue(value);
2952      if (this.alias == null)
2953        this.alias = new ArrayList<StringType>();
2954      this.alias.add(t);
2955      return this;
2956    }
2957
2958    /**
2959     * @param value {@link #alias} (A list of alternate names that the product is known as, or was known as in the past.)
2960     */
2961    public boolean hasAlias(String value) { 
2962      if (this.alias == null)
2963        return false;
2964      for (StringType v : this.alias)
2965        if (v.getValue().equals(value)) // string
2966          return true;
2967      return false;
2968    }
2969
2970    /**
2971     * @return {@link #period} (The period of time that the health insurance product is available.)
2972     */
2973    public Period getPeriod() { 
2974      if (this.period == null)
2975        if (Configuration.errorOnAutoCreate())
2976          throw new Error("Attempt to auto-create InsurancePlan.period");
2977        else if (Configuration.doAutoCreate())
2978          this.period = new Period(); // cc
2979      return this.period;
2980    }
2981
2982    public boolean hasPeriod() { 
2983      return this.period != null && !this.period.isEmpty();
2984    }
2985
2986    /**
2987     * @param value {@link #period} (The period of time that the health insurance product is available.)
2988     */
2989    public InsurancePlan setPeriod(Period value) { 
2990      this.period = value;
2991      return this;
2992    }
2993
2994    /**
2995     * @return {@link #ownedBy} (The entity that is providing  the health insurance product and underwriting the risk.  This is typically an insurance carriers, other third-party payers, or health plan sponsors comonly referred to as 'payers'.)
2996     */
2997    public Reference getOwnedBy() { 
2998      if (this.ownedBy == null)
2999        if (Configuration.errorOnAutoCreate())
3000          throw new Error("Attempt to auto-create InsurancePlan.ownedBy");
3001        else if (Configuration.doAutoCreate())
3002          this.ownedBy = new Reference(); // cc
3003      return this.ownedBy;
3004    }
3005
3006    public boolean hasOwnedBy() { 
3007      return this.ownedBy != null && !this.ownedBy.isEmpty();
3008    }
3009
3010    /**
3011     * @param value {@link #ownedBy} (The entity that is providing  the health insurance product and underwriting the risk.  This is typically an insurance carriers, other third-party payers, or health plan sponsors comonly referred to as 'payers'.)
3012     */
3013    public InsurancePlan setOwnedBy(Reference value) { 
3014      this.ownedBy = value;
3015      return this;
3016    }
3017
3018    /**
3019     * @return {@link #administeredBy} (An organization which administer other services such as underwriting, customer service and/or claims processing on behalf of the health insurance product owner.)
3020     */
3021    public Reference getAdministeredBy() { 
3022      if (this.administeredBy == null)
3023        if (Configuration.errorOnAutoCreate())
3024          throw new Error("Attempt to auto-create InsurancePlan.administeredBy");
3025        else if (Configuration.doAutoCreate())
3026          this.administeredBy = new Reference(); // cc
3027      return this.administeredBy;
3028    }
3029
3030    public boolean hasAdministeredBy() { 
3031      return this.administeredBy != null && !this.administeredBy.isEmpty();
3032    }
3033
3034    /**
3035     * @param value {@link #administeredBy} (An organization which administer other services such as underwriting, customer service and/or claims processing on behalf of the health insurance product owner.)
3036     */
3037    public InsurancePlan setAdministeredBy(Reference value) { 
3038      this.administeredBy = value;
3039      return this;
3040    }
3041
3042    /**
3043     * @return {@link #coverageArea} (The geographic region in which a health insurance product's benefits apply.)
3044     */
3045    public List<Reference> getCoverageArea() { 
3046      if (this.coverageArea == null)
3047        this.coverageArea = new ArrayList<Reference>();
3048      return this.coverageArea;
3049    }
3050
3051    /**
3052     * @return Returns a reference to <code>this</code> for easy method chaining
3053     */
3054    public InsurancePlan setCoverageArea(List<Reference> theCoverageArea) { 
3055      this.coverageArea = theCoverageArea;
3056      return this;
3057    }
3058
3059    public boolean hasCoverageArea() { 
3060      if (this.coverageArea == null)
3061        return false;
3062      for (Reference item : this.coverageArea)
3063        if (!item.isEmpty())
3064          return true;
3065      return false;
3066    }
3067
3068    public Reference addCoverageArea() { //3
3069      Reference t = new Reference();
3070      if (this.coverageArea == null)
3071        this.coverageArea = new ArrayList<Reference>();
3072      this.coverageArea.add(t);
3073      return t;
3074    }
3075
3076    public InsurancePlan addCoverageArea(Reference t) { //3
3077      if (t == null)
3078        return this;
3079      if (this.coverageArea == null)
3080        this.coverageArea = new ArrayList<Reference>();
3081      this.coverageArea.add(t);
3082      return this;
3083    }
3084
3085    /**
3086     * @return The first repetition of repeating field {@link #coverageArea}, creating it if it does not already exist {3}
3087     */
3088    public Reference getCoverageAreaFirstRep() { 
3089      if (getCoverageArea().isEmpty()) {
3090        addCoverageArea();
3091      }
3092      return getCoverageArea().get(0);
3093    }
3094
3095    /**
3096     * @return {@link #contact} (The contact details of communication devices available relevant to the specific Insurance Plan/Product. This can include addresses, phone numbers, fax numbers, mobile numbers, email addresses and web sites.)
3097     */
3098    public List<ExtendedContactDetail> getContact() { 
3099      if (this.contact == null)
3100        this.contact = new ArrayList<ExtendedContactDetail>();
3101      return this.contact;
3102    }
3103
3104    /**
3105     * @return Returns a reference to <code>this</code> for easy method chaining
3106     */
3107    public InsurancePlan setContact(List<ExtendedContactDetail> theContact) { 
3108      this.contact = theContact;
3109      return this;
3110    }
3111
3112    public boolean hasContact() { 
3113      if (this.contact == null)
3114        return false;
3115      for (ExtendedContactDetail item : this.contact)
3116        if (!item.isEmpty())
3117          return true;
3118      return false;
3119    }
3120
3121    public ExtendedContactDetail addContact() { //3
3122      ExtendedContactDetail t = new ExtendedContactDetail();
3123      if (this.contact == null)
3124        this.contact = new ArrayList<ExtendedContactDetail>();
3125      this.contact.add(t);
3126      return t;
3127    }
3128
3129    public InsurancePlan addContact(ExtendedContactDetail t) { //3
3130      if (t == null)
3131        return this;
3132      if (this.contact == null)
3133        this.contact = new ArrayList<ExtendedContactDetail>();
3134      this.contact.add(t);
3135      return this;
3136    }
3137
3138    /**
3139     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
3140     */
3141    public ExtendedContactDetail getContactFirstRep() { 
3142      if (getContact().isEmpty()) {
3143        addContact();
3144      }
3145      return getContact().get(0);
3146    }
3147
3148    /**
3149     * @return {@link #endpoint} (The technical endpoints providing access to services operated for the health insurance product.)
3150     */
3151    public List<Reference> getEndpoint() { 
3152      if (this.endpoint == null)
3153        this.endpoint = new ArrayList<Reference>();
3154      return this.endpoint;
3155    }
3156
3157    /**
3158     * @return Returns a reference to <code>this</code> for easy method chaining
3159     */
3160    public InsurancePlan setEndpoint(List<Reference> theEndpoint) { 
3161      this.endpoint = theEndpoint;
3162      return this;
3163    }
3164
3165    public boolean hasEndpoint() { 
3166      if (this.endpoint == null)
3167        return false;
3168      for (Reference item : this.endpoint)
3169        if (!item.isEmpty())
3170          return true;
3171      return false;
3172    }
3173
3174    public Reference addEndpoint() { //3
3175      Reference t = new Reference();
3176      if (this.endpoint == null)
3177        this.endpoint = new ArrayList<Reference>();
3178      this.endpoint.add(t);
3179      return t;
3180    }
3181
3182    public InsurancePlan addEndpoint(Reference t) { //3
3183      if (t == null)
3184        return this;
3185      if (this.endpoint == null)
3186        this.endpoint = new ArrayList<Reference>();
3187      this.endpoint.add(t);
3188      return this;
3189    }
3190
3191    /**
3192     * @return The first repetition of repeating field {@link #endpoint}, creating it if it does not already exist {3}
3193     */
3194    public Reference getEndpointFirstRep() { 
3195      if (getEndpoint().isEmpty()) {
3196        addEndpoint();
3197      }
3198      return getEndpoint().get(0);
3199    }
3200
3201    /**
3202     * @return {@link #network} (Reference to the network included in the health insurance product.)
3203     */
3204    public List<Reference> getNetwork() { 
3205      if (this.network == null)
3206        this.network = new ArrayList<Reference>();
3207      return this.network;
3208    }
3209
3210    /**
3211     * @return Returns a reference to <code>this</code> for easy method chaining
3212     */
3213    public InsurancePlan setNetwork(List<Reference> theNetwork) { 
3214      this.network = theNetwork;
3215      return this;
3216    }
3217
3218    public boolean hasNetwork() { 
3219      if (this.network == null)
3220        return false;
3221      for (Reference item : this.network)
3222        if (!item.isEmpty())
3223          return true;
3224      return false;
3225    }
3226
3227    public Reference addNetwork() { //3
3228      Reference t = new Reference();
3229      if (this.network == null)
3230        this.network = new ArrayList<Reference>();
3231      this.network.add(t);
3232      return t;
3233    }
3234
3235    public InsurancePlan addNetwork(Reference t) { //3
3236      if (t == null)
3237        return this;
3238      if (this.network == null)
3239        this.network = new ArrayList<Reference>();
3240      this.network.add(t);
3241      return this;
3242    }
3243
3244    /**
3245     * @return The first repetition of repeating field {@link #network}, creating it if it does not already exist {3}
3246     */
3247    public Reference getNetworkFirstRep() { 
3248      if (getNetwork().isEmpty()) {
3249        addNetwork();
3250      }
3251      return getNetwork().get(0);
3252    }
3253
3254    /**
3255     * @return {@link #coverage} (Details about the coverage offered by the insurance product.)
3256     */
3257    public List<InsurancePlanCoverageComponent> getCoverage() { 
3258      if (this.coverage == null)
3259        this.coverage = new ArrayList<InsurancePlanCoverageComponent>();
3260      return this.coverage;
3261    }
3262
3263    /**
3264     * @return Returns a reference to <code>this</code> for easy method chaining
3265     */
3266    public InsurancePlan setCoverage(List<InsurancePlanCoverageComponent> theCoverage) { 
3267      this.coverage = theCoverage;
3268      return this;
3269    }
3270
3271    public boolean hasCoverage() { 
3272      if (this.coverage == null)
3273        return false;
3274      for (InsurancePlanCoverageComponent item : this.coverage)
3275        if (!item.isEmpty())
3276          return true;
3277      return false;
3278    }
3279
3280    public InsurancePlanCoverageComponent addCoverage() { //3
3281      InsurancePlanCoverageComponent t = new InsurancePlanCoverageComponent();
3282      if (this.coverage == null)
3283        this.coverage = new ArrayList<InsurancePlanCoverageComponent>();
3284      this.coverage.add(t);
3285      return t;
3286    }
3287
3288    public InsurancePlan addCoverage(InsurancePlanCoverageComponent t) { //3
3289      if (t == null)
3290        return this;
3291      if (this.coverage == null)
3292        this.coverage = new ArrayList<InsurancePlanCoverageComponent>();
3293      this.coverage.add(t);
3294      return this;
3295    }
3296
3297    /**
3298     * @return The first repetition of repeating field {@link #coverage}, creating it if it does not already exist {3}
3299     */
3300    public InsurancePlanCoverageComponent getCoverageFirstRep() { 
3301      if (getCoverage().isEmpty()) {
3302        addCoverage();
3303      }
3304      return getCoverage().get(0);
3305    }
3306
3307    /**
3308     * @return {@link #plan} (Details about an insurance plan.)
3309     */
3310    public List<InsurancePlanPlanComponent> getPlan() { 
3311      if (this.plan == null)
3312        this.plan = new ArrayList<InsurancePlanPlanComponent>();
3313      return this.plan;
3314    }
3315
3316    /**
3317     * @return Returns a reference to <code>this</code> for easy method chaining
3318     */
3319    public InsurancePlan setPlan(List<InsurancePlanPlanComponent> thePlan) { 
3320      this.plan = thePlan;
3321      return this;
3322    }
3323
3324    public boolean hasPlan() { 
3325      if (this.plan == null)
3326        return false;
3327      for (InsurancePlanPlanComponent item : this.plan)
3328        if (!item.isEmpty())
3329          return true;
3330      return false;
3331    }
3332
3333    public InsurancePlanPlanComponent addPlan() { //3
3334      InsurancePlanPlanComponent t = new InsurancePlanPlanComponent();
3335      if (this.plan == null)
3336        this.plan = new ArrayList<InsurancePlanPlanComponent>();
3337      this.plan.add(t);
3338      return t;
3339    }
3340
3341    public InsurancePlan addPlan(InsurancePlanPlanComponent t) { //3
3342      if (t == null)
3343        return this;
3344      if (this.plan == null)
3345        this.plan = new ArrayList<InsurancePlanPlanComponent>();
3346      this.plan.add(t);
3347      return this;
3348    }
3349
3350    /**
3351     * @return The first repetition of repeating field {@link #plan}, creating it if it does not already exist {3}
3352     */
3353    public InsurancePlanPlanComponent getPlanFirstRep() { 
3354      if (getPlan().isEmpty()) {
3355        addPlan();
3356      }
3357      return getPlan().get(0);
3358    }
3359
3360      protected void listChildren(List<Property> children) {
3361        super.listChildren(children);
3362        children.add(new Property("identifier", "Identifier", "Business identifiers assigned to this health insurance product which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
3363        children.add(new Property("status", "code", "The current state of the health insurance product.", 0, 1, status));
3364        children.add(new Property("type", "CodeableConcept", "The kind of health insurance product.", 0, java.lang.Integer.MAX_VALUE, type));
3365        children.add(new Property("name", "string", "Official name of the health insurance product as designated by the owner.", 0, 1, name));
3366        children.add(new Property("alias", "string", "A list of alternate names that the product is known as, or was known as in the past.", 0, java.lang.Integer.MAX_VALUE, alias));
3367        children.add(new Property("period", "Period", "The period of time that the health insurance product is available.", 0, 1, period));
3368        children.add(new Property("ownedBy", "Reference(Organization)", "The entity that is providing  the health insurance product and underwriting the risk.  This is typically an insurance carriers, other third-party payers, or health plan sponsors comonly referred to as 'payers'.", 0, 1, ownedBy));
3369        children.add(new Property("administeredBy", "Reference(Organization)", "An organization which administer other services such as underwriting, customer service and/or claims processing on behalf of the health insurance product owner.", 0, 1, administeredBy));
3370        children.add(new Property("coverageArea", "Reference(Location)", "The geographic region in which a health insurance product's benefits apply.", 0, java.lang.Integer.MAX_VALUE, coverageArea));
3371        children.add(new Property("contact", "ExtendedContactDetail", "The contact details of communication devices available relevant to the specific Insurance Plan/Product. This can include addresses, phone numbers, fax numbers, mobile numbers, email addresses and web sites.", 0, java.lang.Integer.MAX_VALUE, contact));
3372        children.add(new Property("endpoint", "Reference(Endpoint)", "The technical endpoints providing access to services operated for the health insurance product.", 0, java.lang.Integer.MAX_VALUE, endpoint));
3373        children.add(new Property("network", "Reference(Organization)", "Reference to the network included in the health insurance product.", 0, java.lang.Integer.MAX_VALUE, network));
3374        children.add(new Property("coverage", "", "Details about the coverage offered by the insurance product.", 0, java.lang.Integer.MAX_VALUE, coverage));
3375        children.add(new Property("plan", "", "Details about an insurance plan.", 0, java.lang.Integer.MAX_VALUE, plan));
3376      }
3377
3378      @Override
3379      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3380        switch (_hash) {
3381        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifiers assigned to this health insurance product which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
3382        case -892481550: /*status*/  return new Property("status", "code", "The current state of the health insurance product.", 0, 1, status);
3383        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of health insurance product.", 0, java.lang.Integer.MAX_VALUE, type);
3384        case 3373707: /*name*/  return new Property("name", "string", "Official name of the health insurance product as designated by the owner.", 0, 1, name);
3385        case 92902992: /*alias*/  return new Property("alias", "string", "A list of alternate names that the product is known as, or was known as in the past.", 0, java.lang.Integer.MAX_VALUE, alias);
3386        case -991726143: /*period*/  return new Property("period", "Period", "The period of time that the health insurance product is available.", 0, 1, period);
3387        case -1054743076: /*ownedBy*/  return new Property("ownedBy", "Reference(Organization)", "The entity that is providing  the health insurance product and underwriting the risk.  This is typically an insurance carriers, other third-party payers, or health plan sponsors comonly referred to as 'payers'.", 0, 1, ownedBy);
3388        case 898770462: /*administeredBy*/  return new Property("administeredBy", "Reference(Organization)", "An organization which administer other services such as underwriting, customer service and/or claims processing on behalf of the health insurance product owner.", 0, 1, administeredBy);
3389        case -1532328299: /*coverageArea*/  return new Property("coverageArea", "Reference(Location)", "The geographic region in which a health insurance product's benefits apply.", 0, java.lang.Integer.MAX_VALUE, coverageArea);
3390        case 951526432: /*contact*/  return new Property("contact", "ExtendedContactDetail", "The contact details of communication devices available relevant to the specific Insurance Plan/Product. This can include addresses, phone numbers, fax numbers, mobile numbers, email addresses and web sites.", 0, java.lang.Integer.MAX_VALUE, contact);
3391        case 1741102485: /*endpoint*/  return new Property("endpoint", "Reference(Endpoint)", "The technical endpoints providing access to services operated for the health insurance product.", 0, java.lang.Integer.MAX_VALUE, endpoint);
3392        case 1843485230: /*network*/  return new Property("network", "Reference(Organization)", "Reference to the network included in the health insurance product.", 0, java.lang.Integer.MAX_VALUE, network);
3393        case -351767064: /*coverage*/  return new Property("coverage", "", "Details about the coverage offered by the insurance product.", 0, java.lang.Integer.MAX_VALUE, coverage);
3394        case 3443497: /*plan*/  return new Property("plan", "", "Details about an insurance plan.", 0, java.lang.Integer.MAX_VALUE, plan);
3395        default: return super.getNamedProperty(_hash, _name, _checkValid);
3396        }
3397
3398      }
3399
3400      @Override
3401      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3402        switch (hash) {
3403        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3404        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
3405        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
3406        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
3407        case 92902992: /*alias*/ return this.alias == null ? new Base[0] : this.alias.toArray(new Base[this.alias.size()]); // StringType
3408        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
3409        case -1054743076: /*ownedBy*/ return this.ownedBy == null ? new Base[0] : new Base[] {this.ownedBy}; // Reference
3410        case 898770462: /*administeredBy*/ return this.administeredBy == null ? new Base[0] : new Base[] {this.administeredBy}; // Reference
3411        case -1532328299: /*coverageArea*/ return this.coverageArea == null ? new Base[0] : this.coverageArea.toArray(new Base[this.coverageArea.size()]); // Reference
3412        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ExtendedContactDetail
3413        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : this.endpoint.toArray(new Base[this.endpoint.size()]); // Reference
3414        case 1843485230: /*network*/ return this.network == null ? new Base[0] : this.network.toArray(new Base[this.network.size()]); // Reference
3415        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : this.coverage.toArray(new Base[this.coverage.size()]); // InsurancePlanCoverageComponent
3416        case 3443497: /*plan*/ return this.plan == null ? new Base[0] : this.plan.toArray(new Base[this.plan.size()]); // InsurancePlanPlanComponent
3417        default: return super.getProperty(hash, name, checkValid);
3418        }
3419
3420      }
3421
3422      @Override
3423      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3424        switch (hash) {
3425        case -1618432855: // identifier
3426          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
3427          return value;
3428        case -892481550: // status
3429          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3430          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
3431          return value;
3432        case 3575610: // type
3433          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3434          return value;
3435        case 3373707: // name
3436          this.name = TypeConvertor.castToString(value); // StringType
3437          return value;
3438        case 92902992: // alias
3439          this.getAlias().add(TypeConvertor.castToString(value)); // StringType
3440          return value;
3441        case -991726143: // period
3442          this.period = TypeConvertor.castToPeriod(value); // Period
3443          return value;
3444        case -1054743076: // ownedBy
3445          this.ownedBy = TypeConvertor.castToReference(value); // Reference
3446          return value;
3447        case 898770462: // administeredBy
3448          this.administeredBy = TypeConvertor.castToReference(value); // Reference
3449          return value;
3450        case -1532328299: // coverageArea
3451          this.getCoverageArea().add(TypeConvertor.castToReference(value)); // Reference
3452          return value;
3453        case 951526432: // contact
3454          this.getContact().add(TypeConvertor.castToExtendedContactDetail(value)); // ExtendedContactDetail
3455          return value;
3456        case 1741102485: // endpoint
3457          this.getEndpoint().add(TypeConvertor.castToReference(value)); // Reference
3458          return value;
3459        case 1843485230: // network
3460          this.getNetwork().add(TypeConvertor.castToReference(value)); // Reference
3461          return value;
3462        case -351767064: // coverage
3463          this.getCoverage().add((InsurancePlanCoverageComponent) value); // InsurancePlanCoverageComponent
3464          return value;
3465        case 3443497: // plan
3466          this.getPlan().add((InsurancePlanPlanComponent) value); // InsurancePlanPlanComponent
3467          return value;
3468        default: return super.setProperty(hash, name, value);
3469        }
3470
3471      }
3472
3473      @Override
3474      public Base setProperty(String name, Base value) throws FHIRException {
3475        if (name.equals("identifier")) {
3476          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
3477        } else if (name.equals("status")) {
3478          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3479          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
3480        } else if (name.equals("type")) {
3481          this.getType().add(TypeConvertor.castToCodeableConcept(value));
3482        } else if (name.equals("name")) {
3483          this.name = TypeConvertor.castToString(value); // StringType
3484        } else if (name.equals("alias")) {
3485          this.getAlias().add(TypeConvertor.castToString(value));
3486        } else if (name.equals("period")) {
3487          this.period = TypeConvertor.castToPeriod(value); // Period
3488        } else if (name.equals("ownedBy")) {
3489          this.ownedBy = TypeConvertor.castToReference(value); // Reference
3490        } else if (name.equals("administeredBy")) {
3491          this.administeredBy = TypeConvertor.castToReference(value); // Reference
3492        } else if (name.equals("coverageArea")) {
3493          this.getCoverageArea().add(TypeConvertor.castToReference(value));
3494        } else if (name.equals("contact")) {
3495          this.getContact().add(TypeConvertor.castToExtendedContactDetail(value));
3496        } else if (name.equals("endpoint")) {
3497          this.getEndpoint().add(TypeConvertor.castToReference(value));
3498        } else if (name.equals("network")) {
3499          this.getNetwork().add(TypeConvertor.castToReference(value));
3500        } else if (name.equals("coverage")) {
3501          this.getCoverage().add((InsurancePlanCoverageComponent) value);
3502        } else if (name.equals("plan")) {
3503          this.getPlan().add((InsurancePlanPlanComponent) value);
3504        } else
3505          return super.setProperty(name, value);
3506        return value;
3507      }
3508
3509      @Override
3510      public Base makeProperty(int hash, String name) throws FHIRException {
3511        switch (hash) {
3512        case -1618432855:  return addIdentifier(); 
3513        case -892481550:  return getStatusElement();
3514        case 3575610:  return addType(); 
3515        case 3373707:  return getNameElement();
3516        case 92902992:  return addAliasElement();
3517        case -991726143:  return getPeriod();
3518        case -1054743076:  return getOwnedBy();
3519        case 898770462:  return getAdministeredBy();
3520        case -1532328299:  return addCoverageArea(); 
3521        case 951526432:  return addContact(); 
3522        case 1741102485:  return addEndpoint(); 
3523        case 1843485230:  return addNetwork(); 
3524        case -351767064:  return addCoverage(); 
3525        case 3443497:  return addPlan(); 
3526        default: return super.makeProperty(hash, name);
3527        }
3528
3529      }
3530
3531      @Override
3532      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3533        switch (hash) {
3534        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3535        case -892481550: /*status*/ return new String[] {"code"};
3536        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3537        case 3373707: /*name*/ return new String[] {"string"};
3538        case 92902992: /*alias*/ return new String[] {"string"};
3539        case -991726143: /*period*/ return new String[] {"Period"};
3540        case -1054743076: /*ownedBy*/ return new String[] {"Reference"};
3541        case 898770462: /*administeredBy*/ return new String[] {"Reference"};
3542        case -1532328299: /*coverageArea*/ return new String[] {"Reference"};
3543        case 951526432: /*contact*/ return new String[] {"ExtendedContactDetail"};
3544        case 1741102485: /*endpoint*/ return new String[] {"Reference"};
3545        case 1843485230: /*network*/ return new String[] {"Reference"};
3546        case -351767064: /*coverage*/ return new String[] {};
3547        case 3443497: /*plan*/ return new String[] {};
3548        default: return super.getTypesForProperty(hash, name);
3549        }
3550
3551      }
3552
3553      @Override
3554      public Base addChild(String name) throws FHIRException {
3555        if (name.equals("identifier")) {
3556          return addIdentifier();
3557        }
3558        else if (name.equals("status")) {
3559          throw new FHIRException("Cannot call addChild on a primitive type InsurancePlan.status");
3560        }
3561        else if (name.equals("type")) {
3562          return addType();
3563        }
3564        else if (name.equals("name")) {
3565          throw new FHIRException("Cannot call addChild on a primitive type InsurancePlan.name");
3566        }
3567        else if (name.equals("alias")) {
3568          throw new FHIRException("Cannot call addChild on a primitive type InsurancePlan.alias");
3569        }
3570        else if (name.equals("period")) {
3571          this.period = new Period();
3572          return this.period;
3573        }
3574        else if (name.equals("ownedBy")) {
3575          this.ownedBy = new Reference();
3576          return this.ownedBy;
3577        }
3578        else if (name.equals("administeredBy")) {
3579          this.administeredBy = new Reference();
3580          return this.administeredBy;
3581        }
3582        else if (name.equals("coverageArea")) {
3583          return addCoverageArea();
3584        }
3585        else if (name.equals("contact")) {
3586          return addContact();
3587        }
3588        else if (name.equals("endpoint")) {
3589          return addEndpoint();
3590        }
3591        else if (name.equals("network")) {
3592          return addNetwork();
3593        }
3594        else if (name.equals("coverage")) {
3595          return addCoverage();
3596        }
3597        else if (name.equals("plan")) {
3598          return addPlan();
3599        }
3600        else
3601          return super.addChild(name);
3602      }
3603
3604  public String fhirType() {
3605    return "InsurancePlan";
3606
3607  }
3608
3609      public InsurancePlan copy() {
3610        InsurancePlan dst = new InsurancePlan();
3611        copyValues(dst);
3612        return dst;
3613      }
3614
3615      public void copyValues(InsurancePlan dst) {
3616        super.copyValues(dst);
3617        if (identifier != null) {
3618          dst.identifier = new ArrayList<Identifier>();
3619          for (Identifier i : identifier)
3620            dst.identifier.add(i.copy());
3621        };
3622        dst.status = status == null ? null : status.copy();
3623        if (type != null) {
3624          dst.type = new ArrayList<CodeableConcept>();
3625          for (CodeableConcept i : type)
3626            dst.type.add(i.copy());
3627        };
3628        dst.name = name == null ? null : name.copy();
3629        if (alias != null) {
3630          dst.alias = new ArrayList<StringType>();
3631          for (StringType i : alias)
3632            dst.alias.add(i.copy());
3633        };
3634        dst.period = period == null ? null : period.copy();
3635        dst.ownedBy = ownedBy == null ? null : ownedBy.copy();
3636        dst.administeredBy = administeredBy == null ? null : administeredBy.copy();
3637        if (coverageArea != null) {
3638          dst.coverageArea = new ArrayList<Reference>();
3639          for (Reference i : coverageArea)
3640            dst.coverageArea.add(i.copy());
3641        };
3642        if (contact != null) {
3643          dst.contact = new ArrayList<ExtendedContactDetail>();
3644          for (ExtendedContactDetail i : contact)
3645            dst.contact.add(i.copy());
3646        };
3647        if (endpoint != null) {
3648          dst.endpoint = new ArrayList<Reference>();
3649          for (Reference i : endpoint)
3650            dst.endpoint.add(i.copy());
3651        };
3652        if (network != null) {
3653          dst.network = new ArrayList<Reference>();
3654          for (Reference i : network)
3655            dst.network.add(i.copy());
3656        };
3657        if (coverage != null) {
3658          dst.coverage = new ArrayList<InsurancePlanCoverageComponent>();
3659          for (InsurancePlanCoverageComponent i : coverage)
3660            dst.coverage.add(i.copy());
3661        };
3662        if (plan != null) {
3663          dst.plan = new ArrayList<InsurancePlanPlanComponent>();
3664          for (InsurancePlanPlanComponent i : plan)
3665            dst.plan.add(i.copy());
3666        };
3667      }
3668
3669      protected InsurancePlan typedCopy() {
3670        return copy();
3671      }
3672
3673      @Override
3674      public boolean equalsDeep(Base other_) {
3675        if (!super.equalsDeep(other_))
3676          return false;
3677        if (!(other_ instanceof InsurancePlan))
3678          return false;
3679        InsurancePlan o = (InsurancePlan) other_;
3680        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
3681           && compareDeep(name, o.name, true) && compareDeep(alias, o.alias, true) && compareDeep(period, o.period, true)
3682           && compareDeep(ownedBy, o.ownedBy, true) && compareDeep(administeredBy, o.administeredBy, true)
3683           && compareDeep(coverageArea, o.coverageArea, true) && compareDeep(contact, o.contact, true) && compareDeep(endpoint, o.endpoint, true)
3684           && compareDeep(network, o.network, true) && compareDeep(coverage, o.coverage, true) && compareDeep(plan, o.plan, true)
3685          ;
3686      }
3687
3688      @Override
3689      public boolean equalsShallow(Base other_) {
3690        if (!super.equalsShallow(other_))
3691          return false;
3692        if (!(other_ instanceof InsurancePlan))
3693          return false;
3694        InsurancePlan o = (InsurancePlan) other_;
3695        return compareValues(status, o.status, true) && compareValues(name, o.name, true) && compareValues(alias, o.alias, true)
3696          ;
3697      }
3698
3699      public boolean isEmpty() {
3700        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
3701          , name, alias, period, ownedBy, administeredBy, coverageArea, contact, endpoint
3702          , network, coverage, plan);
3703      }
3704
3705  @Override
3706  public ResourceType getResourceType() {
3707    return ResourceType.InsurancePlan;
3708   }
3709
3710 /**
3711   * Search parameter: <b>address-city</b>
3712   * <p>
3713   * Description: <b>A city specified in an address</b><br>
3714   * Type: <b>string</b><br>
3715   * Path: <b>InsurancePlan.contact.address.city</b><br>
3716   * </p>
3717   */
3718  @SearchParamDefinition(name="address-city", path="InsurancePlan.contact.address.city", description="A city specified in an address", type="string" )
3719  public static final String SP_ADDRESS_CITY = "address-city";
3720 /**
3721   * <b>Fluent Client</b> search parameter constant for <b>address-city</b>
3722   * <p>
3723   * Description: <b>A city specified in an address</b><br>
3724   * Type: <b>string</b><br>
3725   * Path: <b>InsurancePlan.contact.address.city</b><br>
3726   * </p>
3727   */
3728  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_CITY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_CITY);
3729
3730 /**
3731   * Search parameter: <b>address-country</b>
3732   * <p>
3733   * Description: <b>A country specified in an address</b><br>
3734   * Type: <b>string</b><br>
3735   * Path: <b>InsurancePlan.contact.address.country</b><br>
3736   * </p>
3737   */
3738  @SearchParamDefinition(name="address-country", path="InsurancePlan.contact.address.country", description="A country specified in an address", type="string" )
3739  public static final String SP_ADDRESS_COUNTRY = "address-country";
3740 /**
3741   * <b>Fluent Client</b> search parameter constant for <b>address-country</b>
3742   * <p>
3743   * Description: <b>A country specified in an address</b><br>
3744   * Type: <b>string</b><br>
3745   * Path: <b>InsurancePlan.contact.address.country</b><br>
3746   * </p>
3747   */
3748  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_COUNTRY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_COUNTRY);
3749
3750 /**
3751   * Search parameter: <b>address-postalcode</b>
3752   * <p>
3753   * Description: <b>A postal code specified in an address</b><br>
3754   * Type: <b>string</b><br>
3755   * Path: <b>InsurancePlan.contact.address.postalCode</b><br>
3756   * </p>
3757   */
3758  @SearchParamDefinition(name="address-postalcode", path="InsurancePlan.contact.address.postalCode", description="A postal code specified in an address", type="string" )
3759  public static final String SP_ADDRESS_POSTALCODE = "address-postalcode";
3760 /**
3761   * <b>Fluent Client</b> search parameter constant for <b>address-postalcode</b>
3762   * <p>
3763   * Description: <b>A postal code specified in an address</b><br>
3764   * Type: <b>string</b><br>
3765   * Path: <b>InsurancePlan.contact.address.postalCode</b><br>
3766   * </p>
3767   */
3768  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_POSTALCODE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_POSTALCODE);
3769
3770 /**
3771   * Search parameter: <b>address-state</b>
3772   * <p>
3773   * Description: <b>A state specified in an address</b><br>
3774   * Type: <b>string</b><br>
3775   * Path: <b>InsurancePlan.contact.address.state</b><br>
3776   * </p>
3777   */
3778  @SearchParamDefinition(name="address-state", path="InsurancePlan.contact.address.state", description="A state specified in an address", type="string" )
3779  public static final String SP_ADDRESS_STATE = "address-state";
3780 /**
3781   * <b>Fluent Client</b> search parameter constant for <b>address-state</b>
3782   * <p>
3783   * Description: <b>A state specified in an address</b><br>
3784   * Type: <b>string</b><br>
3785   * Path: <b>InsurancePlan.contact.address.state</b><br>
3786   * </p>
3787   */
3788  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_STATE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_STATE);
3789
3790 /**
3791   * Search parameter: <b>address-use</b>
3792   * <p>
3793   * Description: <b>A use code specified in an address</b><br>
3794   * Type: <b>token</b><br>
3795   * Path: <b>InsurancePlan.contact.address.use</b><br>
3796   * </p>
3797   */
3798  @SearchParamDefinition(name="address-use", path="InsurancePlan.contact.address.use", description="A use code specified in an address", type="token" )
3799  public static final String SP_ADDRESS_USE = "address-use";
3800 /**
3801   * <b>Fluent Client</b> search parameter constant for <b>address-use</b>
3802   * <p>
3803   * Description: <b>A use code specified in an address</b><br>
3804   * Type: <b>token</b><br>
3805   * Path: <b>InsurancePlan.contact.address.use</b><br>
3806   * </p>
3807   */
3808  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDRESS_USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDRESS_USE);
3809
3810 /**
3811   * Search parameter: <b>address</b>
3812   * <p>
3813   * Description: <b>A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text</b><br>
3814   * Type: <b>string</b><br>
3815   * Path: <b>InsurancePlan.contact.address</b><br>
3816   * </p>
3817   */
3818  @SearchParamDefinition(name="address", path="InsurancePlan.contact.address", description="A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text", type="string" )
3819  public static final String SP_ADDRESS = "address";
3820 /**
3821   * <b>Fluent Client</b> search parameter constant for <b>address</b>
3822   * <p>
3823   * Description: <b>A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text</b><br>
3824   * Type: <b>string</b><br>
3825   * Path: <b>InsurancePlan.contact.address</b><br>
3826   * </p>
3827   */
3828  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS);
3829
3830 /**
3831   * Search parameter: <b>administered-by</b>
3832   * <p>
3833   * Description: <b>Product administrator</b><br>
3834   * Type: <b>reference</b><br>
3835   * Path: <b>InsurancePlan.administeredBy</b><br>
3836   * </p>
3837   */
3838  @SearchParamDefinition(name="administered-by", path="InsurancePlan.administeredBy", description="Product administrator", type="reference", target={Organization.class } )
3839  public static final String SP_ADMINISTERED_BY = "administered-by";
3840 /**
3841   * <b>Fluent Client</b> search parameter constant for <b>administered-by</b>
3842   * <p>
3843   * Description: <b>Product administrator</b><br>
3844   * Type: <b>reference</b><br>
3845   * Path: <b>InsurancePlan.administeredBy</b><br>
3846   * </p>
3847   */
3848  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ADMINISTERED_BY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ADMINISTERED_BY);
3849
3850/**
3851   * Constant for fluent queries to be used to add include statements. Specifies
3852   * the path value of "<b>InsurancePlan:administered-by</b>".
3853   */
3854  public static final ca.uhn.fhir.model.api.Include INCLUDE_ADMINISTERED_BY = new ca.uhn.fhir.model.api.Include("InsurancePlan:administered-by").toLocked();
3855
3856 /**
3857   * Search parameter: <b>endpoint</b>
3858   * <p>
3859   * Description: <b>Technical endpoint</b><br>
3860   * Type: <b>reference</b><br>
3861   * Path: <b>InsurancePlan.endpoint</b><br>
3862   * </p>
3863   */
3864  @SearchParamDefinition(name="endpoint", path="InsurancePlan.endpoint", description="Technical endpoint", type="reference", target={Endpoint.class } )
3865  public static final String SP_ENDPOINT = "endpoint";
3866 /**
3867   * <b>Fluent Client</b> search parameter constant for <b>endpoint</b>
3868   * <p>
3869   * Description: <b>Technical endpoint</b><br>
3870   * Type: <b>reference</b><br>
3871   * Path: <b>InsurancePlan.endpoint</b><br>
3872   * </p>
3873   */
3874  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENDPOINT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENDPOINT);
3875
3876/**
3877   * Constant for fluent queries to be used to add include statements. Specifies
3878   * the path value of "<b>InsurancePlan:endpoint</b>".
3879   */
3880  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENDPOINT = new ca.uhn.fhir.model.api.Include("InsurancePlan:endpoint").toLocked();
3881
3882 /**
3883   * Search parameter: <b>identifier</b>
3884   * <p>
3885   * Description: <b>Any identifier for the organization (not the accreditation issuer's identifier)</b><br>
3886   * Type: <b>token</b><br>
3887   * Path: <b>InsurancePlan.identifier</b><br>
3888   * </p>
3889   */
3890  @SearchParamDefinition(name="identifier", path="InsurancePlan.identifier", description="Any identifier for the organization (not the accreditation issuer's identifier)", type="token" )
3891  public static final String SP_IDENTIFIER = "identifier";
3892 /**
3893   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3894   * <p>
3895   * Description: <b>Any identifier for the organization (not the accreditation issuer's identifier)</b><br>
3896   * Type: <b>token</b><br>
3897   * Path: <b>InsurancePlan.identifier</b><br>
3898   * </p>
3899   */
3900  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3901
3902 /**
3903   * Search parameter: <b>name</b>
3904   * <p>
3905   * Description: <b>A portion of the organization's name or alias</b><br>
3906   * Type: <b>string</b><br>
3907   * Path: <b>InsurancePlan.name | InsurancePlan.alias</b><br>
3908   * </p>
3909   */
3910  @SearchParamDefinition(name="name", path="InsurancePlan.name | InsurancePlan.alias", description="A portion of the organization's name or alias", type="string" )
3911  public static final String SP_NAME = "name";
3912 /**
3913   * <b>Fluent Client</b> search parameter constant for <b>name</b>
3914   * <p>
3915   * Description: <b>A portion of the organization's name or alias</b><br>
3916   * Type: <b>string</b><br>
3917   * Path: <b>InsurancePlan.name | InsurancePlan.alias</b><br>
3918   * </p>
3919   */
3920  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
3921
3922 /**
3923   * Search parameter: <b>owned-by</b>
3924   * <p>
3925   * Description: <b>An organization of which this organization forms a part</b><br>
3926   * Type: <b>reference</b><br>
3927   * Path: <b>InsurancePlan.ownedBy</b><br>
3928   * </p>
3929   */
3930  @SearchParamDefinition(name="owned-by", path="InsurancePlan.ownedBy", description="An organization of which this organization forms a part", type="reference", target={Organization.class } )
3931  public static final String SP_OWNED_BY = "owned-by";
3932 /**
3933   * <b>Fluent Client</b> search parameter constant for <b>owned-by</b>
3934   * <p>
3935   * Description: <b>An organization of which this organization forms a part</b><br>
3936   * Type: <b>reference</b><br>
3937   * Path: <b>InsurancePlan.ownedBy</b><br>
3938   * </p>
3939   */
3940  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OWNED_BY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_OWNED_BY);
3941
3942/**
3943   * Constant for fluent queries to be used to add include statements. Specifies
3944   * the path value of "<b>InsurancePlan:owned-by</b>".
3945   */
3946  public static final ca.uhn.fhir.model.api.Include INCLUDE_OWNED_BY = new ca.uhn.fhir.model.api.Include("InsurancePlan:owned-by").toLocked();
3947
3948 /**
3949   * Search parameter: <b>phonetic</b>
3950   * <p>
3951   * Description: <b>A portion of the organization's name using some kind of phonetic matching algorithm</b><br>
3952   * Type: <b>string</b><br>
3953   * Path: <b>InsurancePlan.name</b><br>
3954   * </p>
3955   */
3956  @SearchParamDefinition(name="phonetic", path="InsurancePlan.name", description="A portion of the organization's name using some kind of phonetic matching algorithm", type="string" )
3957  public static final String SP_PHONETIC = "phonetic";
3958 /**
3959   * <b>Fluent Client</b> search parameter constant for <b>phonetic</b>
3960   * <p>
3961   * Description: <b>A portion of the organization's name using some kind of phonetic matching algorithm</b><br>
3962   * Type: <b>string</b><br>
3963   * Path: <b>InsurancePlan.name</b><br>
3964   * </p>
3965   */
3966  public static final ca.uhn.fhir.rest.gclient.StringClientParam PHONETIC = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PHONETIC);
3967
3968 /**
3969   * Search parameter: <b>status</b>
3970   * <p>
3971   * Description: <b>Is the Organization record active</b><br>
3972   * Type: <b>token</b><br>
3973   * Path: <b>InsurancePlan.status</b><br>
3974   * </p>
3975   */
3976  @SearchParamDefinition(name="status", path="InsurancePlan.status", description="Is the Organization record active", type="token" )
3977  public static final String SP_STATUS = "status";
3978 /**
3979   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3980   * <p>
3981   * Description: <b>Is the Organization record active</b><br>
3982   * Type: <b>token</b><br>
3983   * Path: <b>InsurancePlan.status</b><br>
3984   * </p>
3985   */
3986  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3987
3988 /**
3989   * Search parameter: <b>type</b>
3990   * <p>
3991   * Description: <b>A code for the type of organization</b><br>
3992   * Type: <b>token</b><br>
3993   * Path: <b>InsurancePlan.type</b><br>
3994   * </p>
3995   */
3996  @SearchParamDefinition(name="type", path="InsurancePlan.type", description="A code for the type of organization", type="token" )
3997  public static final String SP_TYPE = "type";
3998 /**
3999   * <b>Fluent Client</b> search parameter constant for <b>type</b>
4000   * <p>
4001   * Description: <b>A code for the type of organization</b><br>
4002   * Type: <b>token</b><br>
4003   * Path: <b>InsurancePlan.type</b><br>
4004   * </p>
4005   */
4006  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
4007
4008
4009}
4010