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