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