001package org.hl7.fhir.dstu2016may.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 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.List;
035
036import org.hl7.fhir.exceptions.FHIRException;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.Description;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043/**
044 * Financial instrument which may be used to pay for or reimburse health care products and services.
045 */
046@ResourceDef(name="Coverage", profile="http://hl7.org/fhir/Profile/Coverage")
047public class Coverage extends DomainResource {
048
049    /**
050     * The program or plan underwriter or payor.
051     */
052    @Child(name = "issuer", type = {Identifier.class, Organization.class}, order=0, min=1, max=1, modifier=false, summary=true)
053    @Description(shortDefinition="Identifier for the plan issuer", formalDefinition="The program or plan underwriter or payor." )
054    protected Type issuer;
055
056    /**
057     * Business Identification Number (BIN number) used to identify the routing  of eClaims.
058     */
059    @Child(name = "bin", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
060    @Description(shortDefinition="BIN Number", formalDefinition="Business Identification Number (BIN number) used to identify the routing  of eClaims." )
061    protected StringType bin;
062
063    /**
064     * Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.
065     */
066    @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
067    @Description(shortDefinition="Coverage start and end dates", formalDefinition="Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force." )
068    protected Period period;
069
070    /**
071     * The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.
072     */
073    @Child(name = "type", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
074    @Description(shortDefinition="Type of coverage", formalDefinition="The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health." )
075    protected Coding type;
076
077    /**
078     * The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.
079     */
080    @Child(name = "planholder", type = {Identifier.class, Patient.class, Organization.class}, order=4, min=1, max=1, modifier=true, summary=false)
081    @Description(shortDefinition="Plan holder", formalDefinition="The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due." )
082    protected Type planholder;
083
084    /**
085     * The party who benefits from the insurance coverage.
086     */
087    @Child(name = "beneficiary", type = {Identifier.class, Patient.class}, order=5, min=1, max=1, modifier=true, summary=false)
088    @Description(shortDefinition="Plan Beneficiary", formalDefinition="The party who benefits from the insurance coverage." )
089    protected Type beneficiary;
090
091    /**
092     * The relationship of the patient to the planholdersubscriber).
093     */
094    @Child(name = "relationship", type = {Coding.class}, order=6, min=1, max=1, modifier=false, summary=false)
095    @Description(shortDefinition="Patient relationship to planholder", formalDefinition="The relationship of the patient to the planholdersubscriber)." )
096    protected Coding relationship;
097
098    /**
099     * The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.
100     */
101    @Child(name = "identifier", type = {Identifier.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
102    @Description(shortDefinition="The primary coverage ID", formalDefinition="The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID." )
103    protected List<Identifier> identifier;
104
105    /**
106     * Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
107     */
108    @Child(name = "group", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
109    @Description(shortDefinition="An identifier for the group", formalDefinition="Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID." )
110    protected StringType group;
111
112    /**
113     * Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
114     */
115    @Child(name = "plan", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
116    @Description(shortDefinition="An identifier for the plan", formalDefinition="Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID." )
117    protected StringType plan;
118
119    /**
120     * Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.
121     */
122    @Child(name = "subPlan", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
123    @Description(shortDefinition="An identifier for the subsection of the plan", formalDefinition="Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID." )
124    protected StringType subPlan;
125
126    /**
127     * A unique identifier for a dependent under the coverage.
128     */
129    @Child(name = "dependent", type = {PositiveIntType.class}, order=11, min=0, max=1, modifier=false, summary=true)
130    @Description(shortDefinition="Dependent number", formalDefinition="A unique identifier for a dependent under the coverage." )
131    protected PositiveIntType dependent;
132
133    /**
134     * An optional counter for a particular instance of the identified coverage which increments upon each renewal.
135     */
136    @Child(name = "sequence", type = {PositiveIntType.class}, order=12, min=0, max=1, modifier=false, summary=true)
137    @Description(shortDefinition="The plan instance or sequence counter", formalDefinition="An optional counter for a particular instance of the identified coverage which increments upon each renewal." )
138    protected PositiveIntType sequence;
139
140    /**
141     * Factors which may influence the applicability of coverage.
142     */
143    @Child(name = "exception", type = {Coding.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
144    @Description(shortDefinition="Eligibility exceptions", formalDefinition="Factors which may influence the applicability of coverage." )
145    protected List<Coding> exception;
146
147    /**
148     * Name of school for over-aged dependants.
149     */
150    @Child(name = "school", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=false)
151    @Description(shortDefinition="Name of School", formalDefinition="Name of school for over-aged dependants." )
152    protected StringType school;
153
154    /**
155     * The identifier for a community of providers.
156     */
157    @Child(name = "network", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=true)
158    @Description(shortDefinition="Insurer network", formalDefinition="The identifier for a community of providers." )
159    protected StringType network;
160
161    /**
162     * The policy(s) which constitute this insurance coverage.
163     */
164    @Child(name = "contract", type = {Contract.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
165    @Description(shortDefinition="Contract details", formalDefinition="The policy(s) which constitute this insurance coverage." )
166    protected List<Reference> contract;
167    /**
168     * The actual objects that are the target of the reference (The policy(s) which constitute this insurance coverage.)
169     */
170    protected List<Contract> contractTarget;
171
172
173    private static final long serialVersionUID = -1269320450L;
174
175  /**
176   * Constructor
177   */
178    public Coverage() {
179      super();
180    }
181
182  /**
183   * Constructor
184   */
185    public Coverage(Type issuer, Type planholder, Type beneficiary, Coding relationship) {
186      super();
187      this.issuer = issuer;
188      this.planholder = planholder;
189      this.beneficiary = beneficiary;
190      this.relationship = relationship;
191    }
192
193    /**
194     * @return {@link #issuer} (The program or plan underwriter or payor.)
195     */
196    public Type getIssuer() { 
197      return this.issuer;
198    }
199
200    /**
201     * @return {@link #issuer} (The program or plan underwriter or payor.)
202     */
203    public Identifier getIssuerIdentifier() throws FHIRException { 
204      if (!(this.issuer instanceof Identifier))
205        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.issuer.getClass().getName()+" was encountered");
206      return (Identifier) this.issuer;
207    }
208
209    public boolean hasIssuerIdentifier() { 
210      return this.issuer instanceof Identifier;
211    }
212
213    /**
214     * @return {@link #issuer} (The program or plan underwriter or payor.)
215     */
216    public Reference getIssuerReference() throws FHIRException { 
217      if (!(this.issuer instanceof Reference))
218        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.issuer.getClass().getName()+" was encountered");
219      return (Reference) this.issuer;
220    }
221
222    public boolean hasIssuerReference() { 
223      return this.issuer instanceof Reference;
224    }
225
226    public boolean hasIssuer() { 
227      return this.issuer != null && !this.issuer.isEmpty();
228    }
229
230    /**
231     * @param value {@link #issuer} (The program or plan underwriter or payor.)
232     */
233    public Coverage setIssuer(Type value) { 
234      this.issuer = value;
235      return this;
236    }
237
238    /**
239     * @return {@link #bin} (Business Identification Number (BIN number) used to identify the routing  of eClaims.). This is the underlying object with id, value and extensions. The accessor "getBin" gives direct access to the value
240     */
241    public StringType getBinElement() { 
242      if (this.bin == null)
243        if (Configuration.errorOnAutoCreate())
244          throw new Error("Attempt to auto-create Coverage.bin");
245        else if (Configuration.doAutoCreate())
246          this.bin = new StringType(); // bb
247      return this.bin;
248    }
249
250    public boolean hasBinElement() { 
251      return this.bin != null && !this.bin.isEmpty();
252    }
253
254    public boolean hasBin() { 
255      return this.bin != null && !this.bin.isEmpty();
256    }
257
258    /**
259     * @param value {@link #bin} (Business Identification Number (BIN number) used to identify the routing  of eClaims.). This is the underlying object with id, value and extensions. The accessor "getBin" gives direct access to the value
260     */
261    public Coverage setBinElement(StringType value) { 
262      this.bin = value;
263      return this;
264    }
265
266    /**
267     * @return Business Identification Number (BIN number) used to identify the routing  of eClaims.
268     */
269    public String getBin() { 
270      return this.bin == null ? null : this.bin.getValue();
271    }
272
273    /**
274     * @param value Business Identification Number (BIN number) used to identify the routing  of eClaims.
275     */
276    public Coverage setBin(String value) { 
277      if (Utilities.noString(value))
278        this.bin = null;
279      else {
280        if (this.bin == null)
281          this.bin = new StringType();
282        this.bin.setValue(value);
283      }
284      return this;
285    }
286
287    /**
288     * @return {@link #period} (Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.)
289     */
290    public Period getPeriod() { 
291      if (this.period == null)
292        if (Configuration.errorOnAutoCreate())
293          throw new Error("Attempt to auto-create Coverage.period");
294        else if (Configuration.doAutoCreate())
295          this.period = new Period(); // cc
296      return this.period;
297    }
298
299    public boolean hasPeriod() { 
300      return this.period != null && !this.period.isEmpty();
301    }
302
303    /**
304     * @param value {@link #period} (Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.)
305     */
306    public Coverage setPeriod(Period value) { 
307      this.period = value;
308      return this;
309    }
310
311    /**
312     * @return {@link #type} (The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.)
313     */
314    public Coding getType() { 
315      if (this.type == null)
316        if (Configuration.errorOnAutoCreate())
317          throw new Error("Attempt to auto-create Coverage.type");
318        else if (Configuration.doAutoCreate())
319          this.type = new Coding(); // cc
320      return this.type;
321    }
322
323    public boolean hasType() { 
324      return this.type != null && !this.type.isEmpty();
325    }
326
327    /**
328     * @param value {@link #type} (The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.)
329     */
330    public Coverage setType(Coding value) { 
331      this.type = value;
332      return this;
333    }
334
335    /**
336     * @return {@link #planholder} (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.)
337     */
338    public Type getPlanholder() { 
339      return this.planholder;
340    }
341
342    /**
343     * @return {@link #planholder} (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.)
344     */
345    public Identifier getPlanholderIdentifier() throws FHIRException { 
346      if (!(this.planholder instanceof Identifier))
347        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.planholder.getClass().getName()+" was encountered");
348      return (Identifier) this.planholder;
349    }
350
351    public boolean hasPlanholderIdentifier() { 
352      return this.planholder instanceof Identifier;
353    }
354
355    /**
356     * @return {@link #planholder} (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.)
357     */
358    public Reference getPlanholderReference() throws FHIRException { 
359      if (!(this.planholder instanceof Reference))
360        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.planholder.getClass().getName()+" was encountered");
361      return (Reference) this.planholder;
362    }
363
364    public boolean hasPlanholderReference() { 
365      return this.planholder instanceof Reference;
366    }
367
368    public boolean hasPlanholder() { 
369      return this.planholder != null && !this.planholder.isEmpty();
370    }
371
372    /**
373     * @param value {@link #planholder} (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.)
374     */
375    public Coverage setPlanholder(Type value) { 
376      this.planholder = value;
377      return this;
378    }
379
380    /**
381     * @return {@link #beneficiary} (The party who benefits from the insurance coverage.)
382     */
383    public Type getBeneficiary() { 
384      return this.beneficiary;
385    }
386
387    /**
388     * @return {@link #beneficiary} (The party who benefits from the insurance coverage.)
389     */
390    public Identifier getBeneficiaryIdentifier() throws FHIRException { 
391      if (!(this.beneficiary instanceof Identifier))
392        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.beneficiary.getClass().getName()+" was encountered");
393      return (Identifier) this.beneficiary;
394    }
395
396    public boolean hasBeneficiaryIdentifier() { 
397      return this.beneficiary instanceof Identifier;
398    }
399
400    /**
401     * @return {@link #beneficiary} (The party who benefits from the insurance coverage.)
402     */
403    public Reference getBeneficiaryReference() throws FHIRException { 
404      if (!(this.beneficiary instanceof Reference))
405        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.beneficiary.getClass().getName()+" was encountered");
406      return (Reference) this.beneficiary;
407    }
408
409    public boolean hasBeneficiaryReference() { 
410      return this.beneficiary instanceof Reference;
411    }
412
413    public boolean hasBeneficiary() { 
414      return this.beneficiary != null && !this.beneficiary.isEmpty();
415    }
416
417    /**
418     * @param value {@link #beneficiary} (The party who benefits from the insurance coverage.)
419     */
420    public Coverage setBeneficiary(Type value) { 
421      this.beneficiary = value;
422      return this;
423    }
424
425    /**
426     * @return {@link #relationship} (The relationship of the patient to the planholdersubscriber).)
427     */
428    public Coding getRelationship() { 
429      if (this.relationship == null)
430        if (Configuration.errorOnAutoCreate())
431          throw new Error("Attempt to auto-create Coverage.relationship");
432        else if (Configuration.doAutoCreate())
433          this.relationship = new Coding(); // cc
434      return this.relationship;
435    }
436
437    public boolean hasRelationship() { 
438      return this.relationship != null && !this.relationship.isEmpty();
439    }
440
441    /**
442     * @param value {@link #relationship} (The relationship of the patient to the planholdersubscriber).)
443     */
444    public Coverage setRelationship(Coding value) { 
445      this.relationship = value;
446      return this;
447    }
448
449    /**
450     * @return {@link #identifier} (The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.)
451     */
452    public List<Identifier> getIdentifier() { 
453      if (this.identifier == null)
454        this.identifier = new ArrayList<Identifier>();
455      return this.identifier;
456    }
457
458    public boolean hasIdentifier() { 
459      if (this.identifier == null)
460        return false;
461      for (Identifier item : this.identifier)
462        if (!item.isEmpty())
463          return true;
464      return false;
465    }
466
467    /**
468     * @return {@link #identifier} (The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.)
469     */
470    // syntactic sugar
471    public Identifier addIdentifier() { //3
472      Identifier t = new Identifier();
473      if (this.identifier == null)
474        this.identifier = new ArrayList<Identifier>();
475      this.identifier.add(t);
476      return t;
477    }
478
479    // syntactic sugar
480    public Coverage addIdentifier(Identifier t) { //3
481      if (t == null)
482        return this;
483      if (this.identifier == null)
484        this.identifier = new ArrayList<Identifier>();
485      this.identifier.add(t);
486      return this;
487    }
488
489    /**
490     * @return {@link #group} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getGroup" gives direct access to the value
491     */
492    public StringType getGroupElement() { 
493      if (this.group == null)
494        if (Configuration.errorOnAutoCreate())
495          throw new Error("Attempt to auto-create Coverage.group");
496        else if (Configuration.doAutoCreate())
497          this.group = new StringType(); // bb
498      return this.group;
499    }
500
501    public boolean hasGroupElement() { 
502      return this.group != null && !this.group.isEmpty();
503    }
504
505    public boolean hasGroup() { 
506      return this.group != null && !this.group.isEmpty();
507    }
508
509    /**
510     * @param value {@link #group} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getGroup" gives direct access to the value
511     */
512    public Coverage setGroupElement(StringType value) { 
513      this.group = value;
514      return this;
515    }
516
517    /**
518     * @return Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
519     */
520    public String getGroup() { 
521      return this.group == null ? null : this.group.getValue();
522    }
523
524    /**
525     * @param value Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
526     */
527    public Coverage setGroup(String value) { 
528      if (Utilities.noString(value))
529        this.group = null;
530      else {
531        if (this.group == null)
532          this.group = new StringType();
533        this.group.setValue(value);
534      }
535      return this;
536    }
537
538    /**
539     * @return {@link #plan} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getPlan" gives direct access to the value
540     */
541    public StringType getPlanElement() { 
542      if (this.plan == null)
543        if (Configuration.errorOnAutoCreate())
544          throw new Error("Attempt to auto-create Coverage.plan");
545        else if (Configuration.doAutoCreate())
546          this.plan = new StringType(); // bb
547      return this.plan;
548    }
549
550    public boolean hasPlanElement() { 
551      return this.plan != null && !this.plan.isEmpty();
552    }
553
554    public boolean hasPlan() { 
555      return this.plan != null && !this.plan.isEmpty();
556    }
557
558    /**
559     * @param value {@link #plan} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getPlan" gives direct access to the value
560     */
561    public Coverage setPlanElement(StringType value) { 
562      this.plan = value;
563      return this;
564    }
565
566    /**
567     * @return Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
568     */
569    public String getPlan() { 
570      return this.plan == null ? null : this.plan.getValue();
571    }
572
573    /**
574     * @param value Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
575     */
576    public Coverage setPlan(String value) { 
577      if (Utilities.noString(value))
578        this.plan = null;
579      else {
580        if (this.plan == null)
581          this.plan = new StringType();
582        this.plan.setValue(value);
583      }
584      return this;
585    }
586
587    /**
588     * @return {@link #subPlan} (Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.). This is the underlying object with id, value and extensions. The accessor "getSubPlan" gives direct access to the value
589     */
590    public StringType getSubPlanElement() { 
591      if (this.subPlan == null)
592        if (Configuration.errorOnAutoCreate())
593          throw new Error("Attempt to auto-create Coverage.subPlan");
594        else if (Configuration.doAutoCreate())
595          this.subPlan = new StringType(); // bb
596      return this.subPlan;
597    }
598
599    public boolean hasSubPlanElement() { 
600      return this.subPlan != null && !this.subPlan.isEmpty();
601    }
602
603    public boolean hasSubPlan() { 
604      return this.subPlan != null && !this.subPlan.isEmpty();
605    }
606
607    /**
608     * @param value {@link #subPlan} (Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.). This is the underlying object with id, value and extensions. The accessor "getSubPlan" gives direct access to the value
609     */
610    public Coverage setSubPlanElement(StringType value) { 
611      this.subPlan = value;
612      return this;
613    }
614
615    /**
616     * @return Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.
617     */
618    public String getSubPlan() { 
619      return this.subPlan == null ? null : this.subPlan.getValue();
620    }
621
622    /**
623     * @param value Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.
624     */
625    public Coverage setSubPlan(String value) { 
626      if (Utilities.noString(value))
627        this.subPlan = null;
628      else {
629        if (this.subPlan == null)
630          this.subPlan = new StringType();
631        this.subPlan.setValue(value);
632      }
633      return this;
634    }
635
636    /**
637     * @return {@link #dependent} (A unique identifier for a dependent under the coverage.). This is the underlying object with id, value and extensions. The accessor "getDependent" gives direct access to the value
638     */
639    public PositiveIntType getDependentElement() { 
640      if (this.dependent == null)
641        if (Configuration.errorOnAutoCreate())
642          throw new Error("Attempt to auto-create Coverage.dependent");
643        else if (Configuration.doAutoCreate())
644          this.dependent = new PositiveIntType(); // bb
645      return this.dependent;
646    }
647
648    public boolean hasDependentElement() { 
649      return this.dependent != null && !this.dependent.isEmpty();
650    }
651
652    public boolean hasDependent() { 
653      return this.dependent != null && !this.dependent.isEmpty();
654    }
655
656    /**
657     * @param value {@link #dependent} (A unique identifier for a dependent under the coverage.). This is the underlying object with id, value and extensions. The accessor "getDependent" gives direct access to the value
658     */
659    public Coverage setDependentElement(PositiveIntType value) { 
660      this.dependent = value;
661      return this;
662    }
663
664    /**
665     * @return A unique identifier for a dependent under the coverage.
666     */
667    public int getDependent() { 
668      return this.dependent == null || this.dependent.isEmpty() ? 0 : this.dependent.getValue();
669    }
670
671    /**
672     * @param value A unique identifier for a dependent under the coverage.
673     */
674    public Coverage setDependent(int value) { 
675        if (this.dependent == null)
676          this.dependent = new PositiveIntType();
677        this.dependent.setValue(value);
678      return this;
679    }
680
681    /**
682     * @return {@link #sequence} (An optional counter for a particular instance of the identified coverage which increments upon each renewal.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
683     */
684    public PositiveIntType getSequenceElement() { 
685      if (this.sequence == null)
686        if (Configuration.errorOnAutoCreate())
687          throw new Error("Attempt to auto-create Coverage.sequence");
688        else if (Configuration.doAutoCreate())
689          this.sequence = new PositiveIntType(); // bb
690      return this.sequence;
691    }
692
693    public boolean hasSequenceElement() { 
694      return this.sequence != null && !this.sequence.isEmpty();
695    }
696
697    public boolean hasSequence() { 
698      return this.sequence != null && !this.sequence.isEmpty();
699    }
700
701    /**
702     * @param value {@link #sequence} (An optional counter for a particular instance of the identified coverage which increments upon each renewal.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
703     */
704    public Coverage setSequenceElement(PositiveIntType value) { 
705      this.sequence = value;
706      return this;
707    }
708
709    /**
710     * @return An optional counter for a particular instance of the identified coverage which increments upon each renewal.
711     */
712    public int getSequence() { 
713      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
714    }
715
716    /**
717     * @param value An optional counter for a particular instance of the identified coverage which increments upon each renewal.
718     */
719    public Coverage setSequence(int value) { 
720        if (this.sequence == null)
721          this.sequence = new PositiveIntType();
722        this.sequence.setValue(value);
723      return this;
724    }
725
726    /**
727     * @return {@link #exception} (Factors which may influence the applicability of coverage.)
728     */
729    public List<Coding> getException() { 
730      if (this.exception == null)
731        this.exception = new ArrayList<Coding>();
732      return this.exception;
733    }
734
735    public boolean hasException() { 
736      if (this.exception == null)
737        return false;
738      for (Coding item : this.exception)
739        if (!item.isEmpty())
740          return true;
741      return false;
742    }
743
744    /**
745     * @return {@link #exception} (Factors which may influence the applicability of coverage.)
746     */
747    // syntactic sugar
748    public Coding addException() { //3
749      Coding t = new Coding();
750      if (this.exception == null)
751        this.exception = new ArrayList<Coding>();
752      this.exception.add(t);
753      return t;
754    }
755
756    // syntactic sugar
757    public Coverage addException(Coding t) { //3
758      if (t == null)
759        return this;
760      if (this.exception == null)
761        this.exception = new ArrayList<Coding>();
762      this.exception.add(t);
763      return this;
764    }
765
766    /**
767     * @return {@link #school} (Name of school for over-aged dependants.). This is the underlying object with id, value and extensions. The accessor "getSchool" gives direct access to the value
768     */
769    public StringType getSchoolElement() { 
770      if (this.school == null)
771        if (Configuration.errorOnAutoCreate())
772          throw new Error("Attempt to auto-create Coverage.school");
773        else if (Configuration.doAutoCreate())
774          this.school = new StringType(); // bb
775      return this.school;
776    }
777
778    public boolean hasSchoolElement() { 
779      return this.school != null && !this.school.isEmpty();
780    }
781
782    public boolean hasSchool() { 
783      return this.school != null && !this.school.isEmpty();
784    }
785
786    /**
787     * @param value {@link #school} (Name of school for over-aged dependants.). This is the underlying object with id, value and extensions. The accessor "getSchool" gives direct access to the value
788     */
789    public Coverage setSchoolElement(StringType value) { 
790      this.school = value;
791      return this;
792    }
793
794    /**
795     * @return Name of school for over-aged dependants.
796     */
797    public String getSchool() { 
798      return this.school == null ? null : this.school.getValue();
799    }
800
801    /**
802     * @param value Name of school for over-aged dependants.
803     */
804    public Coverage setSchool(String value) { 
805      if (Utilities.noString(value))
806        this.school = null;
807      else {
808        if (this.school == null)
809          this.school = new StringType();
810        this.school.setValue(value);
811      }
812      return this;
813    }
814
815    /**
816     * @return {@link #network} (The identifier for a community of providers.). This is the underlying object with id, value and extensions. The accessor "getNetwork" gives direct access to the value
817     */
818    public StringType getNetworkElement() { 
819      if (this.network == null)
820        if (Configuration.errorOnAutoCreate())
821          throw new Error("Attempt to auto-create Coverage.network");
822        else if (Configuration.doAutoCreate())
823          this.network = new StringType(); // bb
824      return this.network;
825    }
826
827    public boolean hasNetworkElement() { 
828      return this.network != null && !this.network.isEmpty();
829    }
830
831    public boolean hasNetwork() { 
832      return this.network != null && !this.network.isEmpty();
833    }
834
835    /**
836     * @param value {@link #network} (The identifier for a community of providers.). This is the underlying object with id, value and extensions. The accessor "getNetwork" gives direct access to the value
837     */
838    public Coverage setNetworkElement(StringType value) { 
839      this.network = value;
840      return this;
841    }
842
843    /**
844     * @return The identifier for a community of providers.
845     */
846    public String getNetwork() { 
847      return this.network == null ? null : this.network.getValue();
848    }
849
850    /**
851     * @param value The identifier for a community of providers.
852     */
853    public Coverage setNetwork(String value) { 
854      if (Utilities.noString(value))
855        this.network = null;
856      else {
857        if (this.network == null)
858          this.network = new StringType();
859        this.network.setValue(value);
860      }
861      return this;
862    }
863
864    /**
865     * @return {@link #contract} (The policy(s) which constitute this insurance coverage.)
866     */
867    public List<Reference> getContract() { 
868      if (this.contract == null)
869        this.contract = new ArrayList<Reference>();
870      return this.contract;
871    }
872
873    public boolean hasContract() { 
874      if (this.contract == null)
875        return false;
876      for (Reference item : this.contract)
877        if (!item.isEmpty())
878          return true;
879      return false;
880    }
881
882    /**
883     * @return {@link #contract} (The policy(s) which constitute this insurance coverage.)
884     */
885    // syntactic sugar
886    public Reference addContract() { //3
887      Reference t = new Reference();
888      if (this.contract == null)
889        this.contract = new ArrayList<Reference>();
890      this.contract.add(t);
891      return t;
892    }
893
894    // syntactic sugar
895    public Coverage addContract(Reference t) { //3
896      if (t == null)
897        return this;
898      if (this.contract == null)
899        this.contract = new ArrayList<Reference>();
900      this.contract.add(t);
901      return this;
902    }
903
904    /**
905     * @return {@link #contract} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. The policy(s) which constitute this insurance coverage.)
906     */
907    public List<Contract> getContractTarget() { 
908      if (this.contractTarget == null)
909        this.contractTarget = new ArrayList<Contract>();
910      return this.contractTarget;
911    }
912
913    // syntactic sugar
914    /**
915     * @return {@link #contract} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The policy(s) which constitute this insurance coverage.)
916     */
917    public Contract addContractTarget() { 
918      Contract r = new Contract();
919      if (this.contractTarget == null)
920        this.contractTarget = new ArrayList<Contract>();
921      this.contractTarget.add(r);
922      return r;
923    }
924
925      protected void listChildren(List<Property> childrenList) {
926        super.listChildren(childrenList);
927        childrenList.add(new Property("issuer[x]", "Identifier|Reference(Organization)", "The program or plan underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, issuer));
928        childrenList.add(new Property("bin", "string", "Business Identification Number (BIN number) used to identify the routing  of eClaims.", 0, java.lang.Integer.MAX_VALUE, bin));
929        childrenList.add(new Property("period", "Period", "Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.", 0, java.lang.Integer.MAX_VALUE, period));
930        childrenList.add(new Property("type", "Coding", "The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.", 0, java.lang.Integer.MAX_VALUE, type));
931        childrenList.add(new Property("planholder[x]", "Identifier|Reference(Patient|Organization)", "The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.", 0, java.lang.Integer.MAX_VALUE, planholder));
932        childrenList.add(new Property("beneficiary[x]", "Identifier|Reference(Patient)", "The party who benefits from the insurance coverage.", 0, java.lang.Integer.MAX_VALUE, beneficiary));
933        childrenList.add(new Property("relationship", "Coding", "The relationship of the patient to the planholdersubscriber).", 0, java.lang.Integer.MAX_VALUE, relationship));
934        childrenList.add(new Property("identifier", "Identifier", "The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.", 0, java.lang.Integer.MAX_VALUE, identifier));
935        childrenList.add(new Property("group", "string", "Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.", 0, java.lang.Integer.MAX_VALUE, group));
936        childrenList.add(new Property("plan", "string", "Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.", 0, java.lang.Integer.MAX_VALUE, plan));
937        childrenList.add(new Property("subPlan", "string", "Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.", 0, java.lang.Integer.MAX_VALUE, subPlan));
938        childrenList.add(new Property("dependent", "positiveInt", "A unique identifier for a dependent under the coverage.", 0, java.lang.Integer.MAX_VALUE, dependent));
939        childrenList.add(new Property("sequence", "positiveInt", "An optional counter for a particular instance of the identified coverage which increments upon each renewal.", 0, java.lang.Integer.MAX_VALUE, sequence));
940        childrenList.add(new Property("exception", "Coding", "Factors which may influence the applicability of coverage.", 0, java.lang.Integer.MAX_VALUE, exception));
941        childrenList.add(new Property("school", "string", "Name of school for over-aged dependants.", 0, java.lang.Integer.MAX_VALUE, school));
942        childrenList.add(new Property("network", "string", "The identifier for a community of providers.", 0, java.lang.Integer.MAX_VALUE, network));
943        childrenList.add(new Property("contract", "Reference(Contract)", "The policy(s) which constitute this insurance coverage.", 0, java.lang.Integer.MAX_VALUE, contract));
944      }
945
946      @Override
947      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
948        switch (hash) {
949        case -1179159879: /*issuer*/ return this.issuer == null ? new Base[0] : new Base[] {this.issuer}; // Type
950        case 97543: /*bin*/ return this.bin == null ? new Base[0] : new Base[] {this.bin}; // StringType
951        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
952        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
953        case 1007064597: /*planholder*/ return this.planholder == null ? new Base[0] : new Base[] {this.planholder}; // Type
954        case -565102875: /*beneficiary*/ return this.beneficiary == null ? new Base[0] : new Base[] {this.beneficiary}; // Type
955        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Coding
956        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
957        case 98629247: /*group*/ return this.group == null ? new Base[0] : new Base[] {this.group}; // StringType
958        case 3443497: /*plan*/ return this.plan == null ? new Base[0] : new Base[] {this.plan}; // StringType
959        case -1868653175: /*subPlan*/ return this.subPlan == null ? new Base[0] : new Base[] {this.subPlan}; // StringType
960        case -1109226753: /*dependent*/ return this.dependent == null ? new Base[0] : new Base[] {this.dependent}; // PositiveIntType
961        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
962        case 1481625679: /*exception*/ return this.exception == null ? new Base[0] : this.exception.toArray(new Base[this.exception.size()]); // Coding
963        case -907977868: /*school*/ return this.school == null ? new Base[0] : new Base[] {this.school}; // StringType
964        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // StringType
965        case -566947566: /*contract*/ return this.contract == null ? new Base[0] : this.contract.toArray(new Base[this.contract.size()]); // Reference
966        default: return super.getProperty(hash, name, checkValid);
967        }
968
969      }
970
971      @Override
972      public void setProperty(int hash, String name, Base value) throws FHIRException {
973        switch (hash) {
974        case -1179159879: // issuer
975          this.issuer = (Type) value; // Type
976          break;
977        case 97543: // bin
978          this.bin = castToString(value); // StringType
979          break;
980        case -991726143: // period
981          this.period = castToPeriod(value); // Period
982          break;
983        case 3575610: // type
984          this.type = castToCoding(value); // Coding
985          break;
986        case 1007064597: // planholder
987          this.planholder = (Type) value; // Type
988          break;
989        case -565102875: // beneficiary
990          this.beneficiary = (Type) value; // Type
991          break;
992        case -261851592: // relationship
993          this.relationship = castToCoding(value); // Coding
994          break;
995        case -1618432855: // identifier
996          this.getIdentifier().add(castToIdentifier(value)); // Identifier
997          break;
998        case 98629247: // group
999          this.group = castToString(value); // StringType
1000          break;
1001        case 3443497: // plan
1002          this.plan = castToString(value); // StringType
1003          break;
1004        case -1868653175: // subPlan
1005          this.subPlan = castToString(value); // StringType
1006          break;
1007        case -1109226753: // dependent
1008          this.dependent = castToPositiveInt(value); // PositiveIntType
1009          break;
1010        case 1349547969: // sequence
1011          this.sequence = castToPositiveInt(value); // PositiveIntType
1012          break;
1013        case 1481625679: // exception
1014          this.getException().add(castToCoding(value)); // Coding
1015          break;
1016        case -907977868: // school
1017          this.school = castToString(value); // StringType
1018          break;
1019        case 1843485230: // network
1020          this.network = castToString(value); // StringType
1021          break;
1022        case -566947566: // contract
1023          this.getContract().add(castToReference(value)); // Reference
1024          break;
1025        default: super.setProperty(hash, name, value);
1026        }
1027
1028      }
1029
1030      @Override
1031      public void setProperty(String name, Base value) throws FHIRException {
1032        if (name.equals("issuer[x]"))
1033          this.issuer = (Type) value; // Type
1034        else if (name.equals("bin"))
1035          this.bin = castToString(value); // StringType
1036        else if (name.equals("period"))
1037          this.period = castToPeriod(value); // Period
1038        else if (name.equals("type"))
1039          this.type = castToCoding(value); // Coding
1040        else if (name.equals("planholder[x]"))
1041          this.planholder = (Type) value; // Type
1042        else if (name.equals("beneficiary[x]"))
1043          this.beneficiary = (Type) value; // Type
1044        else if (name.equals("relationship"))
1045          this.relationship = castToCoding(value); // Coding
1046        else if (name.equals("identifier"))
1047          this.getIdentifier().add(castToIdentifier(value));
1048        else if (name.equals("group"))
1049          this.group = castToString(value); // StringType
1050        else if (name.equals("plan"))
1051          this.plan = castToString(value); // StringType
1052        else if (name.equals("subPlan"))
1053          this.subPlan = castToString(value); // StringType
1054        else if (name.equals("dependent"))
1055          this.dependent = castToPositiveInt(value); // PositiveIntType
1056        else if (name.equals("sequence"))
1057          this.sequence = castToPositiveInt(value); // PositiveIntType
1058        else if (name.equals("exception"))
1059          this.getException().add(castToCoding(value));
1060        else if (name.equals("school"))
1061          this.school = castToString(value); // StringType
1062        else if (name.equals("network"))
1063          this.network = castToString(value); // StringType
1064        else if (name.equals("contract"))
1065          this.getContract().add(castToReference(value));
1066        else
1067          super.setProperty(name, value);
1068      }
1069
1070      @Override
1071      public Base makeProperty(int hash, String name) throws FHIRException {
1072        switch (hash) {
1073        case 185649959:  return getIssuer(); // Type
1074        case 97543: throw new FHIRException("Cannot make property bin as it is not a complex type"); // StringType
1075        case -991726143:  return getPeriod(); // Period
1076        case 3575610:  return getType(); // Coding
1077        case 1114937931:  return getPlanholder(); // Type
1078        case 1292142459:  return getBeneficiary(); // Type
1079        case -261851592:  return getRelationship(); // Coding
1080        case -1618432855:  return addIdentifier(); // Identifier
1081        case 98629247: throw new FHIRException("Cannot make property group as it is not a complex type"); // StringType
1082        case 3443497: throw new FHIRException("Cannot make property plan as it is not a complex type"); // StringType
1083        case -1868653175: throw new FHIRException("Cannot make property subPlan as it is not a complex type"); // StringType
1084        case -1109226753: throw new FHIRException("Cannot make property dependent as it is not a complex type"); // PositiveIntType
1085        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
1086        case 1481625679:  return addException(); // Coding
1087        case -907977868: throw new FHIRException("Cannot make property school as it is not a complex type"); // StringType
1088        case 1843485230: throw new FHIRException("Cannot make property network as it is not a complex type"); // StringType
1089        case -566947566:  return addContract(); // Reference
1090        default: return super.makeProperty(hash, name);
1091        }
1092
1093      }
1094
1095      @Override
1096      public Base addChild(String name) throws FHIRException {
1097        if (name.equals("issuerIdentifier")) {
1098          this.issuer = new Identifier();
1099          return this.issuer;
1100        }
1101        else if (name.equals("issuerReference")) {
1102          this.issuer = new Reference();
1103          return this.issuer;
1104        }
1105        else if (name.equals("bin")) {
1106          throw new FHIRException("Cannot call addChild on a primitive type Coverage.bin");
1107        }
1108        else if (name.equals("period")) {
1109          this.period = new Period();
1110          return this.period;
1111        }
1112        else if (name.equals("type")) {
1113          this.type = new Coding();
1114          return this.type;
1115        }
1116        else if (name.equals("planholderIdentifier")) {
1117          this.planholder = new Identifier();
1118          return this.planholder;
1119        }
1120        else if (name.equals("planholderReference")) {
1121          this.planholder = new Reference();
1122          return this.planholder;
1123        }
1124        else if (name.equals("beneficiaryIdentifier")) {
1125          this.beneficiary = new Identifier();
1126          return this.beneficiary;
1127        }
1128        else if (name.equals("beneficiaryReference")) {
1129          this.beneficiary = new Reference();
1130          return this.beneficiary;
1131        }
1132        else if (name.equals("relationship")) {
1133          this.relationship = new Coding();
1134          return this.relationship;
1135        }
1136        else if (name.equals("identifier")) {
1137          return addIdentifier();
1138        }
1139        else if (name.equals("group")) {
1140          throw new FHIRException("Cannot call addChild on a primitive type Coverage.group");
1141        }
1142        else if (name.equals("plan")) {
1143          throw new FHIRException("Cannot call addChild on a primitive type Coverage.plan");
1144        }
1145        else if (name.equals("subPlan")) {
1146          throw new FHIRException("Cannot call addChild on a primitive type Coverage.subPlan");
1147        }
1148        else if (name.equals("dependent")) {
1149          throw new FHIRException("Cannot call addChild on a primitive type Coverage.dependent");
1150        }
1151        else if (name.equals("sequence")) {
1152          throw new FHIRException("Cannot call addChild on a primitive type Coverage.sequence");
1153        }
1154        else if (name.equals("exception")) {
1155          return addException();
1156        }
1157        else if (name.equals("school")) {
1158          throw new FHIRException("Cannot call addChild on a primitive type Coverage.school");
1159        }
1160        else if (name.equals("network")) {
1161          throw new FHIRException("Cannot call addChild on a primitive type Coverage.network");
1162        }
1163        else if (name.equals("contract")) {
1164          return addContract();
1165        }
1166        else
1167          return super.addChild(name);
1168      }
1169
1170  public String fhirType() {
1171    return "Coverage";
1172
1173  }
1174
1175      public Coverage copy() {
1176        Coverage dst = new Coverage();
1177        copyValues(dst);
1178        dst.issuer = issuer == null ? null : issuer.copy();
1179        dst.bin = bin == null ? null : bin.copy();
1180        dst.period = period == null ? null : period.copy();
1181        dst.type = type == null ? null : type.copy();
1182        dst.planholder = planholder == null ? null : planholder.copy();
1183        dst.beneficiary = beneficiary == null ? null : beneficiary.copy();
1184        dst.relationship = relationship == null ? null : relationship.copy();
1185        if (identifier != null) {
1186          dst.identifier = new ArrayList<Identifier>();
1187          for (Identifier i : identifier)
1188            dst.identifier.add(i.copy());
1189        };
1190        dst.group = group == null ? null : group.copy();
1191        dst.plan = plan == null ? null : plan.copy();
1192        dst.subPlan = subPlan == null ? null : subPlan.copy();
1193        dst.dependent = dependent == null ? null : dependent.copy();
1194        dst.sequence = sequence == null ? null : sequence.copy();
1195        if (exception != null) {
1196          dst.exception = new ArrayList<Coding>();
1197          for (Coding i : exception)
1198            dst.exception.add(i.copy());
1199        };
1200        dst.school = school == null ? null : school.copy();
1201        dst.network = network == null ? null : network.copy();
1202        if (contract != null) {
1203          dst.contract = new ArrayList<Reference>();
1204          for (Reference i : contract)
1205            dst.contract.add(i.copy());
1206        };
1207        return dst;
1208      }
1209
1210      protected Coverage typedCopy() {
1211        return copy();
1212      }
1213
1214      @Override
1215      public boolean equalsDeep(Base other) {
1216        if (!super.equalsDeep(other))
1217          return false;
1218        if (!(other instanceof Coverage))
1219          return false;
1220        Coverage o = (Coverage) other;
1221        return compareDeep(issuer, o.issuer, true) && compareDeep(bin, o.bin, true) && compareDeep(period, o.period, true)
1222           && compareDeep(type, o.type, true) && compareDeep(planholder, o.planholder, true) && compareDeep(beneficiary, o.beneficiary, true)
1223           && compareDeep(relationship, o.relationship, true) && compareDeep(identifier, o.identifier, true)
1224           && compareDeep(group, o.group, true) && compareDeep(plan, o.plan, true) && compareDeep(subPlan, o.subPlan, true)
1225           && compareDeep(dependent, o.dependent, true) && compareDeep(sequence, o.sequence, true) && compareDeep(exception, o.exception, true)
1226           && compareDeep(school, o.school, true) && compareDeep(network, o.network, true) && compareDeep(contract, o.contract, true)
1227          ;
1228      }
1229
1230      @Override
1231      public boolean equalsShallow(Base other) {
1232        if (!super.equalsShallow(other))
1233          return false;
1234        if (!(other instanceof Coverage))
1235          return false;
1236        Coverage o = (Coverage) other;
1237        return compareValues(bin, o.bin, true) && compareValues(group, o.group, true) && compareValues(plan, o.plan, true)
1238           && compareValues(subPlan, o.subPlan, true) && compareValues(dependent, o.dependent, true) && compareValues(sequence, o.sequence, true)
1239           && compareValues(school, o.school, true) && compareValues(network, o.network, true);
1240      }
1241
1242      public boolean isEmpty() {
1243        return super.isEmpty() && (issuer == null || issuer.isEmpty()) && (bin == null || bin.isEmpty())
1244           && (period == null || period.isEmpty()) && (type == null || type.isEmpty()) && (planholder == null || planholder.isEmpty())
1245           && (beneficiary == null || beneficiary.isEmpty()) && (relationship == null || relationship.isEmpty())
1246           && (identifier == null || identifier.isEmpty()) && (group == null || group.isEmpty()) && (plan == null || plan.isEmpty())
1247           && (subPlan == null || subPlan.isEmpty()) && (dependent == null || dependent.isEmpty()) && (sequence == null || sequence.isEmpty())
1248           && (exception == null || exception.isEmpty()) && (school == null || school.isEmpty()) && (network == null || network.isEmpty())
1249           && (contract == null || contract.isEmpty());
1250      }
1251
1252  @Override
1253  public ResourceType getResourceType() {
1254    return ResourceType.Coverage;
1255   }
1256
1257 /**
1258   * Search parameter: <b>dependent</b>
1259   * <p>
1260   * Description: <b>Dependent number</b><br>
1261   * Type: <b>token</b><br>
1262   * Path: <b>Coverage.dependent</b><br>
1263   * </p>
1264   */
1265  @SearchParamDefinition(name="dependent", path="Coverage.dependent", description="Dependent number", type="token" )
1266  public static final String SP_DEPENDENT = "dependent";
1267 /**
1268   * <b>Fluent Client</b> search parameter constant for <b>dependent</b>
1269   * <p>
1270   * Description: <b>Dependent number</b><br>
1271   * Type: <b>token</b><br>
1272   * Path: <b>Coverage.dependent</b><br>
1273   * </p>
1274   */
1275  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DEPENDENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DEPENDENT);
1276
1277 /**
1278   * Search parameter: <b>beneficiaryreference</b>
1279   * <p>
1280   * Description: <b>Covered party</b><br>
1281   * Type: <b>reference</b><br>
1282   * Path: <b>Coverage.beneficiaryReference</b><br>
1283   * </p>
1284   */
1285  @SearchParamDefinition(name="beneficiaryreference", path="Coverage.beneficiary.as(Reference)", description="Covered party", type="reference" )
1286  public static final String SP_BENEFICIARYREFERENCE = "beneficiaryreference";
1287 /**
1288   * <b>Fluent Client</b> search parameter constant for <b>beneficiaryreference</b>
1289   * <p>
1290   * Description: <b>Covered party</b><br>
1291   * Type: <b>reference</b><br>
1292   * Path: <b>Coverage.beneficiaryReference</b><br>
1293   * </p>
1294   */
1295  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BENEFICIARYREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BENEFICIARYREFERENCE);
1296
1297/**
1298   * Constant for fluent queries to be used to add include statements. Specifies
1299   * the path value of "<b>Coverage:beneficiaryreference</b>".
1300   */
1301  public static final ca.uhn.fhir.model.api.Include INCLUDE_BENEFICIARYREFERENCE = new ca.uhn.fhir.model.api.Include("Coverage:beneficiaryreference").toLocked();
1302
1303 /**
1304   * Search parameter: <b>planholderidentifier</b>
1305   * <p>
1306   * Description: <b>Reference to the planholder</b><br>
1307   * Type: <b>token</b><br>
1308   * Path: <b>Coverage.planholderIdentifier</b><br>
1309   * </p>
1310   */
1311  @SearchParamDefinition(name="planholderidentifier", path="Coverage.planholder.as(Identifier)", description="Reference to the planholder", type="token" )
1312  public static final String SP_PLANHOLDERIDENTIFIER = "planholderidentifier";
1313 /**
1314   * <b>Fluent Client</b> search parameter constant for <b>planholderidentifier</b>
1315   * <p>
1316   * Description: <b>Reference to the planholder</b><br>
1317   * Type: <b>token</b><br>
1318   * Path: <b>Coverage.planholderIdentifier</b><br>
1319   * </p>
1320   */
1321  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PLANHOLDERIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PLANHOLDERIDENTIFIER);
1322
1323 /**
1324   * Search parameter: <b>type</b>
1325   * <p>
1326   * Description: <b>The kind of coverage (health plan, auto, Workers Compensation)</b><br>
1327   * Type: <b>token</b><br>
1328   * Path: <b>Coverage.type</b><br>
1329   * </p>
1330   */
1331  @SearchParamDefinition(name="type", path="Coverage.type", description="The kind of coverage (health plan, auto, Workers Compensation)", type="token" )
1332  public static final String SP_TYPE = "type";
1333 /**
1334   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1335   * <p>
1336   * Description: <b>The kind of coverage (health plan, auto, Workers Compensation)</b><br>
1337   * Type: <b>token</b><br>
1338   * Path: <b>Coverage.type</b><br>
1339   * </p>
1340   */
1341  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1342
1343 /**
1344   * Search parameter: <b>issueridentifier</b>
1345   * <p>
1346   * Description: <b>The identity of the insurer</b><br>
1347   * Type: <b>token</b><br>
1348   * Path: <b>Coverage.issuerIdentifier</b><br>
1349   * </p>
1350   */
1351  @SearchParamDefinition(name="issueridentifier", path="Coverage.issuer.as(Identifier)", description="The identity of the insurer", type="token" )
1352  public static final String SP_ISSUERIDENTIFIER = "issueridentifier";
1353 /**
1354   * <b>Fluent Client</b> search parameter constant for <b>issueridentifier</b>
1355   * <p>
1356   * Description: <b>The identity of the insurer</b><br>
1357   * Type: <b>token</b><br>
1358   * Path: <b>Coverage.issuerIdentifier</b><br>
1359   * </p>
1360   */
1361  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ISSUERIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ISSUERIDENTIFIER);
1362
1363 /**
1364   * Search parameter: <b>subplan</b>
1365   * <p>
1366   * Description: <b>Sub-plan identifier</b><br>
1367   * Type: <b>token</b><br>
1368   * Path: <b>Coverage.subPlan</b><br>
1369   * </p>
1370   */
1371  @SearchParamDefinition(name="subplan", path="Coverage.subPlan", description="Sub-plan identifier", type="token" )
1372  public static final String SP_SUBPLAN = "subplan";
1373 /**
1374   * <b>Fluent Client</b> search parameter constant for <b>subplan</b>
1375   * <p>
1376   * Description: <b>Sub-plan identifier</b><br>
1377   * Type: <b>token</b><br>
1378   * Path: <b>Coverage.subPlan</b><br>
1379   * </p>
1380   */
1381  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUBPLAN = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUBPLAN);
1382
1383 /**
1384   * Search parameter: <b>issuerreference</b>
1385   * <p>
1386   * Description: <b>The identity of the insurer</b><br>
1387   * Type: <b>reference</b><br>
1388   * Path: <b>Coverage.issuerReference</b><br>
1389   * </p>
1390   */
1391  @SearchParamDefinition(name="issuerreference", path="Coverage.issuer.as(Reference)", description="The identity of the insurer", type="reference" )
1392  public static final String SP_ISSUERREFERENCE = "issuerreference";
1393 /**
1394   * <b>Fluent Client</b> search parameter constant for <b>issuerreference</b>
1395   * <p>
1396   * Description: <b>The identity of the insurer</b><br>
1397   * Type: <b>reference</b><br>
1398   * Path: <b>Coverage.issuerReference</b><br>
1399   * </p>
1400   */
1401  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ISSUERREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ISSUERREFERENCE);
1402
1403/**
1404   * Constant for fluent queries to be used to add include statements. Specifies
1405   * the path value of "<b>Coverage:issuerreference</b>".
1406   */
1407  public static final ca.uhn.fhir.model.api.Include INCLUDE_ISSUERREFERENCE = new ca.uhn.fhir.model.api.Include("Coverage:issuerreference").toLocked();
1408
1409 /**
1410   * Search parameter: <b>plan</b>
1411   * <p>
1412   * Description: <b>A plan or policy identifier</b><br>
1413   * Type: <b>token</b><br>
1414   * Path: <b>Coverage.plan</b><br>
1415   * </p>
1416   */
1417  @SearchParamDefinition(name="plan", path="Coverage.plan", description="A plan or policy identifier", type="token" )
1418  public static final String SP_PLAN = "plan";
1419 /**
1420   * <b>Fluent Client</b> search parameter constant for <b>plan</b>
1421   * <p>
1422   * Description: <b>A plan or policy identifier</b><br>
1423   * Type: <b>token</b><br>
1424   * Path: <b>Coverage.plan</b><br>
1425   * </p>
1426   */
1427  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PLAN = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PLAN);
1428
1429 /**
1430   * Search parameter: <b>sequence</b>
1431   * <p>
1432   * Description: <b>Sequence number</b><br>
1433   * Type: <b>token</b><br>
1434   * Path: <b>Coverage.sequence</b><br>
1435   * </p>
1436   */
1437  @SearchParamDefinition(name="sequence", path="Coverage.sequence", description="Sequence number", type="token" )
1438  public static final String SP_SEQUENCE = "sequence";
1439 /**
1440   * <b>Fluent Client</b> search parameter constant for <b>sequence</b>
1441   * <p>
1442   * Description: <b>Sequence number</b><br>
1443   * Type: <b>token</b><br>
1444   * Path: <b>Coverage.sequence</b><br>
1445   * </p>
1446   */
1447  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SEQUENCE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SEQUENCE);
1448
1449 /**
1450   * Search parameter: <b>beneficiaryidentifier</b>
1451   * <p>
1452   * Description: <b>Covered party</b><br>
1453   * Type: <b>token</b><br>
1454   * Path: <b>Coverage.beneficiaryIdentifier</b><br>
1455   * </p>
1456   */
1457  @SearchParamDefinition(name="beneficiaryidentifier", path="Coverage.beneficiary.as(Identifier)", description="Covered party", type="token" )
1458  public static final String SP_BENEFICIARYIDENTIFIER = "beneficiaryidentifier";
1459 /**
1460   * <b>Fluent Client</b> search parameter constant for <b>beneficiaryidentifier</b>
1461   * <p>
1462   * Description: <b>Covered party</b><br>
1463   * Type: <b>token</b><br>
1464   * Path: <b>Coverage.beneficiaryIdentifier</b><br>
1465   * </p>
1466   */
1467  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BENEFICIARYIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BENEFICIARYIDENTIFIER);
1468
1469 /**
1470   * Search parameter: <b>group</b>
1471   * <p>
1472   * Description: <b>Group identifier</b><br>
1473   * Type: <b>token</b><br>
1474   * Path: <b>Coverage.group</b><br>
1475   * </p>
1476   */
1477  @SearchParamDefinition(name="group", path="Coverage.group", description="Group identifier", type="token" )
1478  public static final String SP_GROUP = "group";
1479 /**
1480   * <b>Fluent Client</b> search parameter constant for <b>group</b>
1481   * <p>
1482   * Description: <b>Group identifier</b><br>
1483   * Type: <b>token</b><br>
1484   * Path: <b>Coverage.group</b><br>
1485   * </p>
1486   */
1487  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GROUP);
1488
1489 /**
1490   * Search parameter: <b>planholderreference</b>
1491   * <p>
1492   * Description: <b>Reference to the planholder</b><br>
1493   * Type: <b>reference</b><br>
1494   * Path: <b>Coverage.planholderReference</b><br>
1495   * </p>
1496   */
1497  @SearchParamDefinition(name="planholderreference", path="Coverage.planholder.as(Reference)", description="Reference to the planholder", type="reference" )
1498  public static final String SP_PLANHOLDERREFERENCE = "planholderreference";
1499 /**
1500   * <b>Fluent Client</b> search parameter constant for <b>planholderreference</b>
1501   * <p>
1502   * Description: <b>Reference to the planholder</b><br>
1503   * Type: <b>reference</b><br>
1504   * Path: <b>Coverage.planholderReference</b><br>
1505   * </p>
1506   */
1507  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PLANHOLDERREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PLANHOLDERREFERENCE);
1508
1509/**
1510   * Constant for fluent queries to be used to add include statements. Specifies
1511   * the path value of "<b>Coverage:planholderreference</b>".
1512   */
1513  public static final ca.uhn.fhir.model.api.Include INCLUDE_PLANHOLDERREFERENCE = new ca.uhn.fhir.model.api.Include("Coverage:planholderreference").toLocked();
1514
1515 /**
1516   * Search parameter: <b>identifier</b>
1517   * <p>
1518   * Description: <b>The primary identifier of the insured and the coverage</b><br>
1519   * Type: <b>token</b><br>
1520   * Path: <b>Coverage.identifier</b><br>
1521   * </p>
1522   */
1523  @SearchParamDefinition(name="identifier", path="Coverage.identifier", description="The primary identifier of the insured and the coverage", type="token" )
1524  public static final String SP_IDENTIFIER = "identifier";
1525 /**
1526   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1527   * <p>
1528   * Description: <b>The primary identifier of the insured and the coverage</b><br>
1529   * Type: <b>token</b><br>
1530   * Path: <b>Coverage.identifier</b><br>
1531   * </p>
1532   */
1533  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1534
1535
1536}
1537