001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.List;
035
036import org.hl7.fhir.exceptions.FHIRException;
037import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
038import org.hl7.fhir.r4.model.Enumerations.PublicationStatus;
039import org.hl7.fhir.r4.model.Enumerations.PublicationStatusEnumFactory;
040import org.hl7.fhir.utilities.Utilities;
041
042import ca.uhn.fhir.model.api.annotation.Block;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.ResourceDef;
046import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
047
048/**
049 * Details of a Health Insurance product/plan provided by an organization.
050 */
051@ResourceDef(name = "InsurancePlan", profile = "http://hl7.org/fhir/StructureDefinition/InsurancePlan")
052public class InsurancePlan extends DomainResource {
053
054  @Block()
055  public static class InsurancePlanContactComponent extends BackboneElement implements IBaseBackboneElement {
056    /**
057     * Indicates a purpose for which the contact can be reached.
058     */
059    @Child(name = "purpose", type = {
060        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
061    @Description(shortDefinition = "The type of contact", formalDefinition = "Indicates a purpose for which the contact can be reached.")
062    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/contactentity-type")
063    protected CodeableConcept purpose;
064
065    /**
066     * A name associated with the contact.
067     */
068    @Child(name = "name", type = { HumanName.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
069    @Description(shortDefinition = "A name associated with the contact", formalDefinition = "A name associated with the contact.")
070    protected HumanName name;
071
072    /**
073     * A contact detail (e.g. a telephone number or an email address) by which the
074     * party may be contacted.
075     */
076    @Child(name = "telecom", type = {
077        ContactPoint.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
078    @Description(shortDefinition = "Contact details (telephone, email, etc.)  for a contact", formalDefinition = "A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.")
079    protected List<ContactPoint> telecom;
080
081    /**
082     * Visiting or postal addresses for the contact.
083     */
084    @Child(name = "address", type = { Address.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
085    @Description(shortDefinition = "Visiting or postal addresses for the contact", formalDefinition = "Visiting or postal addresses for the contact.")
086    protected Address address;
087
088    private static final long serialVersionUID = 1831121305L;
089
090    /**
091     * Constructor
092     */
093    public InsurancePlanContactComponent() {
094      super();
095    }
096
097    /**
098     * @return {@link #purpose} (Indicates a purpose for which the contact can be
099     *         reached.)
100     */
101    public CodeableConcept getPurpose() {
102      if (this.purpose == null)
103        if (Configuration.errorOnAutoCreate())
104          throw new Error("Attempt to auto-create InsurancePlanContactComponent.purpose");
105        else if (Configuration.doAutoCreate())
106          this.purpose = new CodeableConcept(); // cc
107      return this.purpose;
108    }
109
110    public boolean hasPurpose() {
111      return this.purpose != null && !this.purpose.isEmpty();
112    }
113
114    /**
115     * @param value {@link #purpose} (Indicates a purpose for which the contact can
116     *              be reached.)
117     */
118    public InsurancePlanContactComponent setPurpose(CodeableConcept value) {
119      this.purpose = value;
120      return this;
121    }
122
123    /**
124     * @return {@link #name} (A name associated with the contact.)
125     */
126    public HumanName getName() {
127      if (this.name == null)
128        if (Configuration.errorOnAutoCreate())
129          throw new Error("Attempt to auto-create InsurancePlanContactComponent.name");
130        else if (Configuration.doAutoCreate())
131          this.name = new HumanName(); // cc
132      return this.name;
133    }
134
135    public boolean hasName() {
136      return this.name != null && !this.name.isEmpty();
137    }
138
139    /**
140     * @param value {@link #name} (A name associated with the contact.)
141     */
142    public InsurancePlanContactComponent setName(HumanName value) {
143      this.name = value;
144      return this;
145    }
146
147    /**
148     * @return {@link #telecom} (A contact detail (e.g. a telephone number or an
149     *         email address) by which the party may be contacted.)
150     */
151    public List<ContactPoint> getTelecom() {
152      if (this.telecom == null)
153        this.telecom = new ArrayList<ContactPoint>();
154      return this.telecom;
155    }
156
157    /**
158     * @return Returns a reference to <code>this</code> for easy method chaining
159     */
160    public InsurancePlanContactComponent setTelecom(List<ContactPoint> theTelecom) {
161      this.telecom = theTelecom;
162      return this;
163    }
164
165    public boolean hasTelecom() {
166      if (this.telecom == null)
167        return false;
168      for (ContactPoint item : this.telecom)
169        if (!item.isEmpty())
170          return true;
171      return false;
172    }
173
174    public ContactPoint addTelecom() { // 3
175      ContactPoint t = new ContactPoint();
176      if (this.telecom == null)
177        this.telecom = new ArrayList<ContactPoint>();
178      this.telecom.add(t);
179      return t;
180    }
181
182    public InsurancePlanContactComponent addTelecom(ContactPoint t) { // 3
183      if (t == null)
184        return this;
185      if (this.telecom == null)
186        this.telecom = new ArrayList<ContactPoint>();
187      this.telecom.add(t);
188      return this;
189    }
190
191    /**
192     * @return The first repetition of repeating field {@link #telecom}, creating it
193     *         if it does not already exist
194     */
195    public ContactPoint getTelecomFirstRep() {
196      if (getTelecom().isEmpty()) {
197        addTelecom();
198      }
199      return getTelecom().get(0);
200    }
201
202    /**
203     * @return {@link #address} (Visiting or postal addresses for the contact.)
204     */
205    public Address getAddress() {
206      if (this.address == null)
207        if (Configuration.errorOnAutoCreate())
208          throw new Error("Attempt to auto-create InsurancePlanContactComponent.address");
209        else if (Configuration.doAutoCreate())
210          this.address = new Address(); // cc
211      return this.address;
212    }
213
214    public boolean hasAddress() {
215      return this.address != null && !this.address.isEmpty();
216    }
217
218    /**
219     * @param value {@link #address} (Visiting or postal addresses for the contact.)
220     */
221    public InsurancePlanContactComponent setAddress(Address value) {
222      this.address = value;
223      return this;
224    }
225
226    protected void listChildren(List<Property> children) {
227      super.listChildren(children);
228      children.add(new Property("purpose", "CodeableConcept",
229          "Indicates a purpose for which the contact can be reached.", 0, 1, purpose));
230      children.add(new Property("name", "HumanName", "A name associated with the contact.", 0, 1, name));
231      children.add(new Property("telecom", "ContactPoint",
232          "A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.", 0,
233          java.lang.Integer.MAX_VALUE, telecom));
234      children.add(new Property("address", "Address", "Visiting or postal addresses for the contact.", 0, 1, address));
235    }
236
237    @Override
238    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
239      switch (_hash) {
240      case -220463842:
241        /* purpose */ return new Property("purpose", "CodeableConcept",
242            "Indicates a purpose for which the contact can be reached.", 0, 1, purpose);
243      case 3373707:
244        /* name */ return new Property("name", "HumanName", "A name associated with the contact.", 0, 1, name);
245      case -1429363305:
246        /* telecom */ return new Property("telecom", "ContactPoint",
247            "A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.", 0,
248            java.lang.Integer.MAX_VALUE, telecom);
249      case -1147692044:
250        /* address */ return new Property("address", "Address", "Visiting or postal addresses for the contact.", 0, 1,
251            address);
252      default:
253        return super.getNamedProperty(_hash, _name, _checkValid);
254      }
255
256    }
257
258    @Override
259    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
260      switch (hash) {
261      case -220463842:
262        /* purpose */ return this.purpose == null ? new Base[0] : new Base[] { this.purpose }; // CodeableConcept
263      case 3373707:
264        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // HumanName
265      case -1429363305:
266        /* telecom */ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
267      case -1147692044:
268        /* address */ return this.address == null ? new Base[0] : new Base[] { this.address }; // Address
269      default:
270        return super.getProperty(hash, name, checkValid);
271      }
272
273    }
274
275    @Override
276    public Base setProperty(int hash, String name, Base value) throws FHIRException {
277      switch (hash) {
278      case -220463842: // purpose
279        this.purpose = castToCodeableConcept(value); // CodeableConcept
280        return value;
281      case 3373707: // name
282        this.name = castToHumanName(value); // HumanName
283        return value;
284      case -1429363305: // telecom
285        this.getTelecom().add(castToContactPoint(value)); // ContactPoint
286        return value;
287      case -1147692044: // address
288        this.address = castToAddress(value); // Address
289        return value;
290      default:
291        return super.setProperty(hash, name, value);
292      }
293
294    }
295
296    @Override
297    public Base setProperty(String name, Base value) throws FHIRException {
298      if (name.equals("purpose")) {
299        this.purpose = castToCodeableConcept(value); // CodeableConcept
300      } else if (name.equals("name")) {
301        this.name = castToHumanName(value); // HumanName
302      } else if (name.equals("telecom")) {
303        this.getTelecom().add(castToContactPoint(value));
304      } else if (name.equals("address")) {
305        this.address = castToAddress(value); // Address
306      } else
307        return super.setProperty(name, value);
308      return value;
309    }
310
311  @Override
312  public void removeChild(String name, Base value) throws FHIRException {
313      if (name.equals("purpose")) {
314        this.purpose = null;
315      } else if (name.equals("name")) {
316        this.name = null;
317      } else if (name.equals("telecom")) {
318        this.getTelecom().remove(castToContactPoint(value));
319      } else if (name.equals("address")) {
320        this.address = null;
321      } else
322        super.removeChild(name, value);
323      
324    }
325
326    @Override
327    public Base makeProperty(int hash, String name) throws FHIRException {
328      switch (hash) {
329      case -220463842:
330        return getPurpose();
331      case 3373707:
332        return getName();
333      case -1429363305:
334        return addTelecom();
335      case -1147692044:
336        return getAddress();
337      default:
338        return super.makeProperty(hash, name);
339      }
340
341    }
342
343    @Override
344    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
345      switch (hash) {
346      case -220463842:
347        /* purpose */ return new String[] { "CodeableConcept" };
348      case 3373707:
349        /* name */ return new String[] { "HumanName" };
350      case -1429363305:
351        /* telecom */ return new String[] { "ContactPoint" };
352      case -1147692044:
353        /* address */ return new String[] { "Address" };
354      default:
355        return super.getTypesForProperty(hash, name);
356      }
357
358    }
359
360    @Override
361    public Base addChild(String name) throws FHIRException {
362      if (name.equals("purpose")) {
363        this.purpose = new CodeableConcept();
364        return this.purpose;
365      } else if (name.equals("name")) {
366        this.name = new HumanName();
367        return this.name;
368      } else if (name.equals("telecom")) {
369        return addTelecom();
370      } else if (name.equals("address")) {
371        this.address = new Address();
372        return this.address;
373      } else
374        return super.addChild(name);
375    }
376
377    public InsurancePlanContactComponent copy() {
378      InsurancePlanContactComponent dst = new InsurancePlanContactComponent();
379      copyValues(dst);
380      return dst;
381    }
382
383    public void copyValues(InsurancePlanContactComponent dst) {
384      super.copyValues(dst);
385      dst.purpose = purpose == null ? null : purpose.copy();
386      dst.name = name == null ? null : name.copy();
387      if (telecom != null) {
388        dst.telecom = new ArrayList<ContactPoint>();
389        for (ContactPoint i : telecom)
390          dst.telecom.add(i.copy());
391      }
392      ;
393      dst.address = address == null ? null : address.copy();
394    }
395
396    @Override
397    public boolean equalsDeep(Base other_) {
398      if (!super.equalsDeep(other_))
399        return false;
400      if (!(other_ instanceof InsurancePlanContactComponent))
401        return false;
402      InsurancePlanContactComponent o = (InsurancePlanContactComponent) other_;
403      return compareDeep(purpose, o.purpose, true) && compareDeep(name, o.name, true)
404          && compareDeep(telecom, o.telecom, true) && compareDeep(address, o.address, true);
405    }
406
407    @Override
408    public boolean equalsShallow(Base other_) {
409      if (!super.equalsShallow(other_))
410        return false;
411      if (!(other_ instanceof InsurancePlanContactComponent))
412        return false;
413      InsurancePlanContactComponent o = (InsurancePlanContactComponent) other_;
414      return true;
415    }
416
417    public boolean isEmpty() {
418      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(purpose, name, telecom, address);
419    }
420
421    public String fhirType() {
422      return "InsurancePlan.contact";
423
424    }
425
426  }
427
428  @Block()
429  public static class InsurancePlanCoverageComponent extends BackboneElement implements IBaseBackboneElement {
430    /**
431     * Type of coverage (Medical; Dental; Mental Health; Substance Abuse; Vision;
432     * Drug; Short Term; Long Term Care; Hospice; Home Health).
433     */
434    @Child(name = "type", type = {
435        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
436    @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).")
437    protected CodeableConcept type;
438
439    /**
440     * Reference to the network that providing the type of coverage.
441     */
442    @Child(name = "network", type = {
443        Organization.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
444    @Description(shortDefinition = "What networks provide coverage", formalDefinition = "Reference to the network that providing the type of coverage.")
445    protected List<Reference> network;
446    /**
447     * The actual objects that are the target of the reference (Reference to the
448     * network that providing the type of coverage.)
449     */
450    protected List<Organization> networkTarget;
451
452    /**
453     * Specific benefits under this type of coverage.
454     */
455    @Child(name = "benefit", type = {}, order = 3, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
456    @Description(shortDefinition = "List of benefits", formalDefinition = "Specific benefits under this type of coverage.")
457    protected List<CoverageBenefitComponent> benefit;
458
459    private static final long serialVersionUID = -1186191877L;
460
461    /**
462     * Constructor
463     */
464    public InsurancePlanCoverageComponent() {
465      super();
466    }
467
468    /**
469     * Constructor
470     */
471    public InsurancePlanCoverageComponent(CodeableConcept type) {
472      super();
473      this.type = type;
474    }
475
476    /**
477     * @return {@link #type} (Type of coverage (Medical; Dental; Mental Health;
478     *         Substance Abuse; Vision; Drug; Short Term; Long Term Care; Hospice;
479     *         Home Health).)
480     */
481    public CodeableConcept getType() {
482      if (this.type == null)
483        if (Configuration.errorOnAutoCreate())
484          throw new Error("Attempt to auto-create InsurancePlanCoverageComponent.type");
485        else if (Configuration.doAutoCreate())
486          this.type = new CodeableConcept(); // cc
487      return this.type;
488    }
489
490    public boolean hasType() {
491      return this.type != null && !this.type.isEmpty();
492    }
493
494    /**
495     * @param value {@link #type} (Type of coverage (Medical; Dental; Mental Health;
496     *              Substance Abuse; Vision; Drug; Short Term; Long Term Care;
497     *              Hospice; Home Health).)
498     */
499    public InsurancePlanCoverageComponent setType(CodeableConcept value) {
500      this.type = value;
501      return this;
502    }
503
504    /**
505     * @return {@link #network} (Reference to the network that providing the type of
506     *         coverage.)
507     */
508    public List<Reference> getNetwork() {
509      if (this.network == null)
510        this.network = new ArrayList<Reference>();
511      return this.network;
512    }
513
514    /**
515     * @return Returns a reference to <code>this</code> for easy method chaining
516     */
517    public InsurancePlanCoverageComponent setNetwork(List<Reference> theNetwork) {
518      this.network = theNetwork;
519      return this;
520    }
521
522    public boolean hasNetwork() {
523      if (this.network == null)
524        return false;
525      for (Reference item : this.network)
526        if (!item.isEmpty())
527          return true;
528      return false;
529    }
530
531    public Reference addNetwork() { // 3
532      Reference t = new Reference();
533      if (this.network == null)
534        this.network = new ArrayList<Reference>();
535      this.network.add(t);
536      return t;
537    }
538
539    public InsurancePlanCoverageComponent addNetwork(Reference t) { // 3
540      if (t == null)
541        return this;
542      if (this.network == null)
543        this.network = new ArrayList<Reference>();
544      this.network.add(t);
545      return this;
546    }
547
548    /**
549     * @return The first repetition of repeating field {@link #network}, creating it
550     *         if it does not already exist
551     */
552    public Reference getNetworkFirstRep() {
553      if (getNetwork().isEmpty()) {
554        addNetwork();
555      }
556      return getNetwork().get(0);
557    }
558
559    /**
560     * @deprecated Use Reference#setResource(IBaseResource) instead
561     */
562    @Deprecated
563    public List<Organization> getNetworkTarget() {
564      if (this.networkTarget == null)
565        this.networkTarget = new ArrayList<Organization>();
566      return this.networkTarget;
567    }
568
569    /**
570     * @deprecated Use Reference#setResource(IBaseResource) instead
571     */
572    @Deprecated
573    public Organization addNetworkTarget() {
574      Organization r = new Organization();
575      if (this.networkTarget == null)
576        this.networkTarget = new ArrayList<Organization>();
577      this.networkTarget.add(r);
578      return r;
579    }
580
581    /**
582     * @return {@link #benefit} (Specific benefits under this type of coverage.)
583     */
584    public List<CoverageBenefitComponent> getBenefit() {
585      if (this.benefit == null)
586        this.benefit = new ArrayList<CoverageBenefitComponent>();
587      return this.benefit;
588    }
589
590    /**
591     * @return Returns a reference to <code>this</code> for easy method chaining
592     */
593    public InsurancePlanCoverageComponent setBenefit(List<CoverageBenefitComponent> theBenefit) {
594      this.benefit = theBenefit;
595      return this;
596    }
597
598    public boolean hasBenefit() {
599      if (this.benefit == null)
600        return false;
601      for (CoverageBenefitComponent item : this.benefit)
602        if (!item.isEmpty())
603          return true;
604      return false;
605    }
606
607    public CoverageBenefitComponent addBenefit() { // 3
608      CoverageBenefitComponent t = new CoverageBenefitComponent();
609      if (this.benefit == null)
610        this.benefit = new ArrayList<CoverageBenefitComponent>();
611      this.benefit.add(t);
612      return t;
613    }
614
615    public InsurancePlanCoverageComponent addBenefit(CoverageBenefitComponent t) { // 3
616      if (t == null)
617        return this;
618      if (this.benefit == null)
619        this.benefit = new ArrayList<CoverageBenefitComponent>();
620      this.benefit.add(t);
621      return this;
622    }
623
624    /**
625     * @return The first repetition of repeating field {@link #benefit}, creating it
626     *         if it does not already exist
627     */
628    public CoverageBenefitComponent getBenefitFirstRep() {
629      if (getBenefit().isEmpty()) {
630        addBenefit();
631      }
632      return getBenefit().get(0);
633    }
634
635    protected void listChildren(List<Property> children) {
636      super.listChildren(children);
637      children.add(new Property("type", "CodeableConcept",
638          "Type of coverage  (Medical; Dental; Mental Health; Substance Abuse; Vision; Drug; Short Term; Long Term Care; Hospice; Home Health).",
639          0, 1, type));
640      children.add(new Property("network", "Reference(Organization)",
641          "Reference to the network that providing the type of coverage.", 0, java.lang.Integer.MAX_VALUE, network));
642      children.add(new Property("benefit", "", "Specific benefits under this type of coverage.", 0,
643          java.lang.Integer.MAX_VALUE, benefit));
644    }
645
646    @Override
647    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
648      switch (_hash) {
649      case 3575610:
650        /* type */ return new Property("type", "CodeableConcept",
651            "Type of coverage  (Medical; Dental; Mental Health; Substance Abuse; Vision; Drug; Short Term; Long Term Care; Hospice; Home Health).",
652            0, 1, type);
653      case 1843485230:
654        /* network */ return new Property("network", "Reference(Organization)",
655            "Reference to the network that providing the type of coverage.", 0, java.lang.Integer.MAX_VALUE, network);
656      case -222710633:
657        /* benefit */ return new Property("benefit", "", "Specific benefits under this type of coverage.", 0,
658            java.lang.Integer.MAX_VALUE, benefit);
659      default:
660        return super.getNamedProperty(_hash, _name, _checkValid);
661      }
662
663    }
664
665    @Override
666    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
667      switch (hash) {
668      case 3575610:
669        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
670      case 1843485230:
671        /* network */ return this.network == null ? new Base[0] : this.network.toArray(new Base[this.network.size()]); // Reference
672      case -222710633:
673        /* benefit */ return this.benefit == null ? new Base[0] : this.benefit.toArray(new Base[this.benefit.size()]); // CoverageBenefitComponent
674      default:
675        return super.getProperty(hash, name, checkValid);
676      }
677
678    }
679
680    @Override
681    public Base setProperty(int hash, String name, Base value) throws FHIRException {
682      switch (hash) {
683      case 3575610: // type
684        this.type = castToCodeableConcept(value); // CodeableConcept
685        return value;
686      case 1843485230: // network
687        this.getNetwork().add(castToReference(value)); // Reference
688        return value;
689      case -222710633: // benefit
690        this.getBenefit().add((CoverageBenefitComponent) value); // CoverageBenefitComponent
691        return value;
692      default:
693        return super.setProperty(hash, name, value);
694      }
695
696    }
697
698    @Override
699    public Base setProperty(String name, Base value) throws FHIRException {
700      if (name.equals("type")) {
701        this.type = castToCodeableConcept(value); // CodeableConcept
702      } else if (name.equals("network")) {
703        this.getNetwork().add(castToReference(value));
704      } else if (name.equals("benefit")) {
705        this.getBenefit().add((CoverageBenefitComponent) value);
706      } else
707        return super.setProperty(name, value);
708      return value;
709    }
710
711  @Override
712  public void removeChild(String name, Base value) throws FHIRException {
713      if (name.equals("type")) {
714        this.type = null;
715      } else if (name.equals("network")) {
716        this.getNetwork().remove(castToReference(value));
717      } else if (name.equals("benefit")) {
718        this.getBenefit().remove((CoverageBenefitComponent) value);
719      } else
720        super.removeChild(name, value);
721      
722    }
723
724    @Override
725    public Base makeProperty(int hash, String name) throws FHIRException {
726      switch (hash) {
727      case 3575610:
728        return getType();
729      case 1843485230:
730        return addNetwork();
731      case -222710633:
732        return addBenefit();
733      default:
734        return super.makeProperty(hash, name);
735      }
736
737    }
738
739    @Override
740    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
741      switch (hash) {
742      case 3575610:
743        /* type */ return new String[] { "CodeableConcept" };
744      case 1843485230:
745        /* network */ return new String[] { "Reference" };
746      case -222710633:
747        /* benefit */ return new String[] {};
748      default:
749        return super.getTypesForProperty(hash, name);
750      }
751
752    }
753
754    @Override
755    public Base addChild(String name) throws FHIRException {
756      if (name.equals("type")) {
757        this.type = new CodeableConcept();
758        return this.type;
759      } else if (name.equals("network")) {
760        return addNetwork();
761      } else if (name.equals("benefit")) {
762        return addBenefit();
763      } else
764        return super.addChild(name);
765    }
766
767    public InsurancePlanCoverageComponent copy() {
768      InsurancePlanCoverageComponent dst = new InsurancePlanCoverageComponent();
769      copyValues(dst);
770      return dst;
771    }
772
773    public void copyValues(InsurancePlanCoverageComponent dst) {
774      super.copyValues(dst);
775      dst.type = type == null ? null : type.copy();
776      if (network != null) {
777        dst.network = new ArrayList<Reference>();
778        for (Reference i : network)
779          dst.network.add(i.copy());
780      }
781      ;
782      if (benefit != null) {
783        dst.benefit = new ArrayList<CoverageBenefitComponent>();
784        for (CoverageBenefitComponent i : benefit)
785          dst.benefit.add(i.copy());
786      }
787      ;
788    }
789
790    @Override
791    public boolean equalsDeep(Base other_) {
792      if (!super.equalsDeep(other_))
793        return false;
794      if (!(other_ instanceof InsurancePlanCoverageComponent))
795        return false;
796      InsurancePlanCoverageComponent o = (InsurancePlanCoverageComponent) other_;
797      return compareDeep(type, o.type, true) && compareDeep(network, o.network, true)
798          && compareDeep(benefit, o.benefit, true);
799    }
800
801    @Override
802    public boolean equalsShallow(Base other_) {
803      if (!super.equalsShallow(other_))
804        return false;
805      if (!(other_ instanceof InsurancePlanCoverageComponent))
806        return false;
807      InsurancePlanCoverageComponent o = (InsurancePlanCoverageComponent) other_;
808      return true;
809    }
810
811    public boolean isEmpty() {
812      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, network, benefit);
813    }
814
815    public String fhirType() {
816      return "InsurancePlan.coverage";
817
818    }
819
820  }
821
822  @Block()
823  public static class CoverageBenefitComponent extends BackboneElement implements IBaseBackboneElement {
824    /**
825     * Type of benefit (primary care; speciality care; inpatient; outpatient).
826     */
827    @Child(name = "type", type = {
828        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
829    @Description(shortDefinition = "Type of benefit", formalDefinition = "Type of benefit (primary care; speciality care; inpatient; outpatient).")
830    protected CodeableConcept type;
831
832    /**
833     * The referral requirements to have access/coverage for this benefit.
834     */
835    @Child(name = "requirement", type = {
836        StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
837    @Description(shortDefinition = "Referral requirements", formalDefinition = "The referral requirements to have access/coverage for this benefit.")
838    protected StringType requirement;
839
840    /**
841     * The specific limits on the benefit.
842     */
843    @Child(name = "limit", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
844    @Description(shortDefinition = "Benefit limits", formalDefinition = "The specific limits on the benefit.")
845    protected List<CoverageBenefitLimitComponent> limit;
846
847    private static final long serialVersionUID = -113658449L;
848
849    /**
850     * Constructor
851     */
852    public CoverageBenefitComponent() {
853      super();
854    }
855
856    /**
857     * Constructor
858     */
859    public CoverageBenefitComponent(CodeableConcept type) {
860      super();
861      this.type = type;
862    }
863
864    /**
865     * @return {@link #type} (Type of benefit (primary care; speciality care;
866     *         inpatient; outpatient).)
867     */
868    public CodeableConcept getType() {
869      if (this.type == null)
870        if (Configuration.errorOnAutoCreate())
871          throw new Error("Attempt to auto-create CoverageBenefitComponent.type");
872        else if (Configuration.doAutoCreate())
873          this.type = new CodeableConcept(); // cc
874      return this.type;
875    }
876
877    public boolean hasType() {
878      return this.type != null && !this.type.isEmpty();
879    }
880
881    /**
882     * @param value {@link #type} (Type of benefit (primary care; speciality care;
883     *              inpatient; outpatient).)
884     */
885    public CoverageBenefitComponent setType(CodeableConcept value) {
886      this.type = value;
887      return this;
888    }
889
890    /**
891     * @return {@link #requirement} (The referral requirements to have
892     *         access/coverage for this benefit.). This is the underlying object
893     *         with id, value and extensions. The accessor "getRequirement" gives
894     *         direct access to the value
895     */
896    public StringType getRequirementElement() {
897      if (this.requirement == null)
898        if (Configuration.errorOnAutoCreate())
899          throw new Error("Attempt to auto-create CoverageBenefitComponent.requirement");
900        else if (Configuration.doAutoCreate())
901          this.requirement = new StringType(); // bb
902      return this.requirement;
903    }
904
905    public boolean hasRequirementElement() {
906      return this.requirement != null && !this.requirement.isEmpty();
907    }
908
909    public boolean hasRequirement() {
910      return this.requirement != null && !this.requirement.isEmpty();
911    }
912
913    /**
914     * @param value {@link #requirement} (The referral requirements to have
915     *              access/coverage for this benefit.). This is the underlying
916     *              object with id, value and extensions. The accessor
917     *              "getRequirement" gives direct access to the value
918     */
919    public CoverageBenefitComponent setRequirementElement(StringType value) {
920      this.requirement = value;
921      return this;
922    }
923
924    /**
925     * @return The referral requirements to have access/coverage for this benefit.
926     */
927    public String getRequirement() {
928      return this.requirement == null ? null : this.requirement.getValue();
929    }
930
931    /**
932     * @param value The referral requirements to have access/coverage for this
933     *              benefit.
934     */
935    public CoverageBenefitComponent setRequirement(String value) {
936      if (Utilities.noString(value))
937        this.requirement = null;
938      else {
939        if (this.requirement == null)
940          this.requirement = new StringType();
941        this.requirement.setValue(value);
942      }
943      return this;
944    }
945
946    /**
947     * @return {@link #limit} (The specific limits on the benefit.)
948     */
949    public List<CoverageBenefitLimitComponent> getLimit() {
950      if (this.limit == null)
951        this.limit = new ArrayList<CoverageBenefitLimitComponent>();
952      return this.limit;
953    }
954
955    /**
956     * @return Returns a reference to <code>this</code> for easy method chaining
957     */
958    public CoverageBenefitComponent setLimit(List<CoverageBenefitLimitComponent> theLimit) {
959      this.limit = theLimit;
960      return this;
961    }
962
963    public boolean hasLimit() {
964      if (this.limit == null)
965        return false;
966      for (CoverageBenefitLimitComponent item : this.limit)
967        if (!item.isEmpty())
968          return true;
969      return false;
970    }
971
972    public CoverageBenefitLimitComponent addLimit() { // 3
973      CoverageBenefitLimitComponent t = new CoverageBenefitLimitComponent();
974      if (this.limit == null)
975        this.limit = new ArrayList<CoverageBenefitLimitComponent>();
976      this.limit.add(t);
977      return t;
978    }
979
980    public CoverageBenefitComponent addLimit(CoverageBenefitLimitComponent t) { // 3
981      if (t == null)
982        return this;
983      if (this.limit == null)
984        this.limit = new ArrayList<CoverageBenefitLimitComponent>();
985      this.limit.add(t);
986      return this;
987    }
988
989    /**
990     * @return The first repetition of repeating field {@link #limit}, creating it
991     *         if it does not already exist
992     */
993    public CoverageBenefitLimitComponent getLimitFirstRep() {
994      if (getLimit().isEmpty()) {
995        addLimit();
996      }
997      return getLimit().get(0);
998    }
999
1000    protected void listChildren(List<Property> children) {
1001      super.listChildren(children);
1002      children.add(new Property("type", "CodeableConcept",
1003          "Type of benefit (primary care; speciality care; inpatient; outpatient).", 0, 1, type));
1004      children.add(new Property("requirement", "string",
1005          "The referral requirements to have access/coverage for this benefit.", 0, 1, requirement));
1006      children
1007          .add(new Property("limit", "", "The specific limits on the benefit.", 0, java.lang.Integer.MAX_VALUE, limit));
1008    }
1009
1010    @Override
1011    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1012      switch (_hash) {
1013      case 3575610:
1014        /* type */ return new Property("type", "CodeableConcept",
1015            "Type of benefit (primary care; speciality care; inpatient; outpatient).", 0, 1, type);
1016      case 363387971:
1017        /* requirement */ return new Property("requirement", "string",
1018            "The referral requirements to have access/coverage for this benefit.", 0, 1, requirement);
1019      case 102976443:
1020        /* limit */ return new Property("limit", "", "The specific limits on the benefit.", 0,
1021            java.lang.Integer.MAX_VALUE, limit);
1022      default:
1023        return super.getNamedProperty(_hash, _name, _checkValid);
1024      }
1025
1026    }
1027
1028    @Override
1029    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1030      switch (hash) {
1031      case 3575610:
1032        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1033      case 363387971:
1034        /* requirement */ return this.requirement == null ? new Base[0] : new Base[] { this.requirement }; // StringType
1035      case 102976443:
1036        /* limit */ return this.limit == null ? new Base[0] : this.limit.toArray(new Base[this.limit.size()]); // CoverageBenefitLimitComponent
1037      default:
1038        return super.getProperty(hash, name, checkValid);
1039      }
1040
1041    }
1042
1043    @Override
1044    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1045      switch (hash) {
1046      case 3575610: // type
1047        this.type = castToCodeableConcept(value); // CodeableConcept
1048        return value;
1049      case 363387971: // requirement
1050        this.requirement = castToString(value); // StringType
1051        return value;
1052      case 102976443: // limit
1053        this.getLimit().add((CoverageBenefitLimitComponent) value); // CoverageBenefitLimitComponent
1054        return value;
1055      default:
1056        return super.setProperty(hash, name, value);
1057      }
1058
1059    }
1060
1061    @Override
1062    public Base setProperty(String name, Base value) throws FHIRException {
1063      if (name.equals("type")) {
1064        this.type = castToCodeableConcept(value); // CodeableConcept
1065      } else if (name.equals("requirement")) {
1066        this.requirement = castToString(value); // StringType
1067      } else if (name.equals("limit")) {
1068        this.getLimit().add((CoverageBenefitLimitComponent) value);
1069      } else
1070        return super.setProperty(name, value);
1071      return value;
1072    }
1073
1074  @Override
1075  public void removeChild(String name, Base value) throws FHIRException {
1076      if (name.equals("type")) {
1077        this.type = null;
1078      } else if (name.equals("requirement")) {
1079        this.requirement = null;
1080      } else if (name.equals("limit")) {
1081        this.getLimit().remove((CoverageBenefitLimitComponent) value);
1082      } else
1083        super.removeChild(name, value);
1084      
1085    }
1086
1087    @Override
1088    public Base makeProperty(int hash, String name) throws FHIRException {
1089      switch (hash) {
1090      case 3575610:
1091        return getType();
1092      case 363387971:
1093        return getRequirementElement();
1094      case 102976443:
1095        return addLimit();
1096      default:
1097        return super.makeProperty(hash, name);
1098      }
1099
1100    }
1101
1102    @Override
1103    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1104      switch (hash) {
1105      case 3575610:
1106        /* type */ return new String[] { "CodeableConcept" };
1107      case 363387971:
1108        /* requirement */ return new String[] { "string" };
1109      case 102976443:
1110        /* limit */ return new String[] {};
1111      default:
1112        return super.getTypesForProperty(hash, name);
1113      }
1114
1115    }
1116
1117    @Override
1118    public Base addChild(String name) throws FHIRException {
1119      if (name.equals("type")) {
1120        this.type = new CodeableConcept();
1121        return this.type;
1122      } else if (name.equals("requirement")) {
1123        throw new FHIRException("Cannot call addChild on a singleton property InsurancePlan.requirement");
1124      } else if (name.equals("limit")) {
1125        return addLimit();
1126      } else
1127        return super.addChild(name);
1128    }
1129
1130    public CoverageBenefitComponent copy() {
1131      CoverageBenefitComponent dst = new CoverageBenefitComponent();
1132      copyValues(dst);
1133      return dst;
1134    }
1135
1136    public void copyValues(CoverageBenefitComponent dst) {
1137      super.copyValues(dst);
1138      dst.type = type == null ? null : type.copy();
1139      dst.requirement = requirement == null ? null : requirement.copy();
1140      if (limit != null) {
1141        dst.limit = new ArrayList<CoverageBenefitLimitComponent>();
1142        for (CoverageBenefitLimitComponent i : limit)
1143          dst.limit.add(i.copy());
1144      }
1145      ;
1146    }
1147
1148    @Override
1149    public boolean equalsDeep(Base other_) {
1150      if (!super.equalsDeep(other_))
1151        return false;
1152      if (!(other_ instanceof CoverageBenefitComponent))
1153        return false;
1154      CoverageBenefitComponent o = (CoverageBenefitComponent) other_;
1155      return compareDeep(type, o.type, true) && compareDeep(requirement, o.requirement, true)
1156          && compareDeep(limit, o.limit, true);
1157    }
1158
1159    @Override
1160    public boolean equalsShallow(Base other_) {
1161      if (!super.equalsShallow(other_))
1162        return false;
1163      if (!(other_ instanceof CoverageBenefitComponent))
1164        return false;
1165      CoverageBenefitComponent o = (CoverageBenefitComponent) other_;
1166      return compareValues(requirement, o.requirement, true);
1167    }
1168
1169    public boolean isEmpty() {
1170      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, requirement, limit);
1171    }
1172
1173    public String fhirType() {
1174      return "InsurancePlan.coverage.benefit";
1175
1176    }
1177
1178  }
1179
1180  @Block()
1181  public static class CoverageBenefitLimitComponent extends BackboneElement implements IBaseBackboneElement {
1182    /**
1183     * The maximum amount of a service item a plan will pay for a covered benefit.
1184     * For examples. wellness visits, or eyeglasses.
1185     */
1186    @Child(name = "value", type = { Quantity.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
1187    @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.")
1188    protected Quantity value;
1189
1190    /**
1191     * The specific limit on the benefit.
1192     */
1193    @Child(name = "code", type = {
1194        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1195    @Description(shortDefinition = "Benefit limit details", formalDefinition = "The specific limit on the benefit.")
1196    protected CodeableConcept code;
1197
1198    private static final long serialVersionUID = -304318128L;
1199
1200    /**
1201     * Constructor
1202     */
1203    public CoverageBenefitLimitComponent() {
1204      super();
1205    }
1206
1207    /**
1208     * @return {@link #value} (The maximum amount of a service item a plan will pay
1209     *         for a covered benefit. For examples. wellness visits, or eyeglasses.)
1210     */
1211    public Quantity getValue() {
1212      if (this.value == null)
1213        if (Configuration.errorOnAutoCreate())
1214          throw new Error("Attempt to auto-create CoverageBenefitLimitComponent.value");
1215        else if (Configuration.doAutoCreate())
1216          this.value = new Quantity(); // cc
1217      return this.value;
1218    }
1219
1220    public boolean hasValue() {
1221      return this.value != null && !this.value.isEmpty();
1222    }
1223
1224    /**
1225     * @param value {@link #value} (The maximum amount of a service item a plan will
1226     *              pay for a covered benefit. For examples. wellness visits, or
1227     *              eyeglasses.)
1228     */
1229    public CoverageBenefitLimitComponent setValue(Quantity value) {
1230      this.value = value;
1231      return this;
1232    }
1233
1234    /**
1235     * @return {@link #code} (The specific limit on the benefit.)
1236     */
1237    public CodeableConcept getCode() {
1238      if (this.code == null)
1239        if (Configuration.errorOnAutoCreate())
1240          throw new Error("Attempt to auto-create CoverageBenefitLimitComponent.code");
1241        else if (Configuration.doAutoCreate())
1242          this.code = new CodeableConcept(); // cc
1243      return this.code;
1244    }
1245
1246    public boolean hasCode() {
1247      return this.code != null && !this.code.isEmpty();
1248    }
1249
1250    /**
1251     * @param value {@link #code} (The specific limit on the benefit.)
1252     */
1253    public CoverageBenefitLimitComponent setCode(CodeableConcept value) {
1254      this.code = value;
1255      return this;
1256    }
1257
1258    protected void listChildren(List<Property> children) {
1259      super.listChildren(children);
1260      children.add(new Property("value", "Quantity",
1261          "The maximum amount of a service item a plan will pay for a covered benefit.  For examples. wellness visits, or eyeglasses.",
1262          0, 1, value));
1263      children.add(new Property("code", "CodeableConcept", "The specific limit on the benefit.", 0, 1, code));
1264    }
1265
1266    @Override
1267    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1268      switch (_hash) {
1269      case 111972721:
1270        /* value */ return new Property("value", "Quantity",
1271            "The maximum amount of a service item a plan will pay for a covered benefit.  For examples. wellness visits, or eyeglasses.",
1272            0, 1, value);
1273      case 3059181:
1274        /* code */ return new Property("code", "CodeableConcept", "The specific limit on the benefit.", 0, 1, code);
1275      default:
1276        return super.getNamedProperty(_hash, _name, _checkValid);
1277      }
1278
1279    }
1280
1281    @Override
1282    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1283      switch (hash) {
1284      case 111972721:
1285        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Quantity
1286      case 3059181:
1287        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
1288      default:
1289        return super.getProperty(hash, name, checkValid);
1290      }
1291
1292    }
1293
1294    @Override
1295    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1296      switch (hash) {
1297      case 111972721: // value
1298        this.value = castToQuantity(value); // Quantity
1299        return value;
1300      case 3059181: // code
1301        this.code = castToCodeableConcept(value); // CodeableConcept
1302        return value;
1303      default:
1304        return super.setProperty(hash, name, value);
1305      }
1306
1307    }
1308
1309    @Override
1310    public Base setProperty(String name, Base value) throws FHIRException {
1311      if (name.equals("value")) {
1312        this.value = castToQuantity(value); // Quantity
1313      } else if (name.equals("code")) {
1314        this.code = castToCodeableConcept(value); // CodeableConcept
1315      } else
1316        return super.setProperty(name, value);
1317      return value;
1318    }
1319
1320  @Override
1321  public void removeChild(String name, Base value) throws FHIRException {
1322      if (name.equals("value")) {
1323        this.value = null;
1324      } else if (name.equals("code")) {
1325        this.code = null;
1326      } else
1327        super.removeChild(name, value);
1328      
1329    }
1330
1331    @Override
1332    public Base makeProperty(int hash, String name) throws FHIRException {
1333      switch (hash) {
1334      case 111972721:
1335        return getValue();
1336      case 3059181:
1337        return getCode();
1338      default:
1339        return super.makeProperty(hash, name);
1340      }
1341
1342    }
1343
1344    @Override
1345    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1346      switch (hash) {
1347      case 111972721:
1348        /* value */ return new String[] { "Quantity" };
1349      case 3059181:
1350        /* code */ return new String[] { "CodeableConcept" };
1351      default:
1352        return super.getTypesForProperty(hash, name);
1353      }
1354
1355    }
1356
1357    @Override
1358    public Base addChild(String name) throws FHIRException {
1359      if (name.equals("value")) {
1360        this.value = new Quantity();
1361        return this.value;
1362      } else if (name.equals("code")) {
1363        this.code = new CodeableConcept();
1364        return this.code;
1365      } else
1366        return super.addChild(name);
1367    }
1368
1369    public CoverageBenefitLimitComponent copy() {
1370      CoverageBenefitLimitComponent dst = new CoverageBenefitLimitComponent();
1371      copyValues(dst);
1372      return dst;
1373    }
1374
1375    public void copyValues(CoverageBenefitLimitComponent dst) {
1376      super.copyValues(dst);
1377      dst.value = value == null ? null : value.copy();
1378      dst.code = code == null ? null : code.copy();
1379    }
1380
1381    @Override
1382    public boolean equalsDeep(Base other_) {
1383      if (!super.equalsDeep(other_))
1384        return false;
1385      if (!(other_ instanceof CoverageBenefitLimitComponent))
1386        return false;
1387      CoverageBenefitLimitComponent o = (CoverageBenefitLimitComponent) other_;
1388      return compareDeep(value, o.value, true) && compareDeep(code, o.code, true);
1389    }
1390
1391    @Override
1392    public boolean equalsShallow(Base other_) {
1393      if (!super.equalsShallow(other_))
1394        return false;
1395      if (!(other_ instanceof CoverageBenefitLimitComponent))
1396        return false;
1397      CoverageBenefitLimitComponent o = (CoverageBenefitLimitComponent) other_;
1398      return true;
1399    }
1400
1401    public boolean isEmpty() {
1402      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, code);
1403    }
1404
1405    public String fhirType() {
1406      return "InsurancePlan.coverage.benefit.limit";
1407
1408    }
1409
1410  }
1411
1412  @Block()
1413  public static class InsurancePlanPlanComponent extends BackboneElement implements IBaseBackboneElement {
1414    /**
1415     * Business identifiers assigned to this health insurance plan which remain
1416     * constant as the resource is updated and propagates from server to server.
1417     */
1418    @Child(name = "identifier", type = {
1419        Identifier.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1420    @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.")
1421    protected List<Identifier> identifier;
1422
1423    /**
1424     * Type of plan. For example, "Platinum" or "High Deductable".
1425     */
1426    @Child(name = "type", type = {
1427        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1428    @Description(shortDefinition = "Type of plan", formalDefinition = "Type of plan. For example, \"Platinum\" or \"High Deductable\".")
1429    protected CodeableConcept type;
1430
1431    /**
1432     * The geographic region in which a health insurance plan's benefits apply.
1433     */
1434    @Child(name = "coverageArea", type = {
1435        Location.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1436    @Description(shortDefinition = "Where product applies", formalDefinition = "The geographic region in which a health insurance plan's benefits apply.")
1437    protected List<Reference> coverageArea;
1438    /**
1439     * The actual objects that are the target of the reference (The geographic
1440     * region in which a health insurance plan's benefits apply.)
1441     */
1442    protected List<Location> coverageAreaTarget;
1443
1444    /**
1445     * Reference to the network that providing the type of coverage.
1446     */
1447    @Child(name = "network", type = {
1448        Organization.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1449    @Description(shortDefinition = "What networks provide coverage", formalDefinition = "Reference to the network that providing the type of coverage.")
1450    protected List<Reference> network;
1451    /**
1452     * The actual objects that are the target of the reference (Reference to the
1453     * network that providing the type of coverage.)
1454     */
1455    protected List<Organization> networkTarget;
1456
1457    /**
1458     * Overall costs associated with the plan.
1459     */
1460    @Child(name = "generalCost", type = {}, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1461    @Description(shortDefinition = "Overall costs", formalDefinition = "Overall costs associated with the plan.")
1462    protected List<InsurancePlanPlanGeneralCostComponent> generalCost;
1463
1464    /**
1465     * Costs associated with the coverage provided by the product.
1466     */
1467    @Child(name = "specificCost", type = {}, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1468    @Description(shortDefinition = "Specific costs", formalDefinition = "Costs associated with the coverage provided by the product.")
1469    protected List<InsurancePlanPlanSpecificCostComponent> specificCost;
1470
1471    private static final long serialVersionUID = -2063324071L;
1472
1473    /**
1474     * Constructor
1475     */
1476    public InsurancePlanPlanComponent() {
1477      super();
1478    }
1479
1480    /**
1481     * @return {@link #identifier} (Business identifiers assigned to this health
1482     *         insurance plan which remain constant as the resource is updated and
1483     *         propagates from server to server.)
1484     */
1485    public List<Identifier> getIdentifier() {
1486      if (this.identifier == null)
1487        this.identifier = new ArrayList<Identifier>();
1488      return this.identifier;
1489    }
1490
1491    /**
1492     * @return Returns a reference to <code>this</code> for easy method chaining
1493     */
1494    public InsurancePlanPlanComponent setIdentifier(List<Identifier> theIdentifier) {
1495      this.identifier = theIdentifier;
1496      return this;
1497    }
1498
1499    public boolean hasIdentifier() {
1500      if (this.identifier == null)
1501        return false;
1502      for (Identifier item : this.identifier)
1503        if (!item.isEmpty())
1504          return true;
1505      return false;
1506    }
1507
1508    public Identifier addIdentifier() { // 3
1509      Identifier t = new Identifier();
1510      if (this.identifier == null)
1511        this.identifier = new ArrayList<Identifier>();
1512      this.identifier.add(t);
1513      return t;
1514    }
1515
1516    public InsurancePlanPlanComponent addIdentifier(Identifier t) { // 3
1517      if (t == null)
1518        return this;
1519      if (this.identifier == null)
1520        this.identifier = new ArrayList<Identifier>();
1521      this.identifier.add(t);
1522      return this;
1523    }
1524
1525    /**
1526     * @return The first repetition of repeating field {@link #identifier}, creating
1527     *         it if it does not already exist
1528     */
1529    public Identifier getIdentifierFirstRep() {
1530      if (getIdentifier().isEmpty()) {
1531        addIdentifier();
1532      }
1533      return getIdentifier().get(0);
1534    }
1535
1536    /**
1537     * @return {@link #type} (Type of plan. For example, "Platinum" or "High
1538     *         Deductable".)
1539     */
1540    public CodeableConcept getType() {
1541      if (this.type == null)
1542        if (Configuration.errorOnAutoCreate())
1543          throw new Error("Attempt to auto-create InsurancePlanPlanComponent.type");
1544        else if (Configuration.doAutoCreate())
1545          this.type = new CodeableConcept(); // cc
1546      return this.type;
1547    }
1548
1549    public boolean hasType() {
1550      return this.type != null && !this.type.isEmpty();
1551    }
1552
1553    /**
1554     * @param value {@link #type} (Type of plan. For example, "Platinum" or "High
1555     *              Deductable".)
1556     */
1557    public InsurancePlanPlanComponent setType(CodeableConcept value) {
1558      this.type = value;
1559      return this;
1560    }
1561
1562    /**
1563     * @return {@link #coverageArea} (The geographic region in which a health
1564     *         insurance plan's benefits apply.)
1565     */
1566    public List<Reference> getCoverageArea() {
1567      if (this.coverageArea == null)
1568        this.coverageArea = new ArrayList<Reference>();
1569      return this.coverageArea;
1570    }
1571
1572    /**
1573     * @return Returns a reference to <code>this</code> for easy method chaining
1574     */
1575    public InsurancePlanPlanComponent setCoverageArea(List<Reference> theCoverageArea) {
1576      this.coverageArea = theCoverageArea;
1577      return this;
1578    }
1579
1580    public boolean hasCoverageArea() {
1581      if (this.coverageArea == null)
1582        return false;
1583      for (Reference item : this.coverageArea)
1584        if (!item.isEmpty())
1585          return true;
1586      return false;
1587    }
1588
1589    public Reference addCoverageArea() { // 3
1590      Reference t = new Reference();
1591      if (this.coverageArea == null)
1592        this.coverageArea = new ArrayList<Reference>();
1593      this.coverageArea.add(t);
1594      return t;
1595    }
1596
1597    public InsurancePlanPlanComponent addCoverageArea(Reference t) { // 3
1598      if (t == null)
1599        return this;
1600      if (this.coverageArea == null)
1601        this.coverageArea = new ArrayList<Reference>();
1602      this.coverageArea.add(t);
1603      return this;
1604    }
1605
1606    /**
1607     * @return The first repetition of repeating field {@link #coverageArea},
1608     *         creating it if it does not already exist
1609     */
1610    public Reference getCoverageAreaFirstRep() {
1611      if (getCoverageArea().isEmpty()) {
1612        addCoverageArea();
1613      }
1614      return getCoverageArea().get(0);
1615    }
1616
1617    /**
1618     * @deprecated Use Reference#setResource(IBaseResource) instead
1619     */
1620    @Deprecated
1621    public List<Location> getCoverageAreaTarget() {
1622      if (this.coverageAreaTarget == null)
1623        this.coverageAreaTarget = new ArrayList<Location>();
1624      return this.coverageAreaTarget;
1625    }
1626
1627    /**
1628     * @deprecated Use Reference#setResource(IBaseResource) instead
1629     */
1630    @Deprecated
1631    public Location addCoverageAreaTarget() {
1632      Location r = new Location();
1633      if (this.coverageAreaTarget == null)
1634        this.coverageAreaTarget = new ArrayList<Location>();
1635      this.coverageAreaTarget.add(r);
1636      return r;
1637    }
1638
1639    /**
1640     * @return {@link #network} (Reference to the network that providing the type of
1641     *         coverage.)
1642     */
1643    public List<Reference> getNetwork() {
1644      if (this.network == null)
1645        this.network = new ArrayList<Reference>();
1646      return this.network;
1647    }
1648
1649    /**
1650     * @return Returns a reference to <code>this</code> for easy method chaining
1651     */
1652    public InsurancePlanPlanComponent setNetwork(List<Reference> theNetwork) {
1653      this.network = theNetwork;
1654      return this;
1655    }
1656
1657    public boolean hasNetwork() {
1658      if (this.network == null)
1659        return false;
1660      for (Reference item : this.network)
1661        if (!item.isEmpty())
1662          return true;
1663      return false;
1664    }
1665
1666    public Reference addNetwork() { // 3
1667      Reference t = new Reference();
1668      if (this.network == null)
1669        this.network = new ArrayList<Reference>();
1670      this.network.add(t);
1671      return t;
1672    }
1673
1674    public InsurancePlanPlanComponent addNetwork(Reference t) { // 3
1675      if (t == null)
1676        return this;
1677      if (this.network == null)
1678        this.network = new ArrayList<Reference>();
1679      this.network.add(t);
1680      return this;
1681    }
1682
1683    /**
1684     * @return The first repetition of repeating field {@link #network}, creating it
1685     *         if it does not already exist
1686     */
1687    public Reference getNetworkFirstRep() {
1688      if (getNetwork().isEmpty()) {
1689        addNetwork();
1690      }
1691      return getNetwork().get(0);
1692    }
1693
1694    /**
1695     * @deprecated Use Reference#setResource(IBaseResource) instead
1696     */
1697    @Deprecated
1698    public List<Organization> getNetworkTarget() {
1699      if (this.networkTarget == null)
1700        this.networkTarget = new ArrayList<Organization>();
1701      return this.networkTarget;
1702    }
1703
1704    /**
1705     * @deprecated Use Reference#setResource(IBaseResource) instead
1706     */
1707    @Deprecated
1708    public Organization addNetworkTarget() {
1709      Organization r = new Organization();
1710      if (this.networkTarget == null)
1711        this.networkTarget = new ArrayList<Organization>();
1712      this.networkTarget.add(r);
1713      return r;
1714    }
1715
1716    /**
1717     * @return {@link #generalCost} (Overall costs associated with the plan.)
1718     */
1719    public List<InsurancePlanPlanGeneralCostComponent> getGeneralCost() {
1720      if (this.generalCost == null)
1721        this.generalCost = new ArrayList<InsurancePlanPlanGeneralCostComponent>();
1722      return this.generalCost;
1723    }
1724
1725    /**
1726     * @return Returns a reference to <code>this</code> for easy method chaining
1727     */
1728    public InsurancePlanPlanComponent setGeneralCost(List<InsurancePlanPlanGeneralCostComponent> theGeneralCost) {
1729      this.generalCost = theGeneralCost;
1730      return this;
1731    }
1732
1733    public boolean hasGeneralCost() {
1734      if (this.generalCost == null)
1735        return false;
1736      for (InsurancePlanPlanGeneralCostComponent item : this.generalCost)
1737        if (!item.isEmpty())
1738          return true;
1739      return false;
1740    }
1741
1742    public InsurancePlanPlanGeneralCostComponent addGeneralCost() { // 3
1743      InsurancePlanPlanGeneralCostComponent t = new InsurancePlanPlanGeneralCostComponent();
1744      if (this.generalCost == null)
1745        this.generalCost = new ArrayList<InsurancePlanPlanGeneralCostComponent>();
1746      this.generalCost.add(t);
1747      return t;
1748    }
1749
1750    public InsurancePlanPlanComponent addGeneralCost(InsurancePlanPlanGeneralCostComponent t) { // 3
1751      if (t == null)
1752        return this;
1753      if (this.generalCost == null)
1754        this.generalCost = new ArrayList<InsurancePlanPlanGeneralCostComponent>();
1755      this.generalCost.add(t);
1756      return this;
1757    }
1758
1759    /**
1760     * @return The first repetition of repeating field {@link #generalCost},
1761     *         creating it if it does not already exist
1762     */
1763    public InsurancePlanPlanGeneralCostComponent getGeneralCostFirstRep() {
1764      if (getGeneralCost().isEmpty()) {
1765        addGeneralCost();
1766      }
1767      return getGeneralCost().get(0);
1768    }
1769
1770    /**
1771     * @return {@link #specificCost} (Costs associated with the coverage provided by
1772     *         the product.)
1773     */
1774    public List<InsurancePlanPlanSpecificCostComponent> getSpecificCost() {
1775      if (this.specificCost == null)
1776        this.specificCost = new ArrayList<InsurancePlanPlanSpecificCostComponent>();
1777      return this.specificCost;
1778    }
1779
1780    /**
1781     * @return Returns a reference to <code>this</code> for easy method chaining
1782     */
1783    public InsurancePlanPlanComponent setSpecificCost(List<InsurancePlanPlanSpecificCostComponent> theSpecificCost) {
1784      this.specificCost = theSpecificCost;
1785      return this;
1786    }
1787
1788    public boolean hasSpecificCost() {
1789      if (this.specificCost == null)
1790        return false;
1791      for (InsurancePlanPlanSpecificCostComponent item : this.specificCost)
1792        if (!item.isEmpty())
1793          return true;
1794      return false;
1795    }
1796
1797    public InsurancePlanPlanSpecificCostComponent addSpecificCost() { // 3
1798      InsurancePlanPlanSpecificCostComponent t = new InsurancePlanPlanSpecificCostComponent();
1799      if (this.specificCost == null)
1800        this.specificCost = new ArrayList<InsurancePlanPlanSpecificCostComponent>();
1801      this.specificCost.add(t);
1802      return t;
1803    }
1804
1805    public InsurancePlanPlanComponent addSpecificCost(InsurancePlanPlanSpecificCostComponent t) { // 3
1806      if (t == null)
1807        return this;
1808      if (this.specificCost == null)
1809        this.specificCost = new ArrayList<InsurancePlanPlanSpecificCostComponent>();
1810      this.specificCost.add(t);
1811      return this;
1812    }
1813
1814    /**
1815     * @return The first repetition of repeating field {@link #specificCost},
1816     *         creating it if it does not already exist
1817     */
1818    public InsurancePlanPlanSpecificCostComponent getSpecificCostFirstRep() {
1819      if (getSpecificCost().isEmpty()) {
1820        addSpecificCost();
1821      }
1822      return getSpecificCost().get(0);
1823    }
1824
1825    protected void listChildren(List<Property> children) {
1826      super.listChildren(children);
1827      children.add(new Property("identifier", "Identifier",
1828          "Business identifiers assigned to this health insurance plan which remain constant as the resource is updated and propagates from server to server.",
1829          0, java.lang.Integer.MAX_VALUE, identifier));
1830      children.add(new Property("type", "CodeableConcept",
1831          "Type of plan. For example, \"Platinum\" or \"High Deductable\".", 0, 1, type));
1832      children.add(new Property("coverageArea", "Reference(Location)",
1833          "The geographic region in which a health insurance plan's benefits apply.", 0, java.lang.Integer.MAX_VALUE,
1834          coverageArea));
1835      children.add(new Property("network", "Reference(Organization)",
1836          "Reference to the network that providing the type of coverage.", 0, java.lang.Integer.MAX_VALUE, network));
1837      children.add(new Property("generalCost", "", "Overall costs associated with the plan.", 0,
1838          java.lang.Integer.MAX_VALUE, generalCost));
1839      children.add(new Property("specificCost", "", "Costs associated with the coverage provided by the product.", 0,
1840          java.lang.Integer.MAX_VALUE, specificCost));
1841    }
1842
1843    @Override
1844    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1845      switch (_hash) {
1846      case -1618432855:
1847        /* identifier */ return new Property("identifier", "Identifier",
1848            "Business identifiers assigned to this health insurance plan which remain constant as the resource is updated and propagates from server to server.",
1849            0, java.lang.Integer.MAX_VALUE, identifier);
1850      case 3575610:
1851        /* type */ return new Property("type", "CodeableConcept",
1852            "Type of plan. For example, \"Platinum\" or \"High Deductable\".", 0, 1, type);
1853      case -1532328299:
1854        /* coverageArea */ return new Property("coverageArea", "Reference(Location)",
1855            "The geographic region in which a health insurance plan's benefits apply.", 0, java.lang.Integer.MAX_VALUE,
1856            coverageArea);
1857      case 1843485230:
1858        /* network */ return new Property("network", "Reference(Organization)",
1859            "Reference to the network that providing the type of coverage.", 0, java.lang.Integer.MAX_VALUE, network);
1860      case 878344405:
1861        /* generalCost */ return new Property("generalCost", "", "Overall costs associated with the plan.", 0,
1862            java.lang.Integer.MAX_VALUE, generalCost);
1863      case -1205656545:
1864        /* specificCost */ return new Property("specificCost", "",
1865            "Costs associated with the coverage provided by the product.", 0, java.lang.Integer.MAX_VALUE,
1866            specificCost);
1867      default:
1868        return super.getNamedProperty(_hash, _name, _checkValid);
1869      }
1870
1871    }
1872
1873    @Override
1874    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1875      switch (hash) {
1876      case -1618432855:
1877        /* identifier */ return this.identifier == null ? new Base[0]
1878            : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1879      case 3575610:
1880        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1881      case -1532328299:
1882        /* coverageArea */ return this.coverageArea == null ? new Base[0]
1883            : this.coverageArea.toArray(new Base[this.coverageArea.size()]); // Reference
1884      case 1843485230:
1885        /* network */ return this.network == null ? new Base[0] : this.network.toArray(new Base[this.network.size()]); // Reference
1886      case 878344405:
1887        /* generalCost */ return this.generalCost == null ? new Base[0]
1888            : this.generalCost.toArray(new Base[this.generalCost.size()]); // InsurancePlanPlanGeneralCostComponent
1889      case -1205656545:
1890        /* specificCost */ return this.specificCost == null ? new Base[0]
1891            : this.specificCost.toArray(new Base[this.specificCost.size()]); // InsurancePlanPlanSpecificCostComponent
1892      default:
1893        return super.getProperty(hash, name, checkValid);
1894      }
1895
1896    }
1897
1898    @Override
1899    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1900      switch (hash) {
1901      case -1618432855: // identifier
1902        this.getIdentifier().add(castToIdentifier(value)); // Identifier
1903        return value;
1904      case 3575610: // type
1905        this.type = castToCodeableConcept(value); // CodeableConcept
1906        return value;
1907      case -1532328299: // coverageArea
1908        this.getCoverageArea().add(castToReference(value)); // Reference
1909        return value;
1910      case 1843485230: // network
1911        this.getNetwork().add(castToReference(value)); // Reference
1912        return value;
1913      case 878344405: // generalCost
1914        this.getGeneralCost().add((InsurancePlanPlanGeneralCostComponent) value); // InsurancePlanPlanGeneralCostComponent
1915        return value;
1916      case -1205656545: // specificCost
1917        this.getSpecificCost().add((InsurancePlanPlanSpecificCostComponent) value); // InsurancePlanPlanSpecificCostComponent
1918        return value;
1919      default:
1920        return super.setProperty(hash, name, value);
1921      }
1922
1923    }
1924
1925    @Override
1926    public Base setProperty(String name, Base value) throws FHIRException {
1927      if (name.equals("identifier")) {
1928        this.getIdentifier().add(castToIdentifier(value));
1929      } else if (name.equals("type")) {
1930        this.type = castToCodeableConcept(value); // CodeableConcept
1931      } else if (name.equals("coverageArea")) {
1932        this.getCoverageArea().add(castToReference(value));
1933      } else if (name.equals("network")) {
1934        this.getNetwork().add(castToReference(value));
1935      } else if (name.equals("generalCost")) {
1936        this.getGeneralCost().add((InsurancePlanPlanGeneralCostComponent) value);
1937      } else if (name.equals("specificCost")) {
1938        this.getSpecificCost().add((InsurancePlanPlanSpecificCostComponent) value);
1939      } else
1940        return super.setProperty(name, value);
1941      return value;
1942    }
1943
1944  @Override
1945  public void removeChild(String name, Base value) throws FHIRException {
1946      if (name.equals("identifier")) {
1947        this.getIdentifier().remove(castToIdentifier(value));
1948      } else if (name.equals("type")) {
1949        this.type = null;
1950      } else if (name.equals("coverageArea")) {
1951        this.getCoverageArea().remove(castToReference(value));
1952      } else if (name.equals("network")) {
1953        this.getNetwork().remove(castToReference(value));
1954      } else if (name.equals("generalCost")) {
1955        this.getGeneralCost().remove((InsurancePlanPlanGeneralCostComponent) value);
1956      } else if (name.equals("specificCost")) {
1957        this.getSpecificCost().remove((InsurancePlanPlanSpecificCostComponent) value);
1958      } else
1959        super.removeChild(name, value);
1960      
1961    }
1962
1963    @Override
1964    public Base makeProperty(int hash, String name) throws FHIRException {
1965      switch (hash) {
1966      case -1618432855:
1967        return addIdentifier();
1968      case 3575610:
1969        return getType();
1970      case -1532328299:
1971        return addCoverageArea();
1972      case 1843485230:
1973        return addNetwork();
1974      case 878344405:
1975        return addGeneralCost();
1976      case -1205656545:
1977        return addSpecificCost();
1978      default:
1979        return super.makeProperty(hash, name);
1980      }
1981
1982    }
1983
1984    @Override
1985    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1986      switch (hash) {
1987      case -1618432855:
1988        /* identifier */ return new String[] { "Identifier" };
1989      case 3575610:
1990        /* type */ return new String[] { "CodeableConcept" };
1991      case -1532328299:
1992        /* coverageArea */ return new String[] { "Reference" };
1993      case 1843485230:
1994        /* network */ return new String[] { "Reference" };
1995      case 878344405:
1996        /* generalCost */ return new String[] {};
1997      case -1205656545:
1998        /* specificCost */ return new String[] {};
1999      default:
2000        return super.getTypesForProperty(hash, name);
2001      }
2002
2003    }
2004
2005    @Override
2006    public Base addChild(String name) throws FHIRException {
2007      if (name.equals("identifier")) {
2008        return addIdentifier();
2009      } else if (name.equals("type")) {
2010        this.type = new CodeableConcept();
2011        return this.type;
2012      } else if (name.equals("coverageArea")) {
2013        return addCoverageArea();
2014      } else if (name.equals("network")) {
2015        return addNetwork();
2016      } else if (name.equals("generalCost")) {
2017        return addGeneralCost();
2018      } else if (name.equals("specificCost")) {
2019        return addSpecificCost();
2020      } else
2021        return super.addChild(name);
2022    }
2023
2024    public InsurancePlanPlanComponent copy() {
2025      InsurancePlanPlanComponent dst = new InsurancePlanPlanComponent();
2026      copyValues(dst);
2027      return dst;
2028    }
2029
2030    public void copyValues(InsurancePlanPlanComponent dst) {
2031      super.copyValues(dst);
2032      if (identifier != null) {
2033        dst.identifier = new ArrayList<Identifier>();
2034        for (Identifier i : identifier)
2035          dst.identifier.add(i.copy());
2036      }
2037      ;
2038      dst.type = type == null ? null : type.copy();
2039      if (coverageArea != null) {
2040        dst.coverageArea = new ArrayList<Reference>();
2041        for (Reference i : coverageArea)
2042          dst.coverageArea.add(i.copy());
2043      }
2044      ;
2045      if (network != null) {
2046        dst.network = new ArrayList<Reference>();
2047        for (Reference i : network)
2048          dst.network.add(i.copy());
2049      }
2050      ;
2051      if (generalCost != null) {
2052        dst.generalCost = new ArrayList<InsurancePlanPlanGeneralCostComponent>();
2053        for (InsurancePlanPlanGeneralCostComponent i : generalCost)
2054          dst.generalCost.add(i.copy());
2055      }
2056      ;
2057      if (specificCost != null) {
2058        dst.specificCost = new ArrayList<InsurancePlanPlanSpecificCostComponent>();
2059        for (InsurancePlanPlanSpecificCostComponent i : specificCost)
2060          dst.specificCost.add(i.copy());
2061      }
2062      ;
2063    }
2064
2065    @Override
2066    public boolean equalsDeep(Base other_) {
2067      if (!super.equalsDeep(other_))
2068        return false;
2069      if (!(other_ instanceof InsurancePlanPlanComponent))
2070        return false;
2071      InsurancePlanPlanComponent o = (InsurancePlanPlanComponent) other_;
2072      return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true)
2073          && compareDeep(coverageArea, o.coverageArea, true) && compareDeep(network, o.network, true)
2074          && compareDeep(generalCost, o.generalCost, true) && compareDeep(specificCost, o.specificCost, true);
2075    }
2076
2077    @Override
2078    public boolean equalsShallow(Base other_) {
2079      if (!super.equalsShallow(other_))
2080        return false;
2081      if (!(other_ instanceof InsurancePlanPlanComponent))
2082        return false;
2083      InsurancePlanPlanComponent o = (InsurancePlanPlanComponent) other_;
2084      return true;
2085    }
2086
2087    public boolean isEmpty() {
2088      return super.isEmpty()
2089          && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, coverageArea, network, generalCost, specificCost);
2090    }
2091
2092    public String fhirType() {
2093      return "InsurancePlan.plan";
2094
2095    }
2096
2097  }
2098
2099  @Block()
2100  public static class InsurancePlanPlanGeneralCostComponent extends BackboneElement implements IBaseBackboneElement {
2101    /**
2102     * Type of cost.
2103     */
2104    @Child(name = "type", type = {
2105        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
2106    @Description(shortDefinition = "Type of cost", formalDefinition = "Type of cost.")
2107    protected CodeableConcept type;
2108
2109    /**
2110     * Number of participants enrolled in the plan.
2111     */
2112    @Child(name = "groupSize", type = {
2113        PositiveIntType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
2114    @Description(shortDefinition = "Number of enrollees", formalDefinition = "Number of participants enrolled in the plan.")
2115    protected PositiveIntType groupSize;
2116
2117    /**
2118     * Value of the cost.
2119     */
2120    @Child(name = "cost", type = { Money.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
2121    @Description(shortDefinition = "Cost value", formalDefinition = "Value of the cost.")
2122    protected Money cost;
2123
2124    /**
2125     * Additional information about the general costs associated with this plan.
2126     */
2127    @Child(name = "comment", type = {
2128        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
2129    @Description(shortDefinition = "Additional cost information", formalDefinition = "Additional information about the general costs associated with this plan.")
2130    protected StringType comment;
2131
2132    private static final long serialVersionUID = 1563949866L;
2133
2134    /**
2135     * Constructor
2136     */
2137    public InsurancePlanPlanGeneralCostComponent() {
2138      super();
2139    }
2140
2141    /**
2142     * @return {@link #type} (Type of cost.)
2143     */
2144    public CodeableConcept getType() {
2145      if (this.type == null)
2146        if (Configuration.errorOnAutoCreate())
2147          throw new Error("Attempt to auto-create InsurancePlanPlanGeneralCostComponent.type");
2148        else if (Configuration.doAutoCreate())
2149          this.type = new CodeableConcept(); // cc
2150      return this.type;
2151    }
2152
2153    public boolean hasType() {
2154      return this.type != null && !this.type.isEmpty();
2155    }
2156
2157    /**
2158     * @param value {@link #type} (Type of cost.)
2159     */
2160    public InsurancePlanPlanGeneralCostComponent setType(CodeableConcept value) {
2161      this.type = value;
2162      return this;
2163    }
2164
2165    /**
2166     * @return {@link #groupSize} (Number of participants enrolled in the plan.).
2167     *         This is the underlying object with id, value and extensions. The
2168     *         accessor "getGroupSize" gives direct access to the value
2169     */
2170    public PositiveIntType getGroupSizeElement() {
2171      if (this.groupSize == null)
2172        if (Configuration.errorOnAutoCreate())
2173          throw new Error("Attempt to auto-create InsurancePlanPlanGeneralCostComponent.groupSize");
2174        else if (Configuration.doAutoCreate())
2175          this.groupSize = new PositiveIntType(); // bb
2176      return this.groupSize;
2177    }
2178
2179    public boolean hasGroupSizeElement() {
2180      return this.groupSize != null && !this.groupSize.isEmpty();
2181    }
2182
2183    public boolean hasGroupSize() {
2184      return this.groupSize != null && !this.groupSize.isEmpty();
2185    }
2186
2187    /**
2188     * @param value {@link #groupSize} (Number of participants enrolled in the
2189     *              plan.). This is the underlying object with id, value and
2190     *              extensions. The accessor "getGroupSize" gives direct access to
2191     *              the value
2192     */
2193    public InsurancePlanPlanGeneralCostComponent setGroupSizeElement(PositiveIntType value) {
2194      this.groupSize = value;
2195      return this;
2196    }
2197
2198    /**
2199     * @return Number of participants enrolled in the plan.
2200     */
2201    public int getGroupSize() {
2202      return this.groupSize == null || this.groupSize.isEmpty() ? 0 : this.groupSize.getValue();
2203    }
2204
2205    /**
2206     * @param value Number of participants enrolled in the plan.
2207     */
2208    public InsurancePlanPlanGeneralCostComponent setGroupSize(int value) {
2209      if (this.groupSize == null)
2210        this.groupSize = new PositiveIntType();
2211      this.groupSize.setValue(value);
2212      return this;
2213    }
2214
2215    /**
2216     * @return {@link #cost} (Value of the cost.)
2217     */
2218    public Money getCost() {
2219      if (this.cost == null)
2220        if (Configuration.errorOnAutoCreate())
2221          throw new Error("Attempt to auto-create InsurancePlanPlanGeneralCostComponent.cost");
2222        else if (Configuration.doAutoCreate())
2223          this.cost = new Money(); // cc
2224      return this.cost;
2225    }
2226
2227    public boolean hasCost() {
2228      return this.cost != null && !this.cost.isEmpty();
2229    }
2230
2231    /**
2232     * @param value {@link #cost} (Value of the cost.)
2233     */
2234    public InsurancePlanPlanGeneralCostComponent setCost(Money value) {
2235      this.cost = value;
2236      return this;
2237    }
2238
2239    /**
2240     * @return {@link #comment} (Additional information about the general costs
2241     *         associated with this plan.). This is the underlying object with id,
2242     *         value and extensions. The accessor "getComment" gives direct access
2243     *         to the value
2244     */
2245    public StringType getCommentElement() {
2246      if (this.comment == null)
2247        if (Configuration.errorOnAutoCreate())
2248          throw new Error("Attempt to auto-create InsurancePlanPlanGeneralCostComponent.comment");
2249        else if (Configuration.doAutoCreate())
2250          this.comment = new StringType(); // bb
2251      return this.comment;
2252    }
2253
2254    public boolean hasCommentElement() {
2255      return this.comment != null && !this.comment.isEmpty();
2256    }
2257
2258    public boolean hasComment() {
2259      return this.comment != null && !this.comment.isEmpty();
2260    }
2261
2262    /**
2263     * @param value {@link #comment} (Additional information about the general costs
2264     *              associated with this plan.). This is the underlying object with
2265     *              id, value and extensions. The accessor "getComment" gives direct
2266     *              access to the value
2267     */
2268    public InsurancePlanPlanGeneralCostComponent setCommentElement(StringType value) {
2269      this.comment = value;
2270      return this;
2271    }
2272
2273    /**
2274     * @return Additional information about the general costs associated with this
2275     *         plan.
2276     */
2277    public String getComment() {
2278      return this.comment == null ? null : this.comment.getValue();
2279    }
2280
2281    /**
2282     * @param value Additional information about the general costs associated with
2283     *              this plan.
2284     */
2285    public InsurancePlanPlanGeneralCostComponent setComment(String value) {
2286      if (Utilities.noString(value))
2287        this.comment = null;
2288      else {
2289        if (this.comment == null)
2290          this.comment = new StringType();
2291        this.comment.setValue(value);
2292      }
2293      return this;
2294    }
2295
2296    protected void listChildren(List<Property> children) {
2297      super.listChildren(children);
2298      children.add(new Property("type", "CodeableConcept", "Type of cost.", 0, 1, type));
2299      children.add(
2300          new Property("groupSize", "positiveInt", "Number of participants enrolled in the plan.", 0, 1, groupSize));
2301      children.add(new Property("cost", "Money", "Value of the cost.", 0, 1, cost));
2302      children.add(new Property("comment", "string",
2303          "Additional information about the general costs associated with this plan.", 0, 1, comment));
2304    }
2305
2306    @Override
2307    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2308      switch (_hash) {
2309      case 3575610:
2310        /* type */ return new Property("type", "CodeableConcept", "Type of cost.", 0, 1, type);
2311      case -1483017440:
2312        /* groupSize */ return new Property("groupSize", "positiveInt", "Number of participants enrolled in the plan.",
2313            0, 1, groupSize);
2314      case 3059661:
2315        /* cost */ return new Property("cost", "Money", "Value of the cost.", 0, 1, cost);
2316      case 950398559:
2317        /* comment */ return new Property("comment", "string",
2318            "Additional information about the general costs associated with this plan.", 0, 1, comment);
2319      default:
2320        return super.getNamedProperty(_hash, _name, _checkValid);
2321      }
2322
2323    }
2324
2325    @Override
2326    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2327      switch (hash) {
2328      case 3575610:
2329        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
2330      case -1483017440:
2331        /* groupSize */ return this.groupSize == null ? new Base[0] : new Base[] { this.groupSize }; // PositiveIntType
2332      case 3059661:
2333        /* cost */ return this.cost == null ? new Base[0] : new Base[] { this.cost }; // Money
2334      case 950398559:
2335        /* comment */ return this.comment == null ? new Base[0] : new Base[] { this.comment }; // StringType
2336      default:
2337        return super.getProperty(hash, name, checkValid);
2338      }
2339
2340    }
2341
2342    @Override
2343    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2344      switch (hash) {
2345      case 3575610: // type
2346        this.type = castToCodeableConcept(value); // CodeableConcept
2347        return value;
2348      case -1483017440: // groupSize
2349        this.groupSize = castToPositiveInt(value); // PositiveIntType
2350        return value;
2351      case 3059661: // cost
2352        this.cost = castToMoney(value); // Money
2353        return value;
2354      case 950398559: // comment
2355        this.comment = castToString(value); // StringType
2356        return value;
2357      default:
2358        return super.setProperty(hash, name, value);
2359      }
2360
2361    }
2362
2363    @Override
2364    public Base setProperty(String name, Base value) throws FHIRException {
2365      if (name.equals("type")) {
2366        this.type = castToCodeableConcept(value); // CodeableConcept
2367      } else if (name.equals("groupSize")) {
2368        this.groupSize = castToPositiveInt(value); // PositiveIntType
2369      } else if (name.equals("cost")) {
2370        this.cost = castToMoney(value); // Money
2371      } else if (name.equals("comment")) {
2372        this.comment = castToString(value); // StringType
2373      } else
2374        return super.setProperty(name, value);
2375      return value;
2376    }
2377
2378  @Override
2379  public void removeChild(String name, Base value) throws FHIRException {
2380      if (name.equals("type")) {
2381        this.type = null;
2382      } else if (name.equals("groupSize")) {
2383        this.groupSize = null;
2384      } else if (name.equals("cost")) {
2385        this.cost = null;
2386      } else if (name.equals("comment")) {
2387        this.comment = null;
2388      } else
2389        super.removeChild(name, value);
2390      
2391    }
2392
2393    @Override
2394    public Base makeProperty(int hash, String name) throws FHIRException {
2395      switch (hash) {
2396      case 3575610:
2397        return getType();
2398      case -1483017440:
2399        return getGroupSizeElement();
2400      case 3059661:
2401        return getCost();
2402      case 950398559:
2403        return getCommentElement();
2404      default:
2405        return super.makeProperty(hash, name);
2406      }
2407
2408    }
2409
2410    @Override
2411    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2412      switch (hash) {
2413      case 3575610:
2414        /* type */ return new String[] { "CodeableConcept" };
2415      case -1483017440:
2416        /* groupSize */ return new String[] { "positiveInt" };
2417      case 3059661:
2418        /* cost */ return new String[] { "Money" };
2419      case 950398559:
2420        /* comment */ return new String[] { "string" };
2421      default:
2422        return super.getTypesForProperty(hash, name);
2423      }
2424
2425    }
2426
2427    @Override
2428    public Base addChild(String name) throws FHIRException {
2429      if (name.equals("type")) {
2430        this.type = new CodeableConcept();
2431        return this.type;
2432      } else if (name.equals("groupSize")) {
2433        throw new FHIRException("Cannot call addChild on a singleton property InsurancePlan.groupSize");
2434      } else if (name.equals("cost")) {
2435        this.cost = new Money();
2436        return this.cost;
2437      } else if (name.equals("comment")) {
2438        throw new FHIRException("Cannot call addChild on a singleton property InsurancePlan.comment");
2439      } else
2440        return super.addChild(name);
2441    }
2442
2443    public InsurancePlanPlanGeneralCostComponent copy() {
2444      InsurancePlanPlanGeneralCostComponent dst = new InsurancePlanPlanGeneralCostComponent();
2445      copyValues(dst);
2446      return dst;
2447    }
2448
2449    public void copyValues(InsurancePlanPlanGeneralCostComponent dst) {
2450      super.copyValues(dst);
2451      dst.type = type == null ? null : type.copy();
2452      dst.groupSize = groupSize == null ? null : groupSize.copy();
2453      dst.cost = cost == null ? null : cost.copy();
2454      dst.comment = comment == null ? null : comment.copy();
2455    }
2456
2457    @Override
2458    public boolean equalsDeep(Base other_) {
2459      if (!super.equalsDeep(other_))
2460        return false;
2461      if (!(other_ instanceof InsurancePlanPlanGeneralCostComponent))
2462        return false;
2463      InsurancePlanPlanGeneralCostComponent o = (InsurancePlanPlanGeneralCostComponent) other_;
2464      return compareDeep(type, o.type, true) && compareDeep(groupSize, o.groupSize, true)
2465          && compareDeep(cost, o.cost, true) && compareDeep(comment, o.comment, true);
2466    }
2467
2468    @Override
2469    public boolean equalsShallow(Base other_) {
2470      if (!super.equalsShallow(other_))
2471        return false;
2472      if (!(other_ instanceof InsurancePlanPlanGeneralCostComponent))
2473        return false;
2474      InsurancePlanPlanGeneralCostComponent o = (InsurancePlanPlanGeneralCostComponent) other_;
2475      return compareValues(groupSize, o.groupSize, true) && compareValues(comment, o.comment, true);
2476    }
2477
2478    public boolean isEmpty() {
2479      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, groupSize, cost, comment);
2480    }
2481
2482    public String fhirType() {
2483      return "InsurancePlan.plan.generalCost";
2484
2485    }
2486
2487  }
2488
2489  @Block()
2490  public static class InsurancePlanPlanSpecificCostComponent extends BackboneElement implements IBaseBackboneElement {
2491    /**
2492     * General category of benefit (Medical; Dental; Vision; Drug; Mental Health;
2493     * Substance Abuse; Hospice, Home Health).
2494     */
2495    @Child(name = "category", type = {
2496        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2497    @Description(shortDefinition = "General category of benefit", formalDefinition = "General category of benefit (Medical; Dental; Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health).")
2498    protected CodeableConcept category;
2499
2500    /**
2501     * List of the specific benefits under this category of benefit.
2502     */
2503    @Child(name = "benefit", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2504    @Description(shortDefinition = "Benefits list", formalDefinition = "List of the specific benefits under this category of benefit.")
2505    protected List<PlanBenefitComponent> benefit;
2506
2507    private static final long serialVersionUID = 922585525L;
2508
2509    /**
2510     * Constructor
2511     */
2512    public InsurancePlanPlanSpecificCostComponent() {
2513      super();
2514    }
2515
2516    /**
2517     * Constructor
2518     */
2519    public InsurancePlanPlanSpecificCostComponent(CodeableConcept category) {
2520      super();
2521      this.category = category;
2522    }
2523
2524    /**
2525     * @return {@link #category} (General category of benefit (Medical; Dental;
2526     *         Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health).)
2527     */
2528    public CodeableConcept getCategory() {
2529      if (this.category == null)
2530        if (Configuration.errorOnAutoCreate())
2531          throw new Error("Attempt to auto-create InsurancePlanPlanSpecificCostComponent.category");
2532        else if (Configuration.doAutoCreate())
2533          this.category = new CodeableConcept(); // cc
2534      return this.category;
2535    }
2536
2537    public boolean hasCategory() {
2538      return this.category != null && !this.category.isEmpty();
2539    }
2540
2541    /**
2542     * @param value {@link #category} (General category of benefit (Medical; Dental;
2543     *              Vision; Drug; Mental Health; Substance Abuse; Hospice, Home
2544     *              Health).)
2545     */
2546    public InsurancePlanPlanSpecificCostComponent setCategory(CodeableConcept value) {
2547      this.category = value;
2548      return this;
2549    }
2550
2551    /**
2552     * @return {@link #benefit} (List of the specific benefits under this category
2553     *         of benefit.)
2554     */
2555    public List<PlanBenefitComponent> getBenefit() {
2556      if (this.benefit == null)
2557        this.benefit = new ArrayList<PlanBenefitComponent>();
2558      return this.benefit;
2559    }
2560
2561    /**
2562     * @return Returns a reference to <code>this</code> for easy method chaining
2563     */
2564    public InsurancePlanPlanSpecificCostComponent setBenefit(List<PlanBenefitComponent> theBenefit) {
2565      this.benefit = theBenefit;
2566      return this;
2567    }
2568
2569    public boolean hasBenefit() {
2570      if (this.benefit == null)
2571        return false;
2572      for (PlanBenefitComponent item : this.benefit)
2573        if (!item.isEmpty())
2574          return true;
2575      return false;
2576    }
2577
2578    public PlanBenefitComponent addBenefit() { // 3
2579      PlanBenefitComponent t = new PlanBenefitComponent();
2580      if (this.benefit == null)
2581        this.benefit = new ArrayList<PlanBenefitComponent>();
2582      this.benefit.add(t);
2583      return t;
2584    }
2585
2586    public InsurancePlanPlanSpecificCostComponent addBenefit(PlanBenefitComponent t) { // 3
2587      if (t == null)
2588        return this;
2589      if (this.benefit == null)
2590        this.benefit = new ArrayList<PlanBenefitComponent>();
2591      this.benefit.add(t);
2592      return this;
2593    }
2594
2595    /**
2596     * @return The first repetition of repeating field {@link #benefit}, creating it
2597     *         if it does not already exist
2598     */
2599    public PlanBenefitComponent getBenefitFirstRep() {
2600      if (getBenefit().isEmpty()) {
2601        addBenefit();
2602      }
2603      return getBenefit().get(0);
2604    }
2605
2606    protected void listChildren(List<Property> children) {
2607      super.listChildren(children);
2608      children.add(new Property("category", "CodeableConcept",
2609          "General category of benefit (Medical; Dental; Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health).",
2610          0, 1, category));
2611      children.add(new Property("benefit", "", "List of the specific benefits under this category of benefit.", 0,
2612          java.lang.Integer.MAX_VALUE, benefit));
2613    }
2614
2615    @Override
2616    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2617      switch (_hash) {
2618      case 50511102:
2619        /* category */ return new Property("category", "CodeableConcept",
2620            "General category of benefit (Medical; Dental; Vision; Drug; Mental Health; Substance Abuse; Hospice, Home Health).",
2621            0, 1, category);
2622      case -222710633:
2623        /* benefit */ return new Property("benefit", "",
2624            "List of the specific benefits under this category of benefit.", 0, java.lang.Integer.MAX_VALUE, benefit);
2625      default:
2626        return super.getNamedProperty(_hash, _name, _checkValid);
2627      }
2628
2629    }
2630
2631    @Override
2632    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2633      switch (hash) {
2634      case 50511102:
2635        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
2636      case -222710633:
2637        /* benefit */ return this.benefit == null ? new Base[0] : this.benefit.toArray(new Base[this.benefit.size()]); // PlanBenefitComponent
2638      default:
2639        return super.getProperty(hash, name, checkValid);
2640      }
2641
2642    }
2643
2644    @Override
2645    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2646      switch (hash) {
2647      case 50511102: // category
2648        this.category = castToCodeableConcept(value); // CodeableConcept
2649        return value;
2650      case -222710633: // benefit
2651        this.getBenefit().add((PlanBenefitComponent) value); // PlanBenefitComponent
2652        return value;
2653      default:
2654        return super.setProperty(hash, name, value);
2655      }
2656
2657    }
2658
2659    @Override
2660    public Base setProperty(String name, Base value) throws FHIRException {
2661      if (name.equals("category")) {
2662        this.category = castToCodeableConcept(value); // CodeableConcept
2663      } else if (name.equals("benefit")) {
2664        this.getBenefit().add((PlanBenefitComponent) value);
2665      } else
2666        return super.setProperty(name, value);
2667      return value;
2668    }
2669
2670  @Override
2671  public void removeChild(String name, Base value) throws FHIRException {
2672      if (name.equals("category")) {
2673        this.category = null;
2674      } else if (name.equals("benefit")) {
2675        this.getBenefit().remove((PlanBenefitComponent) value);
2676      } else
2677        super.removeChild(name, value);
2678      
2679    }
2680
2681    @Override
2682    public Base makeProperty(int hash, String name) throws FHIRException {
2683      switch (hash) {
2684      case 50511102:
2685        return getCategory();
2686      case -222710633:
2687        return addBenefit();
2688      default:
2689        return super.makeProperty(hash, name);
2690      }
2691
2692    }
2693
2694    @Override
2695    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2696      switch (hash) {
2697      case 50511102:
2698        /* category */ return new String[] { "CodeableConcept" };
2699      case -222710633:
2700        /* benefit */ return new String[] {};
2701      default:
2702        return super.getTypesForProperty(hash, name);
2703      }
2704
2705    }
2706
2707    @Override
2708    public Base addChild(String name) throws FHIRException {
2709      if (name.equals("category")) {
2710        this.category = new CodeableConcept();
2711        return this.category;
2712      } else if (name.equals("benefit")) {
2713        return addBenefit();
2714      } else
2715        return super.addChild(name);
2716    }
2717
2718    public InsurancePlanPlanSpecificCostComponent copy() {
2719      InsurancePlanPlanSpecificCostComponent dst = new InsurancePlanPlanSpecificCostComponent();
2720      copyValues(dst);
2721      return dst;
2722    }
2723
2724    public void copyValues(InsurancePlanPlanSpecificCostComponent dst) {
2725      super.copyValues(dst);
2726      dst.category = category == null ? null : category.copy();
2727      if (benefit != null) {
2728        dst.benefit = new ArrayList<PlanBenefitComponent>();
2729        for (PlanBenefitComponent i : benefit)
2730          dst.benefit.add(i.copy());
2731      }
2732      ;
2733    }
2734
2735    @Override
2736    public boolean equalsDeep(Base other_) {
2737      if (!super.equalsDeep(other_))
2738        return false;
2739      if (!(other_ instanceof InsurancePlanPlanSpecificCostComponent))
2740        return false;
2741      InsurancePlanPlanSpecificCostComponent o = (InsurancePlanPlanSpecificCostComponent) other_;
2742      return compareDeep(category, o.category, true) && compareDeep(benefit, o.benefit, true);
2743    }
2744
2745    @Override
2746    public boolean equalsShallow(Base other_) {
2747      if (!super.equalsShallow(other_))
2748        return false;
2749      if (!(other_ instanceof InsurancePlanPlanSpecificCostComponent))
2750        return false;
2751      InsurancePlanPlanSpecificCostComponent o = (InsurancePlanPlanSpecificCostComponent) other_;
2752      return true;
2753    }
2754
2755    public boolean isEmpty() {
2756      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, benefit);
2757    }
2758
2759    public String fhirType() {
2760      return "InsurancePlan.plan.specificCost";
2761
2762    }
2763
2764  }
2765
2766  @Block()
2767  public static class PlanBenefitComponent extends BackboneElement implements IBaseBackboneElement {
2768    /**
2769     * Type of specific benefit (preventative; primary care office visit; speciality
2770     * office visit; hospitalization; emergency room; urgent care).
2771     */
2772    @Child(name = "type", type = {
2773        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2774    @Description(shortDefinition = "Type of specific benefit", formalDefinition = "Type of specific benefit (preventative; primary care office visit; speciality office visit; hospitalization; emergency room; urgent care).")
2775    protected CodeableConcept type;
2776
2777    /**
2778     * List of the costs associated with a specific benefit.
2779     */
2780    @Child(name = "cost", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2781    @Description(shortDefinition = "List of the costs", formalDefinition = "List of the costs associated with a specific benefit.")
2782    protected List<PlanBenefitCostComponent> cost;
2783
2784    private static final long serialVersionUID = 792296200L;
2785
2786    /**
2787     * Constructor
2788     */
2789    public PlanBenefitComponent() {
2790      super();
2791    }
2792
2793    /**
2794     * Constructor
2795     */
2796    public PlanBenefitComponent(CodeableConcept type) {
2797      super();
2798      this.type = type;
2799    }
2800
2801    /**
2802     * @return {@link #type} (Type of specific benefit (preventative; primary care
2803     *         office visit; speciality office visit; hospitalization; emergency
2804     *         room; urgent care).)
2805     */
2806    public CodeableConcept getType() {
2807      if (this.type == null)
2808        if (Configuration.errorOnAutoCreate())
2809          throw new Error("Attempt to auto-create PlanBenefitComponent.type");
2810        else if (Configuration.doAutoCreate())
2811          this.type = new CodeableConcept(); // cc
2812      return this.type;
2813    }
2814
2815    public boolean hasType() {
2816      return this.type != null && !this.type.isEmpty();
2817    }
2818
2819    /**
2820     * @param value {@link #type} (Type of specific benefit (preventative; primary
2821     *              care office visit; speciality office visit; hospitalization;
2822     *              emergency room; urgent care).)
2823     */
2824    public PlanBenefitComponent setType(CodeableConcept value) {
2825      this.type = value;
2826      return this;
2827    }
2828
2829    /**
2830     * @return {@link #cost} (List of the costs associated with a specific benefit.)
2831     */
2832    public List<PlanBenefitCostComponent> getCost() {
2833      if (this.cost == null)
2834        this.cost = new ArrayList<PlanBenefitCostComponent>();
2835      return this.cost;
2836    }
2837
2838    /**
2839     * @return Returns a reference to <code>this</code> for easy method chaining
2840     */
2841    public PlanBenefitComponent setCost(List<PlanBenefitCostComponent> theCost) {
2842      this.cost = theCost;
2843      return this;
2844    }
2845
2846    public boolean hasCost() {
2847      if (this.cost == null)
2848        return false;
2849      for (PlanBenefitCostComponent item : this.cost)
2850        if (!item.isEmpty())
2851          return true;
2852      return false;
2853    }
2854
2855    public PlanBenefitCostComponent addCost() { // 3
2856      PlanBenefitCostComponent t = new PlanBenefitCostComponent();
2857      if (this.cost == null)
2858        this.cost = new ArrayList<PlanBenefitCostComponent>();
2859      this.cost.add(t);
2860      return t;
2861    }
2862
2863    public PlanBenefitComponent addCost(PlanBenefitCostComponent t) { // 3
2864      if (t == null)
2865        return this;
2866      if (this.cost == null)
2867        this.cost = new ArrayList<PlanBenefitCostComponent>();
2868      this.cost.add(t);
2869      return this;
2870    }
2871
2872    /**
2873     * @return The first repetition of repeating field {@link #cost}, creating it if
2874     *         it does not already exist
2875     */
2876    public PlanBenefitCostComponent getCostFirstRep() {
2877      if (getCost().isEmpty()) {
2878        addCost();
2879      }
2880      return getCost().get(0);
2881    }
2882
2883    protected void listChildren(List<Property> children) {
2884      super.listChildren(children);
2885      children.add(new Property("type", "CodeableConcept",
2886          "Type of specific benefit (preventative; primary care office visit; speciality office visit; hospitalization; emergency room; urgent care).",
2887          0, 1, type));
2888      children.add(new Property("cost", "", "List of the costs associated with a specific benefit.", 0,
2889          java.lang.Integer.MAX_VALUE, cost));
2890    }
2891
2892    @Override
2893    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2894      switch (_hash) {
2895      case 3575610:
2896        /* type */ return new Property("type", "CodeableConcept",
2897            "Type of specific benefit (preventative; primary care office visit; speciality office visit; hospitalization; emergency room; urgent care).",
2898            0, 1, type);
2899      case 3059661:
2900        /* cost */ return new Property("cost", "", "List of the costs associated with a specific benefit.", 0,
2901            java.lang.Integer.MAX_VALUE, cost);
2902      default:
2903        return super.getNamedProperty(_hash, _name, _checkValid);
2904      }
2905
2906    }
2907
2908    @Override
2909    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2910      switch (hash) {
2911      case 3575610:
2912        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
2913      case 3059661:
2914        /* cost */ return this.cost == null ? new Base[0] : this.cost.toArray(new Base[this.cost.size()]); // PlanBenefitCostComponent
2915      default:
2916        return super.getProperty(hash, name, checkValid);
2917      }
2918
2919    }
2920
2921    @Override
2922    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2923      switch (hash) {
2924      case 3575610: // type
2925        this.type = castToCodeableConcept(value); // CodeableConcept
2926        return value;
2927      case 3059661: // cost
2928        this.getCost().add((PlanBenefitCostComponent) value); // PlanBenefitCostComponent
2929        return value;
2930      default:
2931        return super.setProperty(hash, name, value);
2932      }
2933
2934    }
2935
2936    @Override
2937    public Base setProperty(String name, Base value) throws FHIRException {
2938      if (name.equals("type")) {
2939        this.type = castToCodeableConcept(value); // CodeableConcept
2940      } else if (name.equals("cost")) {
2941        this.getCost().add((PlanBenefitCostComponent) value);
2942      } else
2943        return super.setProperty(name, value);
2944      return value;
2945    }
2946
2947  @Override
2948  public void removeChild(String name, Base value) throws FHIRException {
2949      if (name.equals("type")) {
2950        this.type = null;
2951      } else if (name.equals("cost")) {
2952        this.getCost().remove((PlanBenefitCostComponent) value);
2953      } else
2954        super.removeChild(name, value);
2955      
2956    }
2957
2958    @Override
2959    public Base makeProperty(int hash, String name) throws FHIRException {
2960      switch (hash) {
2961      case 3575610:
2962        return getType();
2963      case 3059661:
2964        return addCost();
2965      default:
2966        return super.makeProperty(hash, name);
2967      }
2968
2969    }
2970
2971    @Override
2972    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2973      switch (hash) {
2974      case 3575610:
2975        /* type */ return new String[] { "CodeableConcept" };
2976      case 3059661:
2977        /* cost */ return new String[] {};
2978      default:
2979        return super.getTypesForProperty(hash, name);
2980      }
2981
2982    }
2983
2984    @Override
2985    public Base addChild(String name) throws FHIRException {
2986      if (name.equals("type")) {
2987        this.type = new CodeableConcept();
2988        return this.type;
2989      } else if (name.equals("cost")) {
2990        return addCost();
2991      } else
2992        return super.addChild(name);
2993    }
2994
2995    public PlanBenefitComponent copy() {
2996      PlanBenefitComponent dst = new PlanBenefitComponent();
2997      copyValues(dst);
2998      return dst;
2999    }
3000
3001    public void copyValues(PlanBenefitComponent dst) {
3002      super.copyValues(dst);
3003      dst.type = type == null ? null : type.copy();
3004      if (cost != null) {
3005        dst.cost = new ArrayList<PlanBenefitCostComponent>();
3006        for (PlanBenefitCostComponent i : cost)
3007          dst.cost.add(i.copy());
3008      }
3009      ;
3010    }
3011
3012    @Override
3013    public boolean equalsDeep(Base other_) {
3014      if (!super.equalsDeep(other_))
3015        return false;
3016      if (!(other_ instanceof PlanBenefitComponent))
3017        return false;
3018      PlanBenefitComponent o = (PlanBenefitComponent) other_;
3019      return compareDeep(type, o.type, true) && compareDeep(cost, o.cost, true);
3020    }
3021
3022    @Override
3023    public boolean equalsShallow(Base other_) {
3024      if (!super.equalsShallow(other_))
3025        return false;
3026      if (!(other_ instanceof PlanBenefitComponent))
3027        return false;
3028      PlanBenefitComponent o = (PlanBenefitComponent) other_;
3029      return true;
3030    }
3031
3032    public boolean isEmpty() {
3033      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, cost);
3034    }
3035
3036    public String fhirType() {
3037      return "InsurancePlan.plan.specificCost.benefit";
3038
3039    }
3040
3041  }
3042
3043  @Block()
3044  public static class PlanBenefitCostComponent extends BackboneElement implements IBaseBackboneElement {
3045    /**
3046     * Type of cost (copay; individual cap; family cap; coinsurance; deductible).
3047     */
3048    @Child(name = "type", type = {
3049        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
3050    @Description(shortDefinition = "Type of cost", formalDefinition = "Type of cost (copay; individual cap; family cap; coinsurance; deductible).")
3051    protected CodeableConcept type;
3052
3053    /**
3054     * Whether the cost applies to in-network or out-of-network providers
3055     * (in-network; out-of-network; other).
3056     */
3057    @Child(name = "applicability", type = {
3058        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
3059    @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).")
3060    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/insuranceplan-applicability")
3061    protected CodeableConcept applicability;
3062
3063    /**
3064     * Additional information about the cost, such as information about funding
3065     * sources (e.g. HSA, HRA, FSA, RRA).
3066     */
3067    @Child(name = "qualifiers", type = {
3068        CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3069    @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).")
3070    protected List<CodeableConcept> qualifiers;
3071
3072    /**
3073     * The actual cost value. (some of the costs may be represented as percentages
3074     * rather than currency, e.g. 10% coinsurance).
3075     */
3076    @Child(name = "value", type = { Quantity.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
3077    @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).")
3078    protected Quantity value;
3079
3080    private static final long serialVersionUID = -340688733L;
3081
3082    /**
3083     * Constructor
3084     */
3085    public PlanBenefitCostComponent() {
3086      super();
3087    }
3088
3089    /**
3090     * Constructor
3091     */
3092    public PlanBenefitCostComponent(CodeableConcept type) {
3093      super();
3094      this.type = type;
3095    }
3096
3097    /**
3098     * @return {@link #type} (Type of cost (copay; individual cap; family cap;
3099     *         coinsurance; deductible).)
3100     */
3101    public CodeableConcept getType() {
3102      if (this.type == null)
3103        if (Configuration.errorOnAutoCreate())
3104          throw new Error("Attempt to auto-create PlanBenefitCostComponent.type");
3105        else if (Configuration.doAutoCreate())
3106          this.type = new CodeableConcept(); // cc
3107      return this.type;
3108    }
3109
3110    public boolean hasType() {
3111      return this.type != null && !this.type.isEmpty();
3112    }
3113
3114    /**
3115     * @param value {@link #type} (Type of cost (copay; individual cap; family cap;
3116     *              coinsurance; deductible).)
3117     */
3118    public PlanBenefitCostComponent setType(CodeableConcept value) {
3119      this.type = value;
3120      return this;
3121    }
3122
3123    /**
3124     * @return {@link #applicability} (Whether the cost applies to in-network or
3125     *         out-of-network providers (in-network; out-of-network; other).)
3126     */
3127    public CodeableConcept getApplicability() {
3128      if (this.applicability == null)
3129        if (Configuration.errorOnAutoCreate())
3130          throw new Error("Attempt to auto-create PlanBenefitCostComponent.applicability");
3131        else if (Configuration.doAutoCreate())
3132          this.applicability = new CodeableConcept(); // cc
3133      return this.applicability;
3134    }
3135
3136    public boolean hasApplicability() {
3137      return this.applicability != null && !this.applicability.isEmpty();
3138    }
3139
3140    /**
3141     * @param value {@link #applicability} (Whether the cost applies to in-network
3142     *              or out-of-network providers (in-network; out-of-network;
3143     *              other).)
3144     */
3145    public PlanBenefitCostComponent setApplicability(CodeableConcept value) {
3146      this.applicability = value;
3147      return this;
3148    }
3149
3150    /**
3151     * @return {@link #qualifiers} (Additional information about the cost, such as
3152     *         information about funding sources (e.g. HSA, HRA, FSA, RRA).)
3153     */
3154    public List<CodeableConcept> getQualifiers() {
3155      if (this.qualifiers == null)
3156        this.qualifiers = new ArrayList<CodeableConcept>();
3157      return this.qualifiers;
3158    }
3159
3160    /**
3161     * @return Returns a reference to <code>this</code> for easy method chaining
3162     */
3163    public PlanBenefitCostComponent setQualifiers(List<CodeableConcept> theQualifiers) {
3164      this.qualifiers = theQualifiers;
3165      return this;
3166    }
3167
3168    public boolean hasQualifiers() {
3169      if (this.qualifiers == null)
3170        return false;
3171      for (CodeableConcept item : this.qualifiers)
3172        if (!item.isEmpty())
3173          return true;
3174      return false;
3175    }
3176
3177    public CodeableConcept addQualifiers() { // 3
3178      CodeableConcept t = new CodeableConcept();
3179      if (this.qualifiers == null)
3180        this.qualifiers = new ArrayList<CodeableConcept>();
3181      this.qualifiers.add(t);
3182      return t;
3183    }
3184
3185    public PlanBenefitCostComponent addQualifiers(CodeableConcept t) { // 3
3186      if (t == null)
3187        return this;
3188      if (this.qualifiers == null)
3189        this.qualifiers = new ArrayList<CodeableConcept>();
3190      this.qualifiers.add(t);
3191      return this;
3192    }
3193
3194    /**
3195     * @return The first repetition of repeating field {@link #qualifiers}, creating
3196     *         it if it does not already exist
3197     */
3198    public CodeableConcept getQualifiersFirstRep() {
3199      if (getQualifiers().isEmpty()) {
3200        addQualifiers();
3201      }
3202      return getQualifiers().get(0);
3203    }
3204
3205    /**
3206     * @return {@link #value} (The actual cost value. (some of the costs may be
3207     *         represented as percentages rather than currency, e.g. 10%
3208     *         coinsurance).)
3209     */
3210    public Quantity getValue() {
3211      if (this.value == null)
3212        if (Configuration.errorOnAutoCreate())
3213          throw new Error("Attempt to auto-create PlanBenefitCostComponent.value");
3214        else if (Configuration.doAutoCreate())
3215          this.value = new Quantity(); // cc
3216      return this.value;
3217    }
3218
3219    public boolean hasValue() {
3220      return this.value != null && !this.value.isEmpty();
3221    }
3222
3223    /**
3224     * @param value {@link #value} (The actual cost value. (some of the costs may be
3225     *              represented as percentages rather than currency, e.g. 10%
3226     *              coinsurance).)
3227     */
3228    public PlanBenefitCostComponent setValue(Quantity value) {
3229      this.value = value;
3230      return this;
3231    }
3232
3233    protected void listChildren(List<Property> children) {
3234      super.listChildren(children);
3235      children.add(new Property("type", "CodeableConcept",
3236          "Type of cost (copay; individual cap; family cap; coinsurance; deductible).", 0, 1, type));
3237      children.add(new Property("applicability", "CodeableConcept",
3238          "Whether the cost applies to in-network or out-of-network providers (in-network; out-of-network; other).", 0,
3239          1, applicability));
3240      children.add(new Property("qualifiers", "CodeableConcept",
3241          "Additional information about the cost, such as information about funding sources (e.g. HSA, HRA, FSA, RRA).",
3242          0, java.lang.Integer.MAX_VALUE, qualifiers));
3243      children.add(new Property("value", "Quantity",
3244          "The actual cost value. (some of the costs may be represented as percentages rather than currency, e.g. 10% coinsurance).",
3245          0, 1, value));
3246    }
3247
3248    @Override
3249    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3250      switch (_hash) {
3251      case 3575610:
3252        /* type */ return new Property("type", "CodeableConcept",
3253            "Type of cost (copay; individual cap; family cap; coinsurance; deductible).", 0, 1, type);
3254      case -1526770491:
3255        /* applicability */ return new Property("applicability", "CodeableConcept",
3256            "Whether the cost applies to in-network or out-of-network providers (in-network; out-of-network; other).",
3257            0, 1, applicability);
3258      case -31447799:
3259        /* qualifiers */ return new Property("qualifiers", "CodeableConcept",
3260            "Additional information about the cost, such as information about funding sources (e.g. HSA, HRA, FSA, RRA).",
3261            0, java.lang.Integer.MAX_VALUE, qualifiers);
3262      case 111972721:
3263        /* value */ return new Property("value", "Quantity",
3264            "The actual cost value. (some of the costs may be represented as percentages rather than currency, e.g. 10% coinsurance).",
3265            0, 1, value);
3266      default:
3267        return super.getNamedProperty(_hash, _name, _checkValid);
3268      }
3269
3270    }
3271
3272    @Override
3273    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3274      switch (hash) {
3275      case 3575610:
3276        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
3277      case -1526770491:
3278        /* applicability */ return this.applicability == null ? new Base[0] : new Base[] { this.applicability }; // CodeableConcept
3279      case -31447799:
3280        /* qualifiers */ return this.qualifiers == null ? new Base[0]
3281            : this.qualifiers.toArray(new Base[this.qualifiers.size()]); // CodeableConcept
3282      case 111972721:
3283        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Quantity
3284      default:
3285        return super.getProperty(hash, name, checkValid);
3286      }
3287
3288    }
3289
3290    @Override
3291    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3292      switch (hash) {
3293      case 3575610: // type
3294        this.type = castToCodeableConcept(value); // CodeableConcept
3295        return value;
3296      case -1526770491: // applicability
3297        this.applicability = castToCodeableConcept(value); // CodeableConcept
3298        return value;
3299      case -31447799: // qualifiers
3300        this.getQualifiers().add(castToCodeableConcept(value)); // CodeableConcept
3301        return value;
3302      case 111972721: // value
3303        this.value = castToQuantity(value); // Quantity
3304        return value;
3305      default:
3306        return super.setProperty(hash, name, value);
3307      }
3308
3309    }
3310
3311    @Override
3312    public Base setProperty(String name, Base value) throws FHIRException {
3313      if (name.equals("type")) {
3314        this.type = castToCodeableConcept(value); // CodeableConcept
3315      } else if (name.equals("applicability")) {
3316        this.applicability = castToCodeableConcept(value); // CodeableConcept
3317      } else if (name.equals("qualifiers")) {
3318        this.getQualifiers().add(castToCodeableConcept(value));
3319      } else if (name.equals("value")) {
3320        this.value = castToQuantity(value); // Quantity
3321      } else
3322        return super.setProperty(name, value);
3323      return value;
3324    }
3325
3326  @Override
3327  public void removeChild(String name, Base value) throws FHIRException {
3328      if (name.equals("type")) {
3329        this.type = null;
3330      } else if (name.equals("applicability")) {
3331        this.applicability = null;
3332      } else if (name.equals("qualifiers")) {
3333        this.getQualifiers().remove(castToCodeableConcept(value));
3334      } else if (name.equals("value")) {
3335        this.value = null;
3336      } else
3337        super.removeChild(name, value);
3338      
3339    }
3340
3341    @Override
3342    public Base makeProperty(int hash, String name) throws FHIRException {
3343      switch (hash) {
3344      case 3575610:
3345        return getType();
3346      case -1526770491:
3347        return getApplicability();
3348      case -31447799:
3349        return addQualifiers();
3350      case 111972721:
3351        return getValue();
3352      default:
3353        return super.makeProperty(hash, name);
3354      }
3355
3356    }
3357
3358    @Override
3359    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3360      switch (hash) {
3361      case 3575610:
3362        /* type */ return new String[] { "CodeableConcept" };
3363      case -1526770491:
3364        /* applicability */ return new String[] { "CodeableConcept" };
3365      case -31447799:
3366        /* qualifiers */ return new String[] { "CodeableConcept" };
3367      case 111972721:
3368        /* value */ return new String[] { "Quantity" };
3369      default:
3370        return super.getTypesForProperty(hash, name);
3371      }
3372
3373    }
3374
3375    @Override
3376    public Base addChild(String name) throws FHIRException {
3377      if (name.equals("type")) {
3378        this.type = new CodeableConcept();
3379        return this.type;
3380      } else if (name.equals("applicability")) {
3381        this.applicability = new CodeableConcept();
3382        return this.applicability;
3383      } else if (name.equals("qualifiers")) {
3384        return addQualifiers();
3385      } else if (name.equals("value")) {
3386        this.value = new Quantity();
3387        return this.value;
3388      } else
3389        return super.addChild(name);
3390    }
3391
3392    public PlanBenefitCostComponent copy() {
3393      PlanBenefitCostComponent dst = new PlanBenefitCostComponent();
3394      copyValues(dst);
3395      return dst;
3396    }
3397
3398    public void copyValues(PlanBenefitCostComponent dst) {
3399      super.copyValues(dst);
3400      dst.type = type == null ? null : type.copy();
3401      dst.applicability = applicability == null ? null : applicability.copy();
3402      if (qualifiers != null) {
3403        dst.qualifiers = new ArrayList<CodeableConcept>();
3404        for (CodeableConcept i : qualifiers)
3405          dst.qualifiers.add(i.copy());
3406      }
3407      ;
3408      dst.value = value == null ? null : value.copy();
3409    }
3410
3411    @Override
3412    public boolean equalsDeep(Base other_) {
3413      if (!super.equalsDeep(other_))
3414        return false;
3415      if (!(other_ instanceof PlanBenefitCostComponent))
3416        return false;
3417      PlanBenefitCostComponent o = (PlanBenefitCostComponent) other_;
3418      return compareDeep(type, o.type, true) && compareDeep(applicability, o.applicability, true)
3419          && compareDeep(qualifiers, o.qualifiers, true) && compareDeep(value, o.value, true);
3420    }
3421
3422    @Override
3423    public boolean equalsShallow(Base other_) {
3424      if (!super.equalsShallow(other_))
3425        return false;
3426      if (!(other_ instanceof PlanBenefitCostComponent))
3427        return false;
3428      PlanBenefitCostComponent o = (PlanBenefitCostComponent) other_;
3429      return true;
3430    }
3431
3432    public boolean isEmpty() {
3433      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, applicability, qualifiers, value);
3434    }
3435
3436    public String fhirType() {
3437      return "InsurancePlan.plan.specificCost.benefit.cost";
3438
3439    }
3440
3441  }
3442
3443  /**
3444   * Business identifiers assigned to this health insurance product which remain
3445   * constant as the resource is updated and propagates from server to server.
3446   */
3447  @Child(name = "identifier", type = {
3448      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
3449  @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.")
3450  protected List<Identifier> identifier;
3451
3452  /**
3453   * The current state of the health insurance product.
3454   */
3455  @Child(name = "status", type = { CodeType.class }, order = 1, min = 0, max = 1, modifier = true, summary = true)
3456  @Description(shortDefinition = "draft | active | retired | unknown", formalDefinition = "The current state of the health insurance product.")
3457  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/publication-status")
3458  protected Enumeration<PublicationStatus> status;
3459
3460  /**
3461   * The kind of health insurance product.
3462   */
3463  @Child(name = "type", type = {
3464      CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
3465  @Description(shortDefinition = "Kind of product", formalDefinition = "The kind of health insurance product.")
3466  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/insuranceplan-type")
3467  protected List<CodeableConcept> type;
3468
3469  /**
3470   * Official name of the health insurance product as designated by the owner.
3471   */
3472  @Child(name = "name", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
3473  @Description(shortDefinition = "Official name", formalDefinition = "Official name of the health insurance product as designated by the owner.")
3474  protected StringType name;
3475
3476  /**
3477   * A list of alternate names that the product is known as, or was known as in
3478   * the past.
3479   */
3480  @Child(name = "alias", type = {
3481      StringType.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3482  @Description(shortDefinition = "Alternate names", formalDefinition = "A list of alternate names that the product is known as, or was known as in the past.")
3483  protected List<StringType> alias;
3484
3485  /**
3486   * The period of time that the health insurance product is available.
3487   */
3488  @Child(name = "period", type = { Period.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
3489  @Description(shortDefinition = "When the product is available", formalDefinition = "The period of time that the health insurance product is available.")
3490  protected Period period;
3491
3492  /**
3493   * The entity that is providing the health insurance product and underwriting
3494   * the risk. This is typically an insurance carriers, other third-party payers,
3495   * or health plan sponsors comonly referred to as 'payers'.
3496   */
3497  @Child(name = "ownedBy", type = { Organization.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
3498  @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'.")
3499  protected Reference ownedBy;
3500
3501  /**
3502   * The actual object that is the target of the reference (The entity that is
3503   * providing the health insurance product and underwriting the risk. This is
3504   * typically an insurance carriers, other third-party payers, or health plan
3505   * sponsors comonly referred to as 'payers'.)
3506   */
3507  protected Organization ownedByTarget;
3508
3509  /**
3510   * An organization which administer other services such as underwriting,
3511   * customer service and/or claims processing on behalf of the health insurance
3512   * product owner.
3513   */
3514  @Child(name = "administeredBy", type = {
3515      Organization.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
3516  @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.")
3517  protected Reference administeredBy;
3518
3519  /**
3520   * The actual object that is the target of the reference (An organization which
3521   * administer other services such as underwriting, customer service and/or
3522   * claims processing on behalf of the health insurance product owner.)
3523   */
3524  protected Organization administeredByTarget;
3525
3526  /**
3527   * The geographic region in which a health insurance product's benefits apply.
3528   */
3529  @Child(name = "coverageArea", type = {
3530      Location.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
3531  @Description(shortDefinition = "Where product applies", formalDefinition = "The geographic region in which a health insurance product's benefits apply.")
3532  protected List<Reference> coverageArea;
3533  /**
3534   * The actual objects that are the target of the reference (The geographic
3535   * region in which a health insurance product's benefits apply.)
3536   */
3537  protected List<Location> coverageAreaTarget;
3538
3539  /**
3540   * The contact for the health insurance product for a certain purpose.
3541   */
3542  @Child(name = "contact", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3543  @Description(shortDefinition = "Contact for the product", formalDefinition = "The contact for the health insurance product for a certain purpose.")
3544  protected List<InsurancePlanContactComponent> contact;
3545
3546  /**
3547   * The technical endpoints providing access to services operated for the health
3548   * insurance product.
3549   */
3550  @Child(name = "endpoint", type = {
3551      Endpoint.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3552  @Description(shortDefinition = "Technical endpoint", formalDefinition = "The technical endpoints providing access to services operated for the health insurance product.")
3553  protected List<Reference> endpoint;
3554  /**
3555   * The actual objects that are the target of the reference (The technical
3556   * endpoints providing access to services operated for the health insurance
3557   * product.)
3558   */
3559  protected List<Endpoint> endpointTarget;
3560
3561  /**
3562   * Reference to the network included in the health insurance product.
3563   */
3564  @Child(name = "network", type = {
3565      Organization.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3566  @Description(shortDefinition = "What networks are Included", formalDefinition = "Reference to the network included in the health insurance product.")
3567  protected List<Reference> network;
3568  /**
3569   * The actual objects that are the target of the reference (Reference to the
3570   * network included in the health insurance product.)
3571   */
3572  protected List<Organization> networkTarget;
3573
3574  /**
3575   * Details about the coverage offered by the insurance product.
3576   */
3577  @Child(name = "coverage", type = {}, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3578  @Description(shortDefinition = "Coverage details", formalDefinition = "Details about the coverage offered by the insurance product.")
3579  protected List<InsurancePlanCoverageComponent> coverage;
3580
3581  /**
3582   * Details about an insurance plan.
3583   */
3584  @Child(name = "plan", type = {}, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3585  @Description(shortDefinition = "Plan details", formalDefinition = "Details about an insurance plan.")
3586  protected List<InsurancePlanPlanComponent> plan;
3587
3588  private static final long serialVersionUID = -1910594688L;
3589
3590  /**
3591   * Constructor
3592   */
3593  public InsurancePlan() {
3594    super();
3595  }
3596
3597  /**
3598   * @return {@link #identifier} (Business identifiers assigned to this health
3599   *         insurance product which remain constant as the resource is updated
3600   *         and propagates from server to server.)
3601   */
3602  public List<Identifier> getIdentifier() {
3603    if (this.identifier == null)
3604      this.identifier = new ArrayList<Identifier>();
3605    return this.identifier;
3606  }
3607
3608  /**
3609   * @return Returns a reference to <code>this</code> for easy method chaining
3610   */
3611  public InsurancePlan setIdentifier(List<Identifier> theIdentifier) {
3612    this.identifier = theIdentifier;
3613    return this;
3614  }
3615
3616  public boolean hasIdentifier() {
3617    if (this.identifier == null)
3618      return false;
3619    for (Identifier item : this.identifier)
3620      if (!item.isEmpty())
3621        return true;
3622    return false;
3623  }
3624
3625  public Identifier addIdentifier() { // 3
3626    Identifier t = new Identifier();
3627    if (this.identifier == null)
3628      this.identifier = new ArrayList<Identifier>();
3629    this.identifier.add(t);
3630    return t;
3631  }
3632
3633  public InsurancePlan addIdentifier(Identifier t) { // 3
3634    if (t == null)
3635      return this;
3636    if (this.identifier == null)
3637      this.identifier = new ArrayList<Identifier>();
3638    this.identifier.add(t);
3639    return this;
3640  }
3641
3642  /**
3643   * @return The first repetition of repeating field {@link #identifier}, creating
3644   *         it if it does not already exist
3645   */
3646  public Identifier getIdentifierFirstRep() {
3647    if (getIdentifier().isEmpty()) {
3648      addIdentifier();
3649    }
3650    return getIdentifier().get(0);
3651  }
3652
3653  /**
3654   * @return {@link #status} (The current state of the health insurance product.).
3655   *         This is the underlying object with id, value and extensions. The
3656   *         accessor "getStatus" gives direct access to the value
3657   */
3658  public Enumeration<PublicationStatus> getStatusElement() {
3659    if (this.status == null)
3660      if (Configuration.errorOnAutoCreate())
3661        throw new Error("Attempt to auto-create InsurancePlan.status");
3662      else if (Configuration.doAutoCreate())
3663        this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
3664    return this.status;
3665  }
3666
3667  public boolean hasStatusElement() {
3668    return this.status != null && !this.status.isEmpty();
3669  }
3670
3671  public boolean hasStatus() {
3672    return this.status != null && !this.status.isEmpty();
3673  }
3674
3675  /**
3676   * @param value {@link #status} (The current state of the health insurance
3677   *              product.). This is the underlying object with id, value and
3678   *              extensions. The accessor "getStatus" gives direct access to the
3679   *              value
3680   */
3681  public InsurancePlan setStatusElement(Enumeration<PublicationStatus> value) {
3682    this.status = value;
3683    return this;
3684  }
3685
3686  /**
3687   * @return The current state of the health insurance product.
3688   */
3689  public PublicationStatus getStatus() {
3690    return this.status == null ? null : this.status.getValue();
3691  }
3692
3693  /**
3694   * @param value The current state of the health insurance product.
3695   */
3696  public InsurancePlan setStatus(PublicationStatus value) {
3697    if (value == null)
3698      this.status = null;
3699    else {
3700      if (this.status == null)
3701        this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
3702      this.status.setValue(value);
3703    }
3704    return this;
3705  }
3706
3707  /**
3708   * @return {@link #type} (The kind of health insurance product.)
3709   */
3710  public List<CodeableConcept> getType() {
3711    if (this.type == null)
3712      this.type = new ArrayList<CodeableConcept>();
3713    return this.type;
3714  }
3715
3716  /**
3717   * @return Returns a reference to <code>this</code> for easy method chaining
3718   */
3719  public InsurancePlan setType(List<CodeableConcept> theType) {
3720    this.type = theType;
3721    return this;
3722  }
3723
3724  public boolean hasType() {
3725    if (this.type == null)
3726      return false;
3727    for (CodeableConcept item : this.type)
3728      if (!item.isEmpty())
3729        return true;
3730    return false;
3731  }
3732
3733  public CodeableConcept addType() { // 3
3734    CodeableConcept t = new CodeableConcept();
3735    if (this.type == null)
3736      this.type = new ArrayList<CodeableConcept>();
3737    this.type.add(t);
3738    return t;
3739  }
3740
3741  public InsurancePlan addType(CodeableConcept t) { // 3
3742    if (t == null)
3743      return this;
3744    if (this.type == null)
3745      this.type = new ArrayList<CodeableConcept>();
3746    this.type.add(t);
3747    return this;
3748  }
3749
3750  /**
3751   * @return The first repetition of repeating field {@link #type}, creating it if
3752   *         it does not already exist
3753   */
3754  public CodeableConcept getTypeFirstRep() {
3755    if (getType().isEmpty()) {
3756      addType();
3757    }
3758    return getType().get(0);
3759  }
3760
3761  /**
3762   * @return {@link #name} (Official name of the health insurance product as
3763   *         designated by the owner.). This is the underlying object with id,
3764   *         value and extensions. The accessor "getName" gives direct access to
3765   *         the value
3766   */
3767  public StringType getNameElement() {
3768    if (this.name == null)
3769      if (Configuration.errorOnAutoCreate())
3770        throw new Error("Attempt to auto-create InsurancePlan.name");
3771      else if (Configuration.doAutoCreate())
3772        this.name = new StringType(); // bb
3773    return this.name;
3774  }
3775
3776  public boolean hasNameElement() {
3777    return this.name != null && !this.name.isEmpty();
3778  }
3779
3780  public boolean hasName() {
3781    return this.name != null && !this.name.isEmpty();
3782  }
3783
3784  /**
3785   * @param value {@link #name} (Official name of the health insurance product as
3786   *              designated by the owner.). This is the underlying object with
3787   *              id, value and extensions. The accessor "getName" gives direct
3788   *              access to the value
3789   */
3790  public InsurancePlan setNameElement(StringType value) {
3791    this.name = value;
3792    return this;
3793  }
3794
3795  /**
3796   * @return Official name of the health insurance product as designated by the
3797   *         owner.
3798   */
3799  public String getName() {
3800    return this.name == null ? null : this.name.getValue();
3801  }
3802
3803  /**
3804   * @param value Official name of the health insurance product as designated by
3805   *              the owner.
3806   */
3807  public InsurancePlan setName(String value) {
3808    if (Utilities.noString(value))
3809      this.name = null;
3810    else {
3811      if (this.name == null)
3812        this.name = new StringType();
3813      this.name.setValue(value);
3814    }
3815    return this;
3816  }
3817
3818  /**
3819   * @return {@link #alias} (A list of alternate names that the product is known
3820   *         as, or was known as in the past.)
3821   */
3822  public List<StringType> getAlias() {
3823    if (this.alias == null)
3824      this.alias = new ArrayList<StringType>();
3825    return this.alias;
3826  }
3827
3828  /**
3829   * @return Returns a reference to <code>this</code> for easy method chaining
3830   */
3831  public InsurancePlan setAlias(List<StringType> theAlias) {
3832    this.alias = theAlias;
3833    return this;
3834  }
3835
3836  public boolean hasAlias() {
3837    if (this.alias == null)
3838      return false;
3839    for (StringType item : this.alias)
3840      if (!item.isEmpty())
3841        return true;
3842    return false;
3843  }
3844
3845  /**
3846   * @return {@link #alias} (A list of alternate names that the product is known
3847   *         as, or was known as in the past.)
3848   */
3849  public StringType addAliasElement() {// 2
3850    StringType t = new StringType();
3851    if (this.alias == null)
3852      this.alias = new ArrayList<StringType>();
3853    this.alias.add(t);
3854    return t;
3855  }
3856
3857  /**
3858   * @param value {@link #alias} (A list of alternate names that the product is
3859   *              known as, or was known as in the past.)
3860   */
3861  public InsurancePlan addAlias(String value) { // 1
3862    StringType t = new StringType();
3863    t.setValue(value);
3864    if (this.alias == null)
3865      this.alias = new ArrayList<StringType>();
3866    this.alias.add(t);
3867    return this;
3868  }
3869
3870  /**
3871   * @param value {@link #alias} (A list of alternate names that the product is
3872   *              known as, or was known as in the past.)
3873   */
3874  public boolean hasAlias(String value) {
3875    if (this.alias == null)
3876      return false;
3877    for (StringType v : this.alias)
3878      if (v.getValue().equals(value)) // string
3879        return true;
3880    return false;
3881  }
3882
3883  /**
3884   * @return {@link #period} (The period of time that the health insurance product
3885   *         is available.)
3886   */
3887  public Period getPeriod() {
3888    if (this.period == null)
3889      if (Configuration.errorOnAutoCreate())
3890        throw new Error("Attempt to auto-create InsurancePlan.period");
3891      else if (Configuration.doAutoCreate())
3892        this.period = new Period(); // cc
3893    return this.period;
3894  }
3895
3896  public boolean hasPeriod() {
3897    return this.period != null && !this.period.isEmpty();
3898  }
3899
3900  /**
3901   * @param value {@link #period} (The period of time that the health insurance
3902   *              product is available.)
3903   */
3904  public InsurancePlan setPeriod(Period value) {
3905    this.period = value;
3906    return this;
3907  }
3908
3909  /**
3910   * @return {@link #ownedBy} (The entity that is providing the health insurance
3911   *         product and underwriting the risk. This is typically an insurance
3912   *         carriers, other third-party payers, or health plan sponsors comonly
3913   *         referred to as 'payers'.)
3914   */
3915  public Reference getOwnedBy() {
3916    if (this.ownedBy == null)
3917      if (Configuration.errorOnAutoCreate())
3918        throw new Error("Attempt to auto-create InsurancePlan.ownedBy");
3919      else if (Configuration.doAutoCreate())
3920        this.ownedBy = new Reference(); // cc
3921    return this.ownedBy;
3922  }
3923
3924  public boolean hasOwnedBy() {
3925    return this.ownedBy != null && !this.ownedBy.isEmpty();
3926  }
3927
3928  /**
3929   * @param value {@link #ownedBy} (The entity that is providing the health
3930   *              insurance product and underwriting the risk. This is typically
3931   *              an insurance carriers, other third-party payers, or health plan
3932   *              sponsors comonly referred to as 'payers'.)
3933   */
3934  public InsurancePlan setOwnedBy(Reference value) {
3935    this.ownedBy = value;
3936    return this;
3937  }
3938
3939  /**
3940   * @return {@link #ownedBy} The actual object that is the target of the
3941   *         reference. The reference library doesn't populate this, but you can
3942   *         use it to hold the resource if you resolve it. (The entity that is
3943   *         providing the health insurance product and underwriting the risk.
3944   *         This is typically an insurance carriers, other third-party payers, or
3945   *         health plan sponsors comonly referred to as 'payers'.)
3946   */
3947  public Organization getOwnedByTarget() {
3948    if (this.ownedByTarget == null)
3949      if (Configuration.errorOnAutoCreate())
3950        throw new Error("Attempt to auto-create InsurancePlan.ownedBy");
3951      else if (Configuration.doAutoCreate())
3952        this.ownedByTarget = new Organization(); // aa
3953    return this.ownedByTarget;
3954  }
3955
3956  /**
3957   * @param value {@link #ownedBy} The actual object that is the target of the
3958   *              reference. The reference library doesn't use these, but you can
3959   *              use it to hold the resource if you resolve it. (The entity that
3960   *              is providing the health insurance product and underwriting the
3961   *              risk. This is typically an insurance carriers, other third-party
3962   *              payers, or health plan sponsors comonly referred to as
3963   *              'payers'.)
3964   */
3965  public InsurancePlan setOwnedByTarget(Organization value) {
3966    this.ownedByTarget = value;
3967    return this;
3968  }
3969
3970  /**
3971   * @return {@link #administeredBy} (An organization which administer other
3972   *         services such as underwriting, customer service and/or claims
3973   *         processing on behalf of the health insurance product owner.)
3974   */
3975  public Reference getAdministeredBy() {
3976    if (this.administeredBy == null)
3977      if (Configuration.errorOnAutoCreate())
3978        throw new Error("Attempt to auto-create InsurancePlan.administeredBy");
3979      else if (Configuration.doAutoCreate())
3980        this.administeredBy = new Reference(); // cc
3981    return this.administeredBy;
3982  }
3983
3984  public boolean hasAdministeredBy() {
3985    return this.administeredBy != null && !this.administeredBy.isEmpty();
3986  }
3987
3988  /**
3989   * @param value {@link #administeredBy} (An organization which administer other
3990   *              services such as underwriting, customer service and/or claims
3991   *              processing on behalf of the health insurance product owner.)
3992   */
3993  public InsurancePlan setAdministeredBy(Reference value) {
3994    this.administeredBy = value;
3995    return this;
3996  }
3997
3998  /**
3999   * @return {@link #administeredBy} The actual object that is the target of the
4000   *         reference. The reference library doesn't populate this, but you can
4001   *         use it to hold the resource if you resolve it. (An organization which
4002   *         administer other services such as underwriting, customer service
4003   *         and/or claims processing on behalf of the health insurance product
4004   *         owner.)
4005   */
4006  public Organization getAdministeredByTarget() {
4007    if (this.administeredByTarget == null)
4008      if (Configuration.errorOnAutoCreate())
4009        throw new Error("Attempt to auto-create InsurancePlan.administeredBy");
4010      else if (Configuration.doAutoCreate())
4011        this.administeredByTarget = new Organization(); // aa
4012    return this.administeredByTarget;
4013  }
4014
4015  /**
4016   * @param value {@link #administeredBy} The actual object that is the target of
4017   *              the reference. The reference library doesn't use these, but you
4018   *              can use it to hold the resource if you resolve it. (An
4019   *              organization which administer other services such as
4020   *              underwriting, customer service and/or claims processing on
4021   *              behalf of the health insurance product owner.)
4022   */
4023  public InsurancePlan setAdministeredByTarget(Organization value) {
4024    this.administeredByTarget = value;
4025    return this;
4026  }
4027
4028  /**
4029   * @return {@link #coverageArea} (The geographic region in which a health
4030   *         insurance product's benefits apply.)
4031   */
4032  public List<Reference> getCoverageArea() {
4033    if (this.coverageArea == null)
4034      this.coverageArea = new ArrayList<Reference>();
4035    return this.coverageArea;
4036  }
4037
4038  /**
4039   * @return Returns a reference to <code>this</code> for easy method chaining
4040   */
4041  public InsurancePlan setCoverageArea(List<Reference> theCoverageArea) {
4042    this.coverageArea = theCoverageArea;
4043    return this;
4044  }
4045
4046  public boolean hasCoverageArea() {
4047    if (this.coverageArea == null)
4048      return false;
4049    for (Reference item : this.coverageArea)
4050      if (!item.isEmpty())
4051        return true;
4052    return false;
4053  }
4054
4055  public Reference addCoverageArea() { // 3
4056    Reference t = new Reference();
4057    if (this.coverageArea == null)
4058      this.coverageArea = new ArrayList<Reference>();
4059    this.coverageArea.add(t);
4060    return t;
4061  }
4062
4063  public InsurancePlan addCoverageArea(Reference t) { // 3
4064    if (t == null)
4065      return this;
4066    if (this.coverageArea == null)
4067      this.coverageArea = new ArrayList<Reference>();
4068    this.coverageArea.add(t);
4069    return this;
4070  }
4071
4072  /**
4073   * @return The first repetition of repeating field {@link #coverageArea},
4074   *         creating it if it does not already exist
4075   */
4076  public Reference getCoverageAreaFirstRep() {
4077    if (getCoverageArea().isEmpty()) {
4078      addCoverageArea();
4079    }
4080    return getCoverageArea().get(0);
4081  }
4082
4083  /**
4084   * @deprecated Use Reference#setResource(IBaseResource) instead
4085   */
4086  @Deprecated
4087  public List<Location> getCoverageAreaTarget() {
4088    if (this.coverageAreaTarget == null)
4089      this.coverageAreaTarget = new ArrayList<Location>();
4090    return this.coverageAreaTarget;
4091  }
4092
4093  /**
4094   * @deprecated Use Reference#setResource(IBaseResource) instead
4095   */
4096  @Deprecated
4097  public Location addCoverageAreaTarget() {
4098    Location r = new Location();
4099    if (this.coverageAreaTarget == null)
4100      this.coverageAreaTarget = new ArrayList<Location>();
4101    this.coverageAreaTarget.add(r);
4102    return r;
4103  }
4104
4105  /**
4106   * @return {@link #contact} (The contact for the health insurance product for a
4107   *         certain purpose.)
4108   */
4109  public List<InsurancePlanContactComponent> getContact() {
4110    if (this.contact == null)
4111      this.contact = new ArrayList<InsurancePlanContactComponent>();
4112    return this.contact;
4113  }
4114
4115  /**
4116   * @return Returns a reference to <code>this</code> for easy method chaining
4117   */
4118  public InsurancePlan setContact(List<InsurancePlanContactComponent> theContact) {
4119    this.contact = theContact;
4120    return this;
4121  }
4122
4123  public boolean hasContact() {
4124    if (this.contact == null)
4125      return false;
4126    for (InsurancePlanContactComponent item : this.contact)
4127      if (!item.isEmpty())
4128        return true;
4129    return false;
4130  }
4131
4132  public InsurancePlanContactComponent addContact() { // 3
4133    InsurancePlanContactComponent t = new InsurancePlanContactComponent();
4134    if (this.contact == null)
4135      this.contact = new ArrayList<InsurancePlanContactComponent>();
4136    this.contact.add(t);
4137    return t;
4138  }
4139
4140  public InsurancePlan addContact(InsurancePlanContactComponent t) { // 3
4141    if (t == null)
4142      return this;
4143    if (this.contact == null)
4144      this.contact = new ArrayList<InsurancePlanContactComponent>();
4145    this.contact.add(t);
4146    return this;
4147  }
4148
4149  /**
4150   * @return The first repetition of repeating field {@link #contact}, creating it
4151   *         if it does not already exist
4152   */
4153  public InsurancePlanContactComponent getContactFirstRep() {
4154    if (getContact().isEmpty()) {
4155      addContact();
4156    }
4157    return getContact().get(0);
4158  }
4159
4160  /**
4161   * @return {@link #endpoint} (The technical endpoints providing access to
4162   *         services operated for the health insurance product.)
4163   */
4164  public List<Reference> getEndpoint() {
4165    if (this.endpoint == null)
4166      this.endpoint = new ArrayList<Reference>();
4167    return this.endpoint;
4168  }
4169
4170  /**
4171   * @return Returns a reference to <code>this</code> for easy method chaining
4172   */
4173  public InsurancePlan setEndpoint(List<Reference> theEndpoint) {
4174    this.endpoint = theEndpoint;
4175    return this;
4176  }
4177
4178  public boolean hasEndpoint() {
4179    if (this.endpoint == null)
4180      return false;
4181    for (Reference item : this.endpoint)
4182      if (!item.isEmpty())
4183        return true;
4184    return false;
4185  }
4186
4187  public Reference addEndpoint() { // 3
4188    Reference t = new Reference();
4189    if (this.endpoint == null)
4190      this.endpoint = new ArrayList<Reference>();
4191    this.endpoint.add(t);
4192    return t;
4193  }
4194
4195  public InsurancePlan addEndpoint(Reference t) { // 3
4196    if (t == null)
4197      return this;
4198    if (this.endpoint == null)
4199      this.endpoint = new ArrayList<Reference>();
4200    this.endpoint.add(t);
4201    return this;
4202  }
4203
4204  /**
4205   * @return The first repetition of repeating field {@link #endpoint}, creating
4206   *         it if it does not already exist
4207   */
4208  public Reference getEndpointFirstRep() {
4209    if (getEndpoint().isEmpty()) {
4210      addEndpoint();
4211    }
4212    return getEndpoint().get(0);
4213  }
4214
4215  /**
4216   * @deprecated Use Reference#setResource(IBaseResource) instead
4217   */
4218  @Deprecated
4219  public List<Endpoint> getEndpointTarget() {
4220    if (this.endpointTarget == null)
4221      this.endpointTarget = new ArrayList<Endpoint>();
4222    return this.endpointTarget;
4223  }
4224
4225  /**
4226   * @deprecated Use Reference#setResource(IBaseResource) instead
4227   */
4228  @Deprecated
4229  public Endpoint addEndpointTarget() {
4230    Endpoint r = new Endpoint();
4231    if (this.endpointTarget == null)
4232      this.endpointTarget = new ArrayList<Endpoint>();
4233    this.endpointTarget.add(r);
4234    return r;
4235  }
4236
4237  /**
4238   * @return {@link #network} (Reference to the network included in the health
4239   *         insurance product.)
4240   */
4241  public List<Reference> getNetwork() {
4242    if (this.network == null)
4243      this.network = new ArrayList<Reference>();
4244    return this.network;
4245  }
4246
4247  /**
4248   * @return Returns a reference to <code>this</code> for easy method chaining
4249   */
4250  public InsurancePlan setNetwork(List<Reference> theNetwork) {
4251    this.network = theNetwork;
4252    return this;
4253  }
4254
4255  public boolean hasNetwork() {
4256    if (this.network == null)
4257      return false;
4258    for (Reference item : this.network)
4259      if (!item.isEmpty())
4260        return true;
4261    return false;
4262  }
4263
4264  public Reference addNetwork() { // 3
4265    Reference t = new Reference();
4266    if (this.network == null)
4267      this.network = new ArrayList<Reference>();
4268    this.network.add(t);
4269    return t;
4270  }
4271
4272  public InsurancePlan addNetwork(Reference t) { // 3
4273    if (t == null)
4274      return this;
4275    if (this.network == null)
4276      this.network = new ArrayList<Reference>();
4277    this.network.add(t);
4278    return this;
4279  }
4280
4281  /**
4282   * @return The first repetition of repeating field {@link #network}, creating it
4283   *         if it does not already exist
4284   */
4285  public Reference getNetworkFirstRep() {
4286    if (getNetwork().isEmpty()) {
4287      addNetwork();
4288    }
4289    return getNetwork().get(0);
4290  }
4291
4292  /**
4293   * @deprecated Use Reference#setResource(IBaseResource) instead
4294   */
4295  @Deprecated
4296  public List<Organization> getNetworkTarget() {
4297    if (this.networkTarget == null)
4298      this.networkTarget = new ArrayList<Organization>();
4299    return this.networkTarget;
4300  }
4301
4302  /**
4303   * @deprecated Use Reference#setResource(IBaseResource) instead
4304   */
4305  @Deprecated
4306  public Organization addNetworkTarget() {
4307    Organization r = new Organization();
4308    if (this.networkTarget == null)
4309      this.networkTarget = new ArrayList<Organization>();
4310    this.networkTarget.add(r);
4311    return r;
4312  }
4313
4314  /**
4315   * @return {@link #coverage} (Details about the coverage offered by the
4316   *         insurance product.)
4317   */
4318  public List<InsurancePlanCoverageComponent> getCoverage() {
4319    if (this.coverage == null)
4320      this.coverage = new ArrayList<InsurancePlanCoverageComponent>();
4321    return this.coverage;
4322  }
4323
4324  /**
4325   * @return Returns a reference to <code>this</code> for easy method chaining
4326   */
4327  public InsurancePlan setCoverage(List<InsurancePlanCoverageComponent> theCoverage) {
4328    this.coverage = theCoverage;
4329    return this;
4330  }
4331
4332  public boolean hasCoverage() {
4333    if (this.coverage == null)
4334      return false;
4335    for (InsurancePlanCoverageComponent item : this.coverage)
4336      if (!item.isEmpty())
4337        return true;
4338    return false;
4339  }
4340
4341  public InsurancePlanCoverageComponent addCoverage() { // 3
4342    InsurancePlanCoverageComponent t = new InsurancePlanCoverageComponent();
4343    if (this.coverage == null)
4344      this.coverage = new ArrayList<InsurancePlanCoverageComponent>();
4345    this.coverage.add(t);
4346    return t;
4347  }
4348
4349  public InsurancePlan addCoverage(InsurancePlanCoverageComponent t) { // 3
4350    if (t == null)
4351      return this;
4352    if (this.coverage == null)
4353      this.coverage = new ArrayList<InsurancePlanCoverageComponent>();
4354    this.coverage.add(t);
4355    return this;
4356  }
4357
4358  /**
4359   * @return The first repetition of repeating field {@link #coverage}, creating
4360   *         it if it does not already exist
4361   */
4362  public InsurancePlanCoverageComponent getCoverageFirstRep() {
4363    if (getCoverage().isEmpty()) {
4364      addCoverage();
4365    }
4366    return getCoverage().get(0);
4367  }
4368
4369  /**
4370   * @return {@link #plan} (Details about an insurance plan.)
4371   */
4372  public List<InsurancePlanPlanComponent> getPlan() {
4373    if (this.plan == null)
4374      this.plan = new ArrayList<InsurancePlanPlanComponent>();
4375    return this.plan;
4376  }
4377
4378  /**
4379   * @return Returns a reference to <code>this</code> for easy method chaining
4380   */
4381  public InsurancePlan setPlan(List<InsurancePlanPlanComponent> thePlan) {
4382    this.plan = thePlan;
4383    return this;
4384  }
4385
4386  public boolean hasPlan() {
4387    if (this.plan == null)
4388      return false;
4389    for (InsurancePlanPlanComponent item : this.plan)
4390      if (!item.isEmpty())
4391        return true;
4392    return false;
4393  }
4394
4395  public InsurancePlanPlanComponent addPlan() { // 3
4396    InsurancePlanPlanComponent t = new InsurancePlanPlanComponent();
4397    if (this.plan == null)
4398      this.plan = new ArrayList<InsurancePlanPlanComponent>();
4399    this.plan.add(t);
4400    return t;
4401  }
4402
4403  public InsurancePlan addPlan(InsurancePlanPlanComponent t) { // 3
4404    if (t == null)
4405      return this;
4406    if (this.plan == null)
4407      this.plan = new ArrayList<InsurancePlanPlanComponent>();
4408    this.plan.add(t);
4409    return this;
4410  }
4411
4412  /**
4413   * @return The first repetition of repeating field {@link #plan}, creating it if
4414   *         it does not already exist
4415   */
4416  public InsurancePlanPlanComponent getPlanFirstRep() {
4417    if (getPlan().isEmpty()) {
4418      addPlan();
4419    }
4420    return getPlan().get(0);
4421  }
4422
4423  protected void listChildren(List<Property> children) {
4424    super.listChildren(children);
4425    children.add(new Property("identifier", "Identifier",
4426        "Business identifiers assigned to this health insurance product which remain constant as the resource is updated and propagates from server to server.",
4427        0, java.lang.Integer.MAX_VALUE, identifier));
4428    children.add(new Property("status", "code", "The current state of the health insurance product.", 0, 1, status));
4429    children.add(new Property("type", "CodeableConcept", "The kind of health insurance product.", 0,
4430        java.lang.Integer.MAX_VALUE, type));
4431    children.add(new Property("name", "string",
4432        "Official name of the health insurance product as designated by the owner.", 0, 1, name));
4433    children.add(new Property("alias", "string",
4434        "A list of alternate names that the product is known as, or was known as in the past.", 0,
4435        java.lang.Integer.MAX_VALUE, alias));
4436    children.add(new Property("period", "Period", "The period of time that the health insurance product is available.",
4437        0, 1, period));
4438    children.add(new Property("ownedBy", "Reference(Organization)",
4439        "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'.",
4440        0, 1, ownedBy));
4441    children.add(new Property("administeredBy", "Reference(Organization)",
4442        "An organization which administer other services such as underwriting, customer service and/or claims processing on behalf of the health insurance product owner.",
4443        0, 1, administeredBy));
4444    children.add(new Property("coverageArea", "Reference(Location)",
4445        "The geographic region in which a health insurance product's benefits apply.", 0, java.lang.Integer.MAX_VALUE,
4446        coverageArea));
4447    children.add(new Property("contact", "", "The contact for the health insurance product for a certain purpose.", 0,
4448        java.lang.Integer.MAX_VALUE, contact));
4449    children.add(new Property("endpoint", "Reference(Endpoint)",
4450        "The technical endpoints providing access to services operated for the health insurance product.", 0,
4451        java.lang.Integer.MAX_VALUE, endpoint));
4452    children.add(new Property("network", "Reference(Organization)",
4453        "Reference to the network included in the health insurance product.", 0, java.lang.Integer.MAX_VALUE, network));
4454    children.add(new Property("coverage", "", "Details about the coverage offered by the insurance product.", 0,
4455        java.lang.Integer.MAX_VALUE, coverage));
4456    children.add(new Property("plan", "", "Details about an insurance plan.", 0, java.lang.Integer.MAX_VALUE, plan));
4457  }
4458
4459  @Override
4460  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4461    switch (_hash) {
4462    case -1618432855:
4463      /* identifier */ return new Property("identifier", "Identifier",
4464          "Business identifiers assigned to this health insurance product which remain constant as the resource is updated and propagates from server to server.",
4465          0, java.lang.Integer.MAX_VALUE, identifier);
4466    case -892481550:
4467      /* status */ return new Property("status", "code", "The current state of the health insurance product.", 0, 1,
4468          status);
4469    case 3575610:
4470      /* type */ return new Property("type", "CodeableConcept", "The kind of health insurance product.", 0,
4471          java.lang.Integer.MAX_VALUE, type);
4472    case 3373707:
4473      /* name */ return new Property("name", "string",
4474          "Official name of the health insurance product as designated by the owner.", 0, 1, name);
4475    case 92902992:
4476      /* alias */ return new Property("alias", "string",
4477          "A list of alternate names that the product is known as, or was known as in the past.", 0,
4478          java.lang.Integer.MAX_VALUE, alias);
4479    case -991726143:
4480      /* period */ return new Property("period", "Period",
4481          "The period of time that the health insurance product is available.", 0, 1, period);
4482    case -1054743076:
4483      /* ownedBy */ return new Property("ownedBy", "Reference(Organization)",
4484          "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'.",
4485          0, 1, ownedBy);
4486    case 898770462:
4487      /* administeredBy */ return new Property("administeredBy", "Reference(Organization)",
4488          "An organization which administer other services such as underwriting, customer service and/or claims processing on behalf of the health insurance product owner.",
4489          0, 1, administeredBy);
4490    case -1532328299:
4491      /* coverageArea */ return new Property("coverageArea", "Reference(Location)",
4492          "The geographic region in which a health insurance product's benefits apply.", 0, java.lang.Integer.MAX_VALUE,
4493          coverageArea);
4494    case 951526432:
4495      /* contact */ return new Property("contact", "",
4496          "The contact for the health insurance product for a certain purpose.", 0, java.lang.Integer.MAX_VALUE,
4497          contact);
4498    case 1741102485:
4499      /* endpoint */ return new Property("endpoint", "Reference(Endpoint)",
4500          "The technical endpoints providing access to services operated for the health insurance product.", 0,
4501          java.lang.Integer.MAX_VALUE, endpoint);
4502    case 1843485230:
4503      /* network */ return new Property("network", "Reference(Organization)",
4504          "Reference to the network included in the health insurance product.", 0, java.lang.Integer.MAX_VALUE,
4505          network);
4506    case -351767064:
4507      /* coverage */ return new Property("coverage", "", "Details about the coverage offered by the insurance product.",
4508          0, java.lang.Integer.MAX_VALUE, coverage);
4509    case 3443497:
4510      /* plan */ return new Property("plan", "", "Details about an insurance plan.", 0, java.lang.Integer.MAX_VALUE,
4511          plan);
4512    default:
4513      return super.getNamedProperty(_hash, _name, _checkValid);
4514    }
4515
4516  }
4517
4518  @Override
4519  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4520    switch (hash) {
4521    case -1618432855:
4522      /* identifier */ return this.identifier == null ? new Base[0]
4523          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4524    case -892481550:
4525      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<PublicationStatus>
4526    case 3575610:
4527      /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
4528    case 3373707:
4529      /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
4530    case 92902992:
4531      /* alias */ return this.alias == null ? new Base[0] : this.alias.toArray(new Base[this.alias.size()]); // StringType
4532    case -991726143:
4533      /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Period
4534    case -1054743076:
4535      /* ownedBy */ return this.ownedBy == null ? new Base[0] : new Base[] { this.ownedBy }; // Reference
4536    case 898770462:
4537      /* administeredBy */ return this.administeredBy == null ? new Base[0] : new Base[] { this.administeredBy }; // Reference
4538    case -1532328299:
4539      /* coverageArea */ return this.coverageArea == null ? new Base[0]
4540          : this.coverageArea.toArray(new Base[this.coverageArea.size()]); // Reference
4541    case 951526432:
4542      /* contact */ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // InsurancePlanContactComponent
4543    case 1741102485:
4544      /* endpoint */ return this.endpoint == null ? new Base[0] : this.endpoint.toArray(new Base[this.endpoint.size()]); // Reference
4545    case 1843485230:
4546      /* network */ return this.network == null ? new Base[0] : this.network.toArray(new Base[this.network.size()]); // Reference
4547    case -351767064:
4548      /* coverage */ return this.coverage == null ? new Base[0] : this.coverage.toArray(new Base[this.coverage.size()]); // InsurancePlanCoverageComponent
4549    case 3443497:
4550      /* plan */ return this.plan == null ? new Base[0] : this.plan.toArray(new Base[this.plan.size()]); // InsurancePlanPlanComponent
4551    default:
4552      return super.getProperty(hash, name, checkValid);
4553    }
4554
4555  }
4556
4557  @Override
4558  public Base setProperty(int hash, String name, Base value) throws FHIRException {
4559    switch (hash) {
4560    case -1618432855: // identifier
4561      this.getIdentifier().add(castToIdentifier(value)); // Identifier
4562      return value;
4563    case -892481550: // status
4564      value = new PublicationStatusEnumFactory().fromType(castToCode(value));
4565      this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4566      return value;
4567    case 3575610: // type
4568      this.getType().add(castToCodeableConcept(value)); // CodeableConcept
4569      return value;
4570    case 3373707: // name
4571      this.name = castToString(value); // StringType
4572      return value;
4573    case 92902992: // alias
4574      this.getAlias().add(castToString(value)); // StringType
4575      return value;
4576    case -991726143: // period
4577      this.period = castToPeriod(value); // Period
4578      return value;
4579    case -1054743076: // ownedBy
4580      this.ownedBy = castToReference(value); // Reference
4581      return value;
4582    case 898770462: // administeredBy
4583      this.administeredBy = castToReference(value); // Reference
4584      return value;
4585    case -1532328299: // coverageArea
4586      this.getCoverageArea().add(castToReference(value)); // Reference
4587      return value;
4588    case 951526432: // contact
4589      this.getContact().add((InsurancePlanContactComponent) value); // InsurancePlanContactComponent
4590      return value;
4591    case 1741102485: // endpoint
4592      this.getEndpoint().add(castToReference(value)); // Reference
4593      return value;
4594    case 1843485230: // network
4595      this.getNetwork().add(castToReference(value)); // Reference
4596      return value;
4597    case -351767064: // coverage
4598      this.getCoverage().add((InsurancePlanCoverageComponent) value); // InsurancePlanCoverageComponent
4599      return value;
4600    case 3443497: // plan
4601      this.getPlan().add((InsurancePlanPlanComponent) value); // InsurancePlanPlanComponent
4602      return value;
4603    default:
4604      return super.setProperty(hash, name, value);
4605    }
4606
4607  }
4608
4609  @Override
4610  public Base setProperty(String name, Base value) throws FHIRException {
4611    if (name.equals("identifier")) {
4612      this.getIdentifier().add(castToIdentifier(value));
4613    } else if (name.equals("status")) {
4614      value = new PublicationStatusEnumFactory().fromType(castToCode(value));
4615      this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4616    } else if (name.equals("type")) {
4617      this.getType().add(castToCodeableConcept(value));
4618    } else if (name.equals("name")) {
4619      this.name = castToString(value); // StringType
4620    } else if (name.equals("alias")) {
4621      this.getAlias().add(castToString(value));
4622    } else if (name.equals("period")) {
4623      this.period = castToPeriod(value); // Period
4624    } else if (name.equals("ownedBy")) {
4625      this.ownedBy = castToReference(value); // Reference
4626    } else if (name.equals("administeredBy")) {
4627      this.administeredBy = castToReference(value); // Reference
4628    } else if (name.equals("coverageArea")) {
4629      this.getCoverageArea().add(castToReference(value));
4630    } else if (name.equals("contact")) {
4631      this.getContact().add((InsurancePlanContactComponent) value);
4632    } else if (name.equals("endpoint")) {
4633      this.getEndpoint().add(castToReference(value));
4634    } else if (name.equals("network")) {
4635      this.getNetwork().add(castToReference(value));
4636    } else if (name.equals("coverage")) {
4637      this.getCoverage().add((InsurancePlanCoverageComponent) value);
4638    } else if (name.equals("plan")) {
4639      this.getPlan().add((InsurancePlanPlanComponent) value);
4640    } else
4641      return super.setProperty(name, value);
4642    return value;
4643  }
4644
4645  @Override
4646  public void removeChild(String name, Base value) throws FHIRException {
4647    if (name.equals("identifier")) {
4648      this.getIdentifier().remove(castToIdentifier(value));
4649    } else if (name.equals("status")) {
4650      this.status = null;
4651    } else if (name.equals("type")) {
4652      this.getType().remove(castToCodeableConcept(value));
4653    } else if (name.equals("name")) {
4654      this.name = null;
4655    } else if (name.equals("alias")) {
4656      this.getAlias().remove(castToString(value));
4657    } else if (name.equals("period")) {
4658      this.period = null;
4659    } else if (name.equals("ownedBy")) {
4660      this.ownedBy = null;
4661    } else if (name.equals("administeredBy")) {
4662      this.administeredBy = null;
4663    } else if (name.equals("coverageArea")) {
4664      this.getCoverageArea().remove(castToReference(value));
4665    } else if (name.equals("contact")) {
4666      this.getContact().remove((InsurancePlanContactComponent) value);
4667    } else if (name.equals("endpoint")) {
4668      this.getEndpoint().remove(castToReference(value));
4669    } else if (name.equals("network")) {
4670      this.getNetwork().remove(castToReference(value));
4671    } else if (name.equals("coverage")) {
4672      this.getCoverage().remove((InsurancePlanCoverageComponent) value);
4673    } else if (name.equals("plan")) {
4674      this.getPlan().remove((InsurancePlanPlanComponent) value);
4675    } else
4676      super.removeChild(name, value);
4677    
4678  }
4679
4680  @Override
4681  public Base makeProperty(int hash, String name) throws FHIRException {
4682    switch (hash) {
4683    case -1618432855:
4684      return addIdentifier();
4685    case -892481550:
4686      return getStatusElement();
4687    case 3575610:
4688      return addType();
4689    case 3373707:
4690      return getNameElement();
4691    case 92902992:
4692      return addAliasElement();
4693    case -991726143:
4694      return getPeriod();
4695    case -1054743076:
4696      return getOwnedBy();
4697    case 898770462:
4698      return getAdministeredBy();
4699    case -1532328299:
4700      return addCoverageArea();
4701    case 951526432:
4702      return addContact();
4703    case 1741102485:
4704      return addEndpoint();
4705    case 1843485230:
4706      return addNetwork();
4707    case -351767064:
4708      return addCoverage();
4709    case 3443497:
4710      return addPlan();
4711    default:
4712      return super.makeProperty(hash, name);
4713    }
4714
4715  }
4716
4717  @Override
4718  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4719    switch (hash) {
4720    case -1618432855:
4721      /* identifier */ return new String[] { "Identifier" };
4722    case -892481550:
4723      /* status */ return new String[] { "code" };
4724    case 3575610:
4725      /* type */ return new String[] { "CodeableConcept" };
4726    case 3373707:
4727      /* name */ return new String[] { "string" };
4728    case 92902992:
4729      /* alias */ return new String[] { "string" };
4730    case -991726143:
4731      /* period */ return new String[] { "Period" };
4732    case -1054743076:
4733      /* ownedBy */ return new String[] { "Reference" };
4734    case 898770462:
4735      /* administeredBy */ return new String[] { "Reference" };
4736    case -1532328299:
4737      /* coverageArea */ return new String[] { "Reference" };
4738    case 951526432:
4739      /* contact */ return new String[] {};
4740    case 1741102485:
4741      /* endpoint */ return new String[] { "Reference" };
4742    case 1843485230:
4743      /* network */ return new String[] { "Reference" };
4744    case -351767064:
4745      /* coverage */ return new String[] {};
4746    case 3443497:
4747      /* plan */ return new String[] {};
4748    default:
4749      return super.getTypesForProperty(hash, name);
4750    }
4751
4752  }
4753
4754  @Override
4755  public Base addChild(String name) throws FHIRException {
4756    if (name.equals("identifier")) {
4757      return addIdentifier();
4758    } else if (name.equals("status")) {
4759      throw new FHIRException("Cannot call addChild on a singleton property InsurancePlan.status");
4760    } else if (name.equals("type")) {
4761      return addType();
4762    } else if (name.equals("name")) {
4763      throw new FHIRException("Cannot call addChild on a singleton property InsurancePlan.name");
4764    } else if (name.equals("alias")) {
4765      throw new FHIRException("Cannot call addChild on a singleton property InsurancePlan.alias");
4766    } else if (name.equals("period")) {
4767      this.period = new Period();
4768      return this.period;
4769    } else if (name.equals("ownedBy")) {
4770      this.ownedBy = new Reference();
4771      return this.ownedBy;
4772    } else if (name.equals("administeredBy")) {
4773      this.administeredBy = new Reference();
4774      return this.administeredBy;
4775    } else if (name.equals("coverageArea")) {
4776      return addCoverageArea();
4777    } else if (name.equals("contact")) {
4778      return addContact();
4779    } else if (name.equals("endpoint")) {
4780      return addEndpoint();
4781    } else if (name.equals("network")) {
4782      return addNetwork();
4783    } else if (name.equals("coverage")) {
4784      return addCoverage();
4785    } else if (name.equals("plan")) {
4786      return addPlan();
4787    } else
4788      return super.addChild(name);
4789  }
4790
4791  public String fhirType() {
4792    return "InsurancePlan";
4793
4794  }
4795
4796  public InsurancePlan copy() {
4797    InsurancePlan dst = new InsurancePlan();
4798    copyValues(dst);
4799    return dst;
4800  }
4801
4802  public void copyValues(InsurancePlan dst) {
4803    super.copyValues(dst);
4804    if (identifier != null) {
4805      dst.identifier = new ArrayList<Identifier>();
4806      for (Identifier i : identifier)
4807        dst.identifier.add(i.copy());
4808    }
4809    ;
4810    dst.status = status == null ? null : status.copy();
4811    if (type != null) {
4812      dst.type = new ArrayList<CodeableConcept>();
4813      for (CodeableConcept i : type)
4814        dst.type.add(i.copy());
4815    }
4816    ;
4817    dst.name = name == null ? null : name.copy();
4818    if (alias != null) {
4819      dst.alias = new ArrayList<StringType>();
4820      for (StringType i : alias)
4821        dst.alias.add(i.copy());
4822    }
4823    ;
4824    dst.period = period == null ? null : period.copy();
4825    dst.ownedBy = ownedBy == null ? null : ownedBy.copy();
4826    dst.administeredBy = administeredBy == null ? null : administeredBy.copy();
4827    if (coverageArea != null) {
4828      dst.coverageArea = new ArrayList<Reference>();
4829      for (Reference i : coverageArea)
4830        dst.coverageArea.add(i.copy());
4831    }
4832    ;
4833    if (contact != null) {
4834      dst.contact = new ArrayList<InsurancePlanContactComponent>();
4835      for (InsurancePlanContactComponent i : contact)
4836        dst.contact.add(i.copy());
4837    }
4838    ;
4839    if (endpoint != null) {
4840      dst.endpoint = new ArrayList<Reference>();
4841      for (Reference i : endpoint)
4842        dst.endpoint.add(i.copy());
4843    }
4844    ;
4845    if (network != null) {
4846      dst.network = new ArrayList<Reference>();
4847      for (Reference i : network)
4848        dst.network.add(i.copy());
4849    }
4850    ;
4851    if (coverage != null) {
4852      dst.coverage = new ArrayList<InsurancePlanCoverageComponent>();
4853      for (InsurancePlanCoverageComponent i : coverage)
4854        dst.coverage.add(i.copy());
4855    }
4856    ;
4857    if (plan != null) {
4858      dst.plan = new ArrayList<InsurancePlanPlanComponent>();
4859      for (InsurancePlanPlanComponent i : plan)
4860        dst.plan.add(i.copy());
4861    }
4862    ;
4863  }
4864
4865  protected InsurancePlan typedCopy() {
4866    return copy();
4867  }
4868
4869  @Override
4870  public boolean equalsDeep(Base other_) {
4871    if (!super.equalsDeep(other_))
4872      return false;
4873    if (!(other_ instanceof InsurancePlan))
4874      return false;
4875    InsurancePlan o = (InsurancePlan) other_;
4876    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
4877        && compareDeep(type, o.type, true) && compareDeep(name, o.name, true) && compareDeep(alias, o.alias, true)
4878        && compareDeep(period, o.period, true) && compareDeep(ownedBy, o.ownedBy, true)
4879        && compareDeep(administeredBy, o.administeredBy, true) && compareDeep(coverageArea, o.coverageArea, true)
4880        && compareDeep(contact, o.contact, true) && compareDeep(endpoint, o.endpoint, true)
4881        && compareDeep(network, o.network, true) && compareDeep(coverage, o.coverage, true)
4882        && compareDeep(plan, o.plan, true);
4883  }
4884
4885  @Override
4886  public boolean equalsShallow(Base other_) {
4887    if (!super.equalsShallow(other_))
4888      return false;
4889    if (!(other_ instanceof InsurancePlan))
4890      return false;
4891    InsurancePlan o = (InsurancePlan) other_;
4892    return compareValues(status, o.status, true) && compareValues(name, o.name, true)
4893        && compareValues(alias, o.alias, true);
4894  }
4895
4896  public boolean isEmpty() {
4897    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type, name, alias, period,
4898        ownedBy, administeredBy, coverageArea, contact, endpoint, network, coverage, plan);
4899  }
4900
4901  @Override
4902  public ResourceType getResourceType() {
4903    return ResourceType.InsurancePlan;
4904  }
4905
4906  /**
4907   * Search parameter: <b>identifier</b>
4908   * <p>
4909   * Description: <b>Any identifier for the organization (not the accreditation
4910   * issuer's identifier)</b><br>
4911   * Type: <b>token</b><br>
4912   * Path: <b>InsurancePlan.identifier</b><br>
4913   * </p>
4914   */
4915  @SearchParamDefinition(name = "identifier", path = "InsurancePlan.identifier", description = "Any identifier for the organization (not the accreditation issuer's identifier)", type = "token")
4916  public static final String SP_IDENTIFIER = "identifier";
4917  /**
4918   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4919   * <p>
4920   * Description: <b>Any identifier for the organization (not the accreditation
4921   * issuer's identifier)</b><br>
4922   * Type: <b>token</b><br>
4923   * Path: <b>InsurancePlan.identifier</b><br>
4924   * </p>
4925   */
4926  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4927      SP_IDENTIFIER);
4928
4929  /**
4930   * Search parameter: <b>address</b>
4931   * <p>
4932   * Description: <b>A server defined search that may match any of the string
4933   * fields in the Address, including line, city, district, state, country,
4934   * postalCode, and/or text</b><br>
4935   * Type: <b>string</b><br>
4936   * Path: <b>InsurancePlan.contact.address</b><br>
4937   * </p>
4938   */
4939  @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")
4940  public static final String SP_ADDRESS = "address";
4941  /**
4942   * <b>Fluent Client</b> search parameter constant for <b>address</b>
4943   * <p>
4944   * Description: <b>A server defined search that may match any of the string
4945   * fields in the Address, including line, city, district, state, country,
4946   * postalCode, and/or text</b><br>
4947   * Type: <b>string</b><br>
4948   * Path: <b>InsurancePlan.contact.address</b><br>
4949   * </p>
4950   */
4951  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(
4952      SP_ADDRESS);
4953
4954  /**
4955   * Search parameter: <b>address-state</b>
4956   * <p>
4957   * Description: <b>A state specified in an address</b><br>
4958   * Type: <b>string</b><br>
4959   * Path: <b>InsurancePlan.contact.address.state</b><br>
4960   * </p>
4961   */
4962  @SearchParamDefinition(name = "address-state", path = "InsurancePlan.contact.address.state", description = "A state specified in an address", type = "string")
4963  public static final String SP_ADDRESS_STATE = "address-state";
4964  /**
4965   * <b>Fluent Client</b> search parameter constant for <b>address-state</b>
4966   * <p>
4967   * Description: <b>A state specified in an address</b><br>
4968   * Type: <b>string</b><br>
4969   * Path: <b>InsurancePlan.contact.address.state</b><br>
4970   * </p>
4971   */
4972  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_STATE = new ca.uhn.fhir.rest.gclient.StringClientParam(
4973      SP_ADDRESS_STATE);
4974
4975  /**
4976   * Search parameter: <b>owned-by</b>
4977   * <p>
4978   * Description: <b>An organization of which this organization forms a
4979   * part</b><br>
4980   * Type: <b>reference</b><br>
4981   * Path: <b>InsurancePlan.ownedBy</b><br>
4982   * </p>
4983   */
4984  @SearchParamDefinition(name = "owned-by", path = "InsurancePlan.ownedBy", description = "An organization of which this organization forms a part", type = "reference", target = {
4985      Organization.class })
4986  public static final String SP_OWNED_BY = "owned-by";
4987  /**
4988   * <b>Fluent Client</b> search parameter constant for <b>owned-by</b>
4989   * <p>
4990   * Description: <b>An organization of which this organization forms a
4991   * part</b><br>
4992   * Type: <b>reference</b><br>
4993   * Path: <b>InsurancePlan.ownedBy</b><br>
4994   * </p>
4995   */
4996  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OWNED_BY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4997      SP_OWNED_BY);
4998
4999  /**
5000   * Constant for fluent queries to be used to add include statements. Specifies
5001   * the path value of "<b>InsurancePlan:owned-by</b>".
5002   */
5003  public static final ca.uhn.fhir.model.api.Include INCLUDE_OWNED_BY = new ca.uhn.fhir.model.api.Include(
5004      "InsurancePlan:owned-by").toLocked();
5005
5006  /**
5007   * Search parameter: <b>type</b>
5008   * <p>
5009   * Description: <b>A code for the type of organization</b><br>
5010   * Type: <b>token</b><br>
5011   * Path: <b>InsurancePlan.type</b><br>
5012   * </p>
5013   */
5014  @SearchParamDefinition(name = "type", path = "InsurancePlan.type", description = "A code for the type of organization", type = "token")
5015  public static final String SP_TYPE = "type";
5016  /**
5017   * <b>Fluent Client</b> search parameter constant for <b>type</b>
5018   * <p>
5019   * Description: <b>A code for the type of organization</b><br>
5020   * Type: <b>token</b><br>
5021   * Path: <b>InsurancePlan.type</b><br>
5022   * </p>
5023   */
5024  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
5025      SP_TYPE);
5026
5027  /**
5028   * Search parameter: <b>address-postalcode</b>
5029   * <p>
5030   * Description: <b>A postal code specified in an address</b><br>
5031   * Type: <b>string</b><br>
5032   * Path: <b>InsurancePlan.contact.address.postalCode</b><br>
5033   * </p>
5034   */
5035  @SearchParamDefinition(name = "address-postalcode", path = "InsurancePlan.contact.address.postalCode", description = "A postal code specified in an address", type = "string")
5036  public static final String SP_ADDRESS_POSTALCODE = "address-postalcode";
5037  /**
5038   * <b>Fluent Client</b> search parameter constant for <b>address-postalcode</b>
5039   * <p>
5040   * Description: <b>A postal code specified in an address</b><br>
5041   * Type: <b>string</b><br>
5042   * Path: <b>InsurancePlan.contact.address.postalCode</b><br>
5043   * </p>
5044   */
5045  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_POSTALCODE = new ca.uhn.fhir.rest.gclient.StringClientParam(
5046      SP_ADDRESS_POSTALCODE);
5047
5048  /**
5049   * Search parameter: <b>administered-by</b>
5050   * <p>
5051   * Description: <b>Product administrator</b><br>
5052   * Type: <b>reference</b><br>
5053   * Path: <b>InsurancePlan.administeredBy</b><br>
5054   * </p>
5055   */
5056  @SearchParamDefinition(name = "administered-by", path = "InsurancePlan.administeredBy", description = "Product administrator", type = "reference", target = {
5057      Organization.class })
5058  public static final String SP_ADMINISTERED_BY = "administered-by";
5059  /**
5060   * <b>Fluent Client</b> search parameter constant for <b>administered-by</b>
5061   * <p>
5062   * Description: <b>Product administrator</b><br>
5063   * Type: <b>reference</b><br>
5064   * Path: <b>InsurancePlan.administeredBy</b><br>
5065   * </p>
5066   */
5067  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ADMINISTERED_BY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
5068      SP_ADMINISTERED_BY);
5069
5070  /**
5071   * Constant for fluent queries to be used to add include statements. Specifies
5072   * the path value of "<b>InsurancePlan:administered-by</b>".
5073   */
5074  public static final ca.uhn.fhir.model.api.Include INCLUDE_ADMINISTERED_BY = new ca.uhn.fhir.model.api.Include(
5075      "InsurancePlan:administered-by").toLocked();
5076
5077  /**
5078   * Search parameter: <b>address-country</b>
5079   * <p>
5080   * Description: <b>A country specified in an address</b><br>
5081   * Type: <b>string</b><br>
5082   * Path: <b>InsurancePlan.contact.address.country</b><br>
5083   * </p>
5084   */
5085  @SearchParamDefinition(name = "address-country", path = "InsurancePlan.contact.address.country", description = "A country specified in an address", type = "string")
5086  public static final String SP_ADDRESS_COUNTRY = "address-country";
5087  /**
5088   * <b>Fluent Client</b> search parameter constant for <b>address-country</b>
5089   * <p>
5090   * Description: <b>A country specified in an address</b><br>
5091   * Type: <b>string</b><br>
5092   * Path: <b>InsurancePlan.contact.address.country</b><br>
5093   * </p>
5094   */
5095  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_COUNTRY = new ca.uhn.fhir.rest.gclient.StringClientParam(
5096      SP_ADDRESS_COUNTRY);
5097
5098  /**
5099   * Search parameter: <b>endpoint</b>
5100   * <p>
5101   * Description: <b>Technical endpoint</b><br>
5102   * Type: <b>reference</b><br>
5103   * Path: <b>InsurancePlan.endpoint</b><br>
5104   * </p>
5105   */
5106  @SearchParamDefinition(name = "endpoint", path = "InsurancePlan.endpoint", description = "Technical endpoint", type = "reference", target = {
5107      Endpoint.class })
5108  public static final String SP_ENDPOINT = "endpoint";
5109  /**
5110   * <b>Fluent Client</b> search parameter constant for <b>endpoint</b>
5111   * <p>
5112   * Description: <b>Technical endpoint</b><br>
5113   * Type: <b>reference</b><br>
5114   * Path: <b>InsurancePlan.endpoint</b><br>
5115   * </p>
5116   */
5117  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENDPOINT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
5118      SP_ENDPOINT);
5119
5120  /**
5121   * Constant for fluent queries to be used to add include statements. Specifies
5122   * the path value of "<b>InsurancePlan:endpoint</b>".
5123   */
5124  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENDPOINT = new ca.uhn.fhir.model.api.Include(
5125      "InsurancePlan:endpoint").toLocked();
5126
5127  /**
5128   * Search parameter: <b>phonetic</b>
5129   * <p>
5130   * Description: <b>A portion of the organization's name using some kind of
5131   * phonetic matching algorithm</b><br>
5132   * Type: <b>string</b><br>
5133   * Path: <b>InsurancePlan.name</b><br>
5134   * </p>
5135   */
5136  @SearchParamDefinition(name = "phonetic", path = "InsurancePlan.name", description = "A portion of the organization's name using some kind of phonetic matching algorithm", type = "string")
5137  public static final String SP_PHONETIC = "phonetic";
5138  /**
5139   * <b>Fluent Client</b> search parameter constant for <b>phonetic</b>
5140   * <p>
5141   * Description: <b>A portion of the organization's name using some kind of
5142   * phonetic matching algorithm</b><br>
5143   * Type: <b>string</b><br>
5144   * Path: <b>InsurancePlan.name</b><br>
5145   * </p>
5146   */
5147  public static final ca.uhn.fhir.rest.gclient.StringClientParam PHONETIC = new ca.uhn.fhir.rest.gclient.StringClientParam(
5148      SP_PHONETIC);
5149
5150  /**
5151   * Search parameter: <b>name</b>
5152   * <p>
5153   * Description: <b>A portion of the organization's name or alias</b><br>
5154   * Type: <b>string</b><br>
5155   * Path: <b>InsurancePlan.name, InsurancePlan.alias</b><br>
5156   * </p>
5157   */
5158  @SearchParamDefinition(name = "name", path = "name | alias", description = "A portion of the organization's name or alias", type = "string")
5159  public static final String SP_NAME = "name";
5160  /**
5161   * <b>Fluent Client</b> search parameter constant for <b>name</b>
5162   * <p>
5163   * Description: <b>A portion of the organization's name or alias</b><br>
5164   * Type: <b>string</b><br>
5165   * Path: <b>InsurancePlan.name, InsurancePlan.alias</b><br>
5166   * </p>
5167   */
5168  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(
5169      SP_NAME);
5170
5171  /**
5172   * Search parameter: <b>address-use</b>
5173   * <p>
5174   * Description: <b>A use code specified in an address</b><br>
5175   * Type: <b>token</b><br>
5176   * Path: <b>InsurancePlan.contact.address.use</b><br>
5177   * </p>
5178   */
5179  @SearchParamDefinition(name = "address-use", path = "InsurancePlan.contact.address.use", description = "A use code specified in an address", type = "token")
5180  public static final String SP_ADDRESS_USE = "address-use";
5181  /**
5182   * <b>Fluent Client</b> search parameter constant for <b>address-use</b>
5183   * <p>
5184   * Description: <b>A use code specified in an address</b><br>
5185   * Type: <b>token</b><br>
5186   * Path: <b>InsurancePlan.contact.address.use</b><br>
5187   * </p>
5188   */
5189  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDRESS_USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
5190      SP_ADDRESS_USE);
5191
5192  /**
5193   * Search parameter: <b>address-city</b>
5194   * <p>
5195   * Description: <b>A city specified in an address</b><br>
5196   * Type: <b>string</b><br>
5197   * Path: <b>InsurancePlan.contact.address.city</b><br>
5198   * </p>
5199   */
5200  @SearchParamDefinition(name = "address-city", path = "InsurancePlan.contact.address.city", description = "A city specified in an address", type = "string")
5201  public static final String SP_ADDRESS_CITY = "address-city";
5202  /**
5203   * <b>Fluent Client</b> search parameter constant for <b>address-city</b>
5204   * <p>
5205   * Description: <b>A city specified in an address</b><br>
5206   * Type: <b>string</b><br>
5207   * Path: <b>InsurancePlan.contact.address.city</b><br>
5208   * </p>
5209   */
5210  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_CITY = new ca.uhn.fhir.rest.gclient.StringClientParam(
5211      SP_ADDRESS_CITY);
5212
5213  /**
5214   * Search parameter: <b>status</b>
5215   * <p>
5216   * Description: <b>Is the Organization record active</b><br>
5217   * Type: <b>token</b><br>
5218   * Path: <b>InsurancePlan.status</b><br>
5219   * </p>
5220   */
5221  @SearchParamDefinition(name = "status", path = "InsurancePlan.status", description = "Is the Organization record active", type = "token")
5222  public static final String SP_STATUS = "status";
5223  /**
5224   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5225   * <p>
5226   * Description: <b>Is the Organization record active</b><br>
5227   * Type: <b>token</b><br>
5228   * Path: <b>InsurancePlan.status</b><br>
5229   * </p>
5230   */
5231  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
5232      SP_STATUS);
5233
5234}