001package org.hl7.fhir.dstu2016may.model;
002
003import java.math.BigDecimal;
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048/**
049 * This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.
050 */
051@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/Profile/ExplanationOfBenefit")
052public class ExplanationOfBenefit extends DomainResource {
053
054    @Block()
055    public static class RelatedClaimsComponent extends BackboneElement implements IBaseBackboneElement {
056        /**
057         * Other claims which are related to this claim such as prior claim versions or for related services.
058         */
059        @Child(name = "claim", type = {Identifier.class, Claim.class}, order=1, min=0, max=1, modifier=false, summary=true)
060        @Description(shortDefinition="Reference to the related claim", formalDefinition="Other claims which are related to this claim such as prior claim versions or for related services." )
061        protected Type claim;
062
063        /**
064         * For example prior or umbrella.
065         */
066        @Child(name = "relationship", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
067        @Description(shortDefinition="How the reference claim is related", formalDefinition="For example prior or umbrella." )
068        protected Coding relationship;
069
070        /**
071         * An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .
072         */
073        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=true)
074        @Description(shortDefinition="Related file or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # ." )
075        protected Identifier reference;
076
077        private static final long serialVersionUID = -2033217402L;
078
079    /**
080     * Constructor
081     */
082      public RelatedClaimsComponent() {
083        super();
084      }
085
086        /**
087         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
088         */
089        public Type getClaim() { 
090          return this.claim;
091        }
092
093        /**
094         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
095         */
096        public Identifier getClaimIdentifier() throws FHIRException { 
097          if (!(this.claim instanceof Identifier))
098            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.claim.getClass().getName()+" was encountered");
099          return (Identifier) this.claim;
100        }
101
102        public boolean hasClaimIdentifier() { 
103          return this.claim instanceof Identifier;
104        }
105
106        /**
107         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
108         */
109        public Reference getClaimReference() throws FHIRException { 
110          if (!(this.claim instanceof Reference))
111            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.claim.getClass().getName()+" was encountered");
112          return (Reference) this.claim;
113        }
114
115        public boolean hasClaimReference() { 
116          return this.claim instanceof Reference;
117        }
118
119        public boolean hasClaim() { 
120          return this.claim != null && !this.claim.isEmpty();
121        }
122
123        /**
124         * @param value {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
125         */
126        public RelatedClaimsComponent setClaim(Type value) { 
127          this.claim = value;
128          return this;
129        }
130
131        /**
132         * @return {@link #relationship} (For example prior or umbrella.)
133         */
134        public Coding getRelationship() { 
135          if (this.relationship == null)
136            if (Configuration.errorOnAutoCreate())
137              throw new Error("Attempt to auto-create RelatedClaimsComponent.relationship");
138            else if (Configuration.doAutoCreate())
139              this.relationship = new Coding(); // cc
140          return this.relationship;
141        }
142
143        public boolean hasRelationship() { 
144          return this.relationship != null && !this.relationship.isEmpty();
145        }
146
147        /**
148         * @param value {@link #relationship} (For example prior or umbrella.)
149         */
150        public RelatedClaimsComponent setRelationship(Coding value) { 
151          this.relationship = value;
152          return this;
153        }
154
155        /**
156         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .)
157         */
158        public Identifier getReference() { 
159          if (this.reference == null)
160            if (Configuration.errorOnAutoCreate())
161              throw new Error("Attempt to auto-create RelatedClaimsComponent.reference");
162            else if (Configuration.doAutoCreate())
163              this.reference = new Identifier(); // cc
164          return this.reference;
165        }
166
167        public boolean hasReference() { 
168          return this.reference != null && !this.reference.isEmpty();
169        }
170
171        /**
172         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .)
173         */
174        public RelatedClaimsComponent setReference(Identifier value) { 
175          this.reference = value;
176          return this;
177        }
178
179        protected void listChildren(List<Property> childrenList) {
180          super.listChildren(childrenList);
181          childrenList.add(new Property("claim[x]", "Identifier|Reference(Claim)", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, java.lang.Integer.MAX_VALUE, claim));
182          childrenList.add(new Property("relationship", "Coding", "For example prior or umbrella.", 0, java.lang.Integer.MAX_VALUE, relationship));
183          childrenList.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .", 0, java.lang.Integer.MAX_VALUE, reference));
184        }
185
186      @Override
187      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
188        switch (hash) {
189        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Type
190        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Coding
191        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
192        default: return super.getProperty(hash, name, checkValid);
193        }
194
195      }
196
197      @Override
198      public void setProperty(int hash, String name, Base value) throws FHIRException {
199        switch (hash) {
200        case 94742588: // claim
201          this.claim = (Type) value; // Type
202          break;
203        case -261851592: // relationship
204          this.relationship = castToCoding(value); // Coding
205          break;
206        case -925155509: // reference
207          this.reference = castToIdentifier(value); // Identifier
208          break;
209        default: super.setProperty(hash, name, value);
210        }
211
212      }
213
214      @Override
215      public void setProperty(String name, Base value) throws FHIRException {
216        if (name.equals("claim[x]"))
217          this.claim = (Type) value; // Type
218        else if (name.equals("relationship"))
219          this.relationship = castToCoding(value); // Coding
220        else if (name.equals("reference"))
221          this.reference = castToIdentifier(value); // Identifier
222        else
223          super.setProperty(name, value);
224      }
225
226      @Override
227      public Base makeProperty(int hash, String name) throws FHIRException {
228        switch (hash) {
229        case 683016900:  return getClaim(); // Type
230        case -261851592:  return getRelationship(); // Coding
231        case -925155509:  return getReference(); // Identifier
232        default: return super.makeProperty(hash, name);
233        }
234
235      }
236
237      @Override
238      public Base addChild(String name) throws FHIRException {
239        if (name.equals("claimIdentifier")) {
240          this.claim = new Identifier();
241          return this.claim;
242        }
243        else if (name.equals("claimReference")) {
244          this.claim = new Reference();
245          return this.claim;
246        }
247        else if (name.equals("relationship")) {
248          this.relationship = new Coding();
249          return this.relationship;
250        }
251        else if (name.equals("reference")) {
252          this.reference = new Identifier();
253          return this.reference;
254        }
255        else
256          return super.addChild(name);
257      }
258
259      public RelatedClaimsComponent copy() {
260        RelatedClaimsComponent dst = new RelatedClaimsComponent();
261        copyValues(dst);
262        dst.claim = claim == null ? null : claim.copy();
263        dst.relationship = relationship == null ? null : relationship.copy();
264        dst.reference = reference == null ? null : reference.copy();
265        return dst;
266      }
267
268      @Override
269      public boolean equalsDeep(Base other) {
270        if (!super.equalsDeep(other))
271          return false;
272        if (!(other instanceof RelatedClaimsComponent))
273          return false;
274        RelatedClaimsComponent o = (RelatedClaimsComponent) other;
275        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
276          ;
277      }
278
279      @Override
280      public boolean equalsShallow(Base other) {
281        if (!super.equalsShallow(other))
282          return false;
283        if (!(other instanceof RelatedClaimsComponent))
284          return false;
285        RelatedClaimsComponent o = (RelatedClaimsComponent) other;
286        return true;
287      }
288
289      public boolean isEmpty() {
290        return super.isEmpty() && (claim == null || claim.isEmpty()) && (relationship == null || relationship.isEmpty())
291           && (reference == null || reference.isEmpty());
292      }
293
294  public String fhirType() {
295    return "ExplanationOfBenefit.related";
296
297  }
298
299  }
300
301    @Block()
302    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
303        /**
304         * Type of Party to be reimbursed: Subscriber, provider, other.
305         */
306        @Child(name = "type", type = {Coding.class}, order=1, min=0, max=1, modifier=false, summary=true)
307        @Description(shortDefinition="Type of party: Subscriber, Provider, other", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
308        protected Coding type;
309
310        /**
311         * Party to be reimbursed: Subscriber, provider, other.
312         */
313        @Child(name = "party", type = {Identifier.class, Practitioner.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=true)
314        @Description(shortDefinition="Party to receive the payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
315        protected Type party;
316
317        private static final long serialVersionUID = 1304353420L;
318
319    /**
320     * Constructor
321     */
322      public PayeeComponent() {
323        super();
324      }
325
326        /**
327         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
328         */
329        public Coding getType() { 
330          if (this.type == null)
331            if (Configuration.errorOnAutoCreate())
332              throw new Error("Attempt to auto-create PayeeComponent.type");
333            else if (Configuration.doAutoCreate())
334              this.type = new Coding(); // cc
335          return this.type;
336        }
337
338        public boolean hasType() { 
339          return this.type != null && !this.type.isEmpty();
340        }
341
342        /**
343         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
344         */
345        public PayeeComponent setType(Coding value) { 
346          this.type = value;
347          return this;
348        }
349
350        /**
351         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
352         */
353        public Type getParty() { 
354          return this.party;
355        }
356
357        /**
358         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
359         */
360        public Identifier getPartyIdentifier() throws FHIRException { 
361          if (!(this.party instanceof Identifier))
362            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.party.getClass().getName()+" was encountered");
363          return (Identifier) this.party;
364        }
365
366        public boolean hasPartyIdentifier() { 
367          return this.party instanceof Identifier;
368        }
369
370        /**
371         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
372         */
373        public Reference getPartyReference() throws FHIRException { 
374          if (!(this.party instanceof Reference))
375            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.party.getClass().getName()+" was encountered");
376          return (Reference) this.party;
377        }
378
379        public boolean hasPartyReference() { 
380          return this.party instanceof Reference;
381        }
382
383        public boolean hasParty() { 
384          return this.party != null && !this.party.isEmpty();
385        }
386
387        /**
388         * @param value {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
389         */
390        public PayeeComponent setParty(Type value) { 
391          this.party = value;
392          return this;
393        }
394
395        protected void listChildren(List<Property> childrenList) {
396          super.listChildren(childrenList);
397          childrenList.add(new Property("type", "Coding", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, java.lang.Integer.MAX_VALUE, type));
398          childrenList.add(new Property("party[x]", "Identifier|Reference(Practitioner|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, java.lang.Integer.MAX_VALUE, party));
399        }
400
401      @Override
402      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
403        switch (hash) {
404        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
405        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Type
406        default: return super.getProperty(hash, name, checkValid);
407        }
408
409      }
410
411      @Override
412      public void setProperty(int hash, String name, Base value) throws FHIRException {
413        switch (hash) {
414        case 3575610: // type
415          this.type = castToCoding(value); // Coding
416          break;
417        case 106437350: // party
418          this.party = (Type) value; // Type
419          break;
420        default: super.setProperty(hash, name, value);
421        }
422
423      }
424
425      @Override
426      public void setProperty(String name, Base value) throws FHIRException {
427        if (name.equals("type"))
428          this.type = castToCoding(value); // Coding
429        else if (name.equals("party[x]"))
430          this.party = (Type) value; // Type
431        else
432          super.setProperty(name, value);
433      }
434
435      @Override
436      public Base makeProperty(int hash, String name) throws FHIRException {
437        switch (hash) {
438        case 3575610:  return getType(); // Coding
439        case 1189320666:  return getParty(); // Type
440        default: return super.makeProperty(hash, name);
441        }
442
443      }
444
445      @Override
446      public Base addChild(String name) throws FHIRException {
447        if (name.equals("type")) {
448          this.type = new Coding();
449          return this.type;
450        }
451        else if (name.equals("partyIdentifier")) {
452          this.party = new Identifier();
453          return this.party;
454        }
455        else if (name.equals("partyReference")) {
456          this.party = new Reference();
457          return this.party;
458        }
459        else
460          return super.addChild(name);
461      }
462
463      public PayeeComponent copy() {
464        PayeeComponent dst = new PayeeComponent();
465        copyValues(dst);
466        dst.type = type == null ? null : type.copy();
467        dst.party = party == null ? null : party.copy();
468        return dst;
469      }
470
471      @Override
472      public boolean equalsDeep(Base other) {
473        if (!super.equalsDeep(other))
474          return false;
475        if (!(other instanceof PayeeComponent))
476          return false;
477        PayeeComponent o = (PayeeComponent) other;
478        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
479      }
480
481      @Override
482      public boolean equalsShallow(Base other) {
483        if (!super.equalsShallow(other))
484          return false;
485        if (!(other instanceof PayeeComponent))
486          return false;
487        PayeeComponent o = (PayeeComponent) other;
488        return true;
489      }
490
491      public boolean isEmpty() {
492        return super.isEmpty() && (type == null || type.isEmpty()) && (party == null || party.isEmpty())
493          ;
494      }
495
496  public String fhirType() {
497    return "ExplanationOfBenefit.payee";
498
499  }
500
501  }
502
503    @Block()
504    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
505        /**
506         * Sequence of diagnosis which serves to order and provide a link.
507         */
508        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
509        @Description(shortDefinition="Number to covey order of diagnosis", formalDefinition="Sequence of diagnosis which serves to order and provide a link." )
510        protected PositiveIntType sequence;
511
512        /**
513         * The diagnosis.
514         */
515        @Child(name = "diagnosis", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
516        @Description(shortDefinition="Patient's list of diagnosis", formalDefinition="The diagnosis." )
517        protected Coding diagnosis;
518
519        private static final long serialVersionUID = -795010186L;
520
521    /**
522     * Constructor
523     */
524      public DiagnosisComponent() {
525        super();
526      }
527
528    /**
529     * Constructor
530     */
531      public DiagnosisComponent(PositiveIntType sequence, Coding diagnosis) {
532        super();
533        this.sequence = sequence;
534        this.diagnosis = diagnosis;
535      }
536
537        /**
538         * @return {@link #sequence} (Sequence of diagnosis which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
539         */
540        public PositiveIntType getSequenceElement() { 
541          if (this.sequence == null)
542            if (Configuration.errorOnAutoCreate())
543              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
544            else if (Configuration.doAutoCreate())
545              this.sequence = new PositiveIntType(); // bb
546          return this.sequence;
547        }
548
549        public boolean hasSequenceElement() { 
550          return this.sequence != null && !this.sequence.isEmpty();
551        }
552
553        public boolean hasSequence() { 
554          return this.sequence != null && !this.sequence.isEmpty();
555        }
556
557        /**
558         * @param value {@link #sequence} (Sequence of diagnosis which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
559         */
560        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
561          this.sequence = value;
562          return this;
563        }
564
565        /**
566         * @return Sequence of diagnosis which serves to order and provide a link.
567         */
568        public int getSequence() { 
569          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
570        }
571
572        /**
573         * @param value Sequence of diagnosis which serves to order and provide a link.
574         */
575        public DiagnosisComponent setSequence(int value) { 
576            if (this.sequence == null)
577              this.sequence = new PositiveIntType();
578            this.sequence.setValue(value);
579          return this;
580        }
581
582        /**
583         * @return {@link #diagnosis} (The diagnosis.)
584         */
585        public Coding getDiagnosis() { 
586          if (this.diagnosis == null)
587            if (Configuration.errorOnAutoCreate())
588              throw new Error("Attempt to auto-create DiagnosisComponent.diagnosis");
589            else if (Configuration.doAutoCreate())
590              this.diagnosis = new Coding(); // cc
591          return this.diagnosis;
592        }
593
594        public boolean hasDiagnosis() { 
595          return this.diagnosis != null && !this.diagnosis.isEmpty();
596        }
597
598        /**
599         * @param value {@link #diagnosis} (The diagnosis.)
600         */
601        public DiagnosisComponent setDiagnosis(Coding value) { 
602          this.diagnosis = value;
603          return this;
604        }
605
606        protected void listChildren(List<Property> childrenList) {
607          super.listChildren(childrenList);
608          childrenList.add(new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to order and provide a link.", 0, java.lang.Integer.MAX_VALUE, sequence));
609          childrenList.add(new Property("diagnosis", "Coding", "The diagnosis.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
610        }
611
612      @Override
613      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
614        switch (hash) {
615        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
616        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Coding
617        default: return super.getProperty(hash, name, checkValid);
618        }
619
620      }
621
622      @Override
623      public void setProperty(int hash, String name, Base value) throws FHIRException {
624        switch (hash) {
625        case 1349547969: // sequence
626          this.sequence = castToPositiveInt(value); // PositiveIntType
627          break;
628        case 1196993265: // diagnosis
629          this.diagnosis = castToCoding(value); // Coding
630          break;
631        default: super.setProperty(hash, name, value);
632        }
633
634      }
635
636      @Override
637      public void setProperty(String name, Base value) throws FHIRException {
638        if (name.equals("sequence"))
639          this.sequence = castToPositiveInt(value); // PositiveIntType
640        else if (name.equals("diagnosis"))
641          this.diagnosis = castToCoding(value); // Coding
642        else
643          super.setProperty(name, value);
644      }
645
646      @Override
647      public Base makeProperty(int hash, String name) throws FHIRException {
648        switch (hash) {
649        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
650        case 1196993265:  return getDiagnosis(); // Coding
651        default: return super.makeProperty(hash, name);
652        }
653
654      }
655
656      @Override
657      public Base addChild(String name) throws FHIRException {
658        if (name.equals("sequence")) {
659          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
660        }
661        else if (name.equals("diagnosis")) {
662          this.diagnosis = new Coding();
663          return this.diagnosis;
664        }
665        else
666          return super.addChild(name);
667      }
668
669      public DiagnosisComponent copy() {
670        DiagnosisComponent dst = new DiagnosisComponent();
671        copyValues(dst);
672        dst.sequence = sequence == null ? null : sequence.copy();
673        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
674        return dst;
675      }
676
677      @Override
678      public boolean equalsDeep(Base other) {
679        if (!super.equalsDeep(other))
680          return false;
681        if (!(other instanceof DiagnosisComponent))
682          return false;
683        DiagnosisComponent o = (DiagnosisComponent) other;
684        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true);
685      }
686
687      @Override
688      public boolean equalsShallow(Base other) {
689        if (!super.equalsShallow(other))
690          return false;
691        if (!(other instanceof DiagnosisComponent))
692          return false;
693        DiagnosisComponent o = (DiagnosisComponent) other;
694        return compareValues(sequence, o.sequence, true);
695      }
696
697      public boolean isEmpty() {
698        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (diagnosis == null || diagnosis.isEmpty())
699          ;
700      }
701
702  public String fhirType() {
703    return "ExplanationOfBenefit.diagnosis";
704
705  }
706
707  }
708
709    @Block()
710    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
711        /**
712         * Sequence of procedures which serves to order and provide a link.
713         */
714        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
715        @Description(shortDefinition="Procedure sequence for reference", formalDefinition="Sequence of procedures which serves to order and provide a link." )
716        protected PositiveIntType sequence;
717
718        /**
719         * Date and optionally time the procedure was performed .
720         */
721        @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
722        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed ." )
723        protected DateTimeType date;
724
725        /**
726         * The procedure code.
727         */
728        @Child(name = "procedure", type = {Coding.class, Procedure.class}, order=3, min=1, max=1, modifier=false, summary=true)
729        @Description(shortDefinition="Patient's list of procedures performed", formalDefinition="The procedure code." )
730        protected Type procedure;
731
732        private static final long serialVersionUID = 864307347L;
733
734    /**
735     * Constructor
736     */
737      public ProcedureComponent() {
738        super();
739      }
740
741    /**
742     * Constructor
743     */
744      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
745        super();
746        this.sequence = sequence;
747        this.procedure = procedure;
748      }
749
750        /**
751         * @return {@link #sequence} (Sequence of procedures which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
752         */
753        public PositiveIntType getSequenceElement() { 
754          if (this.sequence == null)
755            if (Configuration.errorOnAutoCreate())
756              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
757            else if (Configuration.doAutoCreate())
758              this.sequence = new PositiveIntType(); // bb
759          return this.sequence;
760        }
761
762        public boolean hasSequenceElement() { 
763          return this.sequence != null && !this.sequence.isEmpty();
764        }
765
766        public boolean hasSequence() { 
767          return this.sequence != null && !this.sequence.isEmpty();
768        }
769
770        /**
771         * @param value {@link #sequence} (Sequence of procedures which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
772         */
773        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
774          this.sequence = value;
775          return this;
776        }
777
778        /**
779         * @return Sequence of procedures which serves to order and provide a link.
780         */
781        public int getSequence() { 
782          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
783        }
784
785        /**
786         * @param value Sequence of procedures which serves to order and provide a link.
787         */
788        public ProcedureComponent setSequence(int value) { 
789            if (this.sequence == null)
790              this.sequence = new PositiveIntType();
791            this.sequence.setValue(value);
792          return this;
793        }
794
795        /**
796         * @return {@link #date} (Date and optionally time the procedure was performed .). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
797         */
798        public DateTimeType getDateElement() { 
799          if (this.date == null)
800            if (Configuration.errorOnAutoCreate())
801              throw new Error("Attempt to auto-create ProcedureComponent.date");
802            else if (Configuration.doAutoCreate())
803              this.date = new DateTimeType(); // bb
804          return this.date;
805        }
806
807        public boolean hasDateElement() { 
808          return this.date != null && !this.date.isEmpty();
809        }
810
811        public boolean hasDate() { 
812          return this.date != null && !this.date.isEmpty();
813        }
814
815        /**
816         * @param value {@link #date} (Date and optionally time the procedure was performed .). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
817         */
818        public ProcedureComponent setDateElement(DateTimeType value) { 
819          this.date = value;
820          return this;
821        }
822
823        /**
824         * @return Date and optionally time the procedure was performed .
825         */
826        public Date getDate() { 
827          return this.date == null ? null : this.date.getValue();
828        }
829
830        /**
831         * @param value Date and optionally time the procedure was performed .
832         */
833        public ProcedureComponent setDate(Date value) { 
834          if (value == null)
835            this.date = null;
836          else {
837            if (this.date == null)
838              this.date = new DateTimeType();
839            this.date.setValue(value);
840          }
841          return this;
842        }
843
844        /**
845         * @return {@link #procedure} (The procedure code.)
846         */
847        public Type getProcedure() { 
848          return this.procedure;
849        }
850
851        /**
852         * @return {@link #procedure} (The procedure code.)
853         */
854        public Coding getProcedureCoding() throws FHIRException { 
855          if (!(this.procedure instanceof Coding))
856            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.procedure.getClass().getName()+" was encountered");
857          return (Coding) this.procedure;
858        }
859
860        public boolean hasProcedureCoding() { 
861          return this.procedure instanceof Coding;
862        }
863
864        /**
865         * @return {@link #procedure} (The procedure code.)
866         */
867        public Reference getProcedureReference() throws FHIRException { 
868          if (!(this.procedure instanceof Reference))
869            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
870          return (Reference) this.procedure;
871        }
872
873        public boolean hasProcedureReference() { 
874          return this.procedure instanceof Reference;
875        }
876
877        public boolean hasProcedure() { 
878          return this.procedure != null && !this.procedure.isEmpty();
879        }
880
881        /**
882         * @param value {@link #procedure} (The procedure code.)
883         */
884        public ProcedureComponent setProcedure(Type value) { 
885          this.procedure = value;
886          return this;
887        }
888
889        protected void listChildren(List<Property> childrenList) {
890          super.listChildren(childrenList);
891          childrenList.add(new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, java.lang.Integer.MAX_VALUE, sequence));
892          childrenList.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, java.lang.Integer.MAX_VALUE, date));
893          childrenList.add(new Property("procedure[x]", "Coding|Reference(Procedure)", "The procedure code.", 0, java.lang.Integer.MAX_VALUE, procedure));
894        }
895
896      @Override
897      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
898        switch (hash) {
899        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
900        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
901        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
902        default: return super.getProperty(hash, name, checkValid);
903        }
904
905      }
906
907      @Override
908      public void setProperty(int hash, String name, Base value) throws FHIRException {
909        switch (hash) {
910        case 1349547969: // sequence
911          this.sequence = castToPositiveInt(value); // PositiveIntType
912          break;
913        case 3076014: // date
914          this.date = castToDateTime(value); // DateTimeType
915          break;
916        case -1095204141: // procedure
917          this.procedure = (Type) value; // Type
918          break;
919        default: super.setProperty(hash, name, value);
920        }
921
922      }
923
924      @Override
925      public void setProperty(String name, Base value) throws FHIRException {
926        if (name.equals("sequence"))
927          this.sequence = castToPositiveInt(value); // PositiveIntType
928        else if (name.equals("date"))
929          this.date = castToDateTime(value); // DateTimeType
930        else if (name.equals("procedure[x]"))
931          this.procedure = (Type) value; // Type
932        else
933          super.setProperty(name, value);
934      }
935
936      @Override
937      public Base makeProperty(int hash, String name) throws FHIRException {
938        switch (hash) {
939        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
940        case 3076014: throw new FHIRException("Cannot make property date as it is not a complex type"); // DateTimeType
941        case 1640074445:  return getProcedure(); // Type
942        default: return super.makeProperty(hash, name);
943        }
944
945      }
946
947      @Override
948      public Base addChild(String name) throws FHIRException {
949        if (name.equals("sequence")) {
950          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
951        }
952        else if (name.equals("date")) {
953          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
954        }
955        else if (name.equals("procedureCoding")) {
956          this.procedure = new Coding();
957          return this.procedure;
958        }
959        else if (name.equals("procedureReference")) {
960          this.procedure = new Reference();
961          return this.procedure;
962        }
963        else
964          return super.addChild(name);
965      }
966
967      public ProcedureComponent copy() {
968        ProcedureComponent dst = new ProcedureComponent();
969        copyValues(dst);
970        dst.sequence = sequence == null ? null : sequence.copy();
971        dst.date = date == null ? null : date.copy();
972        dst.procedure = procedure == null ? null : procedure.copy();
973        return dst;
974      }
975
976      @Override
977      public boolean equalsDeep(Base other) {
978        if (!super.equalsDeep(other))
979          return false;
980        if (!(other instanceof ProcedureComponent))
981          return false;
982        ProcedureComponent o = (ProcedureComponent) other;
983        return compareDeep(sequence, o.sequence, true) && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
984          ;
985      }
986
987      @Override
988      public boolean equalsShallow(Base other) {
989        if (!super.equalsShallow(other))
990          return false;
991        if (!(other instanceof ProcedureComponent))
992          return false;
993        ProcedureComponent o = (ProcedureComponent) other;
994        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
995      }
996
997      public boolean isEmpty() {
998        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (date == null || date.isEmpty())
999           && (procedure == null || procedure.isEmpty());
1000      }
1001
1002  public String fhirType() {
1003    return "ExplanationOfBenefit.procedure";
1004
1005  }
1006
1007  }
1008
1009    @Block()
1010    public static class CoverageComponent extends BackboneElement implements IBaseBackboneElement {
1011        /**
1012         * Reference to the program or plan identification, underwriter or payor.
1013         */
1014        @Child(name = "coverage", type = {Identifier.class, Coverage.class}, order=1, min=1, max=1, modifier=false, summary=true)
1015        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
1016        protected Type coverage;
1017
1018        /**
1019         * A list of references from the Insurer to which these services pertain.
1020         */
1021        @Child(name = "preAuthRef", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1022        @Description(shortDefinition="Pre-Authorization/Determination Reference", formalDefinition="A list of references from the Insurer to which these services pertain." )
1023        protected List<StringType> preAuthRef;
1024
1025        private static final long serialVersionUID = -21571213L;
1026
1027    /**
1028     * Constructor
1029     */
1030      public CoverageComponent() {
1031        super();
1032      }
1033
1034    /**
1035     * Constructor
1036     */
1037      public CoverageComponent(Type coverage) {
1038        super();
1039        this.coverage = coverage;
1040      }
1041
1042        /**
1043         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
1044         */
1045        public Type getCoverage() { 
1046          return this.coverage;
1047        }
1048
1049        /**
1050         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
1051         */
1052        public Identifier getCoverageIdentifier() throws FHIRException { 
1053          if (!(this.coverage instanceof Identifier))
1054            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.coverage.getClass().getName()+" was encountered");
1055          return (Identifier) this.coverage;
1056        }
1057
1058        public boolean hasCoverageIdentifier() { 
1059          return this.coverage instanceof Identifier;
1060        }
1061
1062        /**
1063         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
1064         */
1065        public Reference getCoverageReference() throws FHIRException { 
1066          if (!(this.coverage instanceof Reference))
1067            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.coverage.getClass().getName()+" was encountered");
1068          return (Reference) this.coverage;
1069        }
1070
1071        public boolean hasCoverageReference() { 
1072          return this.coverage instanceof Reference;
1073        }
1074
1075        public boolean hasCoverage() { 
1076          return this.coverage != null && !this.coverage.isEmpty();
1077        }
1078
1079        /**
1080         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
1081         */
1082        public CoverageComponent setCoverage(Type value) { 
1083          this.coverage = value;
1084          return this;
1085        }
1086
1087        /**
1088         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1089         */
1090        public List<StringType> getPreAuthRef() { 
1091          if (this.preAuthRef == null)
1092            this.preAuthRef = new ArrayList<StringType>();
1093          return this.preAuthRef;
1094        }
1095
1096        public boolean hasPreAuthRef() { 
1097          if (this.preAuthRef == null)
1098            return false;
1099          for (StringType item : this.preAuthRef)
1100            if (!item.isEmpty())
1101              return true;
1102          return false;
1103        }
1104
1105        /**
1106         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1107         */
1108    // syntactic sugar
1109        public StringType addPreAuthRefElement() {//2 
1110          StringType t = new StringType();
1111          if (this.preAuthRef == null)
1112            this.preAuthRef = new ArrayList<StringType>();
1113          this.preAuthRef.add(t);
1114          return t;
1115        }
1116
1117        /**
1118         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1119         */
1120        public CoverageComponent addPreAuthRef(String value) { //1
1121          StringType t = new StringType();
1122          t.setValue(value);
1123          if (this.preAuthRef == null)
1124            this.preAuthRef = new ArrayList<StringType>();
1125          this.preAuthRef.add(t);
1126          return this;
1127        }
1128
1129        /**
1130         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1131         */
1132        public boolean hasPreAuthRef(String value) { 
1133          if (this.preAuthRef == null)
1134            return false;
1135          for (StringType v : this.preAuthRef)
1136            if (v.equals(value)) // string
1137              return true;
1138          return false;
1139        }
1140
1141        protected void listChildren(List<Property> childrenList) {
1142          super.listChildren(childrenList);
1143          childrenList.add(new Property("coverage[x]", "Identifier|Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, coverage));
1144          childrenList.add(new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
1145        }
1146
1147      @Override
1148      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1149        switch (hash) {
1150        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Type
1151        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
1152        default: return super.getProperty(hash, name, checkValid);
1153        }
1154
1155      }
1156
1157      @Override
1158      public void setProperty(int hash, String name, Base value) throws FHIRException {
1159        switch (hash) {
1160        case -351767064: // coverage
1161          this.coverage = (Type) value; // Type
1162          break;
1163        case 522246568: // preAuthRef
1164          this.getPreAuthRef().add(castToString(value)); // StringType
1165          break;
1166        default: super.setProperty(hash, name, value);
1167        }
1168
1169      }
1170
1171      @Override
1172      public void setProperty(String name, Base value) throws FHIRException {
1173        if (name.equals("coverage[x]"))
1174          this.coverage = (Type) value; // Type
1175        else if (name.equals("preAuthRef"))
1176          this.getPreAuthRef().add(castToString(value));
1177        else
1178          super.setProperty(name, value);
1179      }
1180
1181      @Override
1182      public Base makeProperty(int hash, String name) throws FHIRException {
1183        switch (hash) {
1184        case 227689880:  return getCoverage(); // Type
1185        case 522246568: throw new FHIRException("Cannot make property preAuthRef as it is not a complex type"); // StringType
1186        default: return super.makeProperty(hash, name);
1187        }
1188
1189      }
1190
1191      @Override
1192      public Base addChild(String name) throws FHIRException {
1193        if (name.equals("coverageIdentifier")) {
1194          this.coverage = new Identifier();
1195          return this.coverage;
1196        }
1197        else if (name.equals("coverageReference")) {
1198          this.coverage = new Reference();
1199          return this.coverage;
1200        }
1201        else if (name.equals("preAuthRef")) {
1202          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
1203        }
1204        else
1205          return super.addChild(name);
1206      }
1207
1208      public CoverageComponent copy() {
1209        CoverageComponent dst = new CoverageComponent();
1210        copyValues(dst);
1211        dst.coverage = coverage == null ? null : coverage.copy();
1212        if (preAuthRef != null) {
1213          dst.preAuthRef = new ArrayList<StringType>();
1214          for (StringType i : preAuthRef)
1215            dst.preAuthRef.add(i.copy());
1216        };
1217        return dst;
1218      }
1219
1220      @Override
1221      public boolean equalsDeep(Base other) {
1222        if (!super.equalsDeep(other))
1223          return false;
1224        if (!(other instanceof CoverageComponent))
1225          return false;
1226        CoverageComponent o = (CoverageComponent) other;
1227        return compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true);
1228      }
1229
1230      @Override
1231      public boolean equalsShallow(Base other) {
1232        if (!super.equalsShallow(other))
1233          return false;
1234        if (!(other instanceof CoverageComponent))
1235          return false;
1236        CoverageComponent o = (CoverageComponent) other;
1237        return compareValues(preAuthRef, o.preAuthRef, true);
1238      }
1239
1240      public boolean isEmpty() {
1241        return super.isEmpty() && (coverage == null || coverage.isEmpty()) && (preAuthRef == null || preAuthRef.isEmpty())
1242          ;
1243      }
1244
1245  public String fhirType() {
1246    return "ExplanationOfBenefit.coverage";
1247
1248  }
1249
1250  }
1251
1252    @Block()
1253    public static class OnsetComponent extends BackboneElement implements IBaseBackboneElement {
1254        /**
1255         * The start or start and end dates for the treatable condition.
1256         */
1257        @Child(name = "time", type = {DateType.class, Period.class}, order=1, min=0, max=1, modifier=false, summary=true)
1258        @Description(shortDefinition="Illness, injury or treatable condition date", formalDefinition="The start or start and end dates for the treatable condition." )
1259        protected Type time;
1260
1261        /**
1262         * Onset typifications eg. Start of pregnancy, start of illnes, etc.
1263         */
1264        @Child(name = "type", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
1265        @Description(shortDefinition="Onset of what", formalDefinition="Onset typifications eg. Start of pregnancy, start of illnes, etc." )
1266        protected Coding type;
1267
1268        private static final long serialVersionUID = -560173231L;
1269
1270    /**
1271     * Constructor
1272     */
1273      public OnsetComponent() {
1274        super();
1275      }
1276
1277        /**
1278         * @return {@link #time} (The start or start and end dates for the treatable condition.)
1279         */
1280        public Type getTime() { 
1281          return this.time;
1282        }
1283
1284        /**
1285         * @return {@link #time} (The start or start and end dates for the treatable condition.)
1286         */
1287        public DateType getTimeDateType() throws FHIRException { 
1288          if (!(this.time instanceof DateType))
1289            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.time.getClass().getName()+" was encountered");
1290          return (DateType) this.time;
1291        }
1292
1293        public boolean hasTimeDateType() { 
1294          return this.time instanceof DateType;
1295        }
1296
1297        /**
1298         * @return {@link #time} (The start or start and end dates for the treatable condition.)
1299         */
1300        public Period getTimePeriod() throws FHIRException { 
1301          if (!(this.time instanceof Period))
1302            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.time.getClass().getName()+" was encountered");
1303          return (Period) this.time;
1304        }
1305
1306        public boolean hasTimePeriod() { 
1307          return this.time instanceof Period;
1308        }
1309
1310        public boolean hasTime() { 
1311          return this.time != null && !this.time.isEmpty();
1312        }
1313
1314        /**
1315         * @param value {@link #time} (The start or start and end dates for the treatable condition.)
1316         */
1317        public OnsetComponent setTime(Type value) { 
1318          this.time = value;
1319          return this;
1320        }
1321
1322        /**
1323         * @return {@link #type} (Onset typifications eg. Start of pregnancy, start of illnes, etc.)
1324         */
1325        public Coding getType() { 
1326          if (this.type == null)
1327            if (Configuration.errorOnAutoCreate())
1328              throw new Error("Attempt to auto-create OnsetComponent.type");
1329            else if (Configuration.doAutoCreate())
1330              this.type = new Coding(); // cc
1331          return this.type;
1332        }
1333
1334        public boolean hasType() { 
1335          return this.type != null && !this.type.isEmpty();
1336        }
1337
1338        /**
1339         * @param value {@link #type} (Onset typifications eg. Start of pregnancy, start of illnes, etc.)
1340         */
1341        public OnsetComponent setType(Coding value) { 
1342          this.type = value;
1343          return this;
1344        }
1345
1346        protected void listChildren(List<Property> childrenList) {
1347          super.listChildren(childrenList);
1348          childrenList.add(new Property("time[x]", "date|Period", "The start or start and end dates for the treatable condition.", 0, java.lang.Integer.MAX_VALUE, time));
1349          childrenList.add(new Property("type", "Coding", "Onset typifications eg. Start of pregnancy, start of illnes, etc.", 0, java.lang.Integer.MAX_VALUE, type));
1350        }
1351
1352      @Override
1353      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1354        switch (hash) {
1355        case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // Type
1356        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
1357        default: return super.getProperty(hash, name, checkValid);
1358        }
1359
1360      }
1361
1362      @Override
1363      public void setProperty(int hash, String name, Base value) throws FHIRException {
1364        switch (hash) {
1365        case 3560141: // time
1366          this.time = (Type) value; // Type
1367          break;
1368        case 3575610: // type
1369          this.type = castToCoding(value); // Coding
1370          break;
1371        default: super.setProperty(hash, name, value);
1372        }
1373
1374      }
1375
1376      @Override
1377      public void setProperty(String name, Base value) throws FHIRException {
1378        if (name.equals("time[x]"))
1379          this.time = (Type) value; // Type
1380        else if (name.equals("type"))
1381          this.type = castToCoding(value); // Coding
1382        else
1383          super.setProperty(name, value);
1384      }
1385
1386      @Override
1387      public Base makeProperty(int hash, String name) throws FHIRException {
1388        switch (hash) {
1389        case -1313930605:  return getTime(); // Type
1390        case 3575610:  return getType(); // Coding
1391        default: return super.makeProperty(hash, name);
1392        }
1393
1394      }
1395
1396      @Override
1397      public Base addChild(String name) throws FHIRException {
1398        if (name.equals("timeDate")) {
1399          this.time = new DateType();
1400          return this.time;
1401        }
1402        else if (name.equals("timePeriod")) {
1403          this.time = new Period();
1404          return this.time;
1405        }
1406        else if (name.equals("type")) {
1407          this.type = new Coding();
1408          return this.type;
1409        }
1410        else
1411          return super.addChild(name);
1412      }
1413
1414      public OnsetComponent copy() {
1415        OnsetComponent dst = new OnsetComponent();
1416        copyValues(dst);
1417        dst.time = time == null ? null : time.copy();
1418        dst.type = type == null ? null : type.copy();
1419        return dst;
1420      }
1421
1422      @Override
1423      public boolean equalsDeep(Base other) {
1424        if (!super.equalsDeep(other))
1425          return false;
1426        if (!(other instanceof OnsetComponent))
1427          return false;
1428        OnsetComponent o = (OnsetComponent) other;
1429        return compareDeep(time, o.time, true) && compareDeep(type, o.type, true);
1430      }
1431
1432      @Override
1433      public boolean equalsShallow(Base other) {
1434        if (!super.equalsShallow(other))
1435          return false;
1436        if (!(other instanceof OnsetComponent))
1437          return false;
1438        OnsetComponent o = (OnsetComponent) other;
1439        return true;
1440      }
1441
1442      public boolean isEmpty() {
1443        return super.isEmpty() && (time == null || time.isEmpty()) && (type == null || type.isEmpty())
1444          ;
1445      }
1446
1447  public String fhirType() {
1448    return "ExplanationOfBenefit.onset";
1449
1450  }
1451
1452  }
1453
1454    @Block()
1455    public static class ItemsComponent extends BackboneElement implements IBaseBackboneElement {
1456        /**
1457         * A service line number.
1458         */
1459        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1460        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
1461        protected PositiveIntType sequence;
1462
1463        /**
1464         * The type of product or service.
1465         */
1466        @Child(name = "type", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
1467        @Description(shortDefinition="Group or type of product or service", formalDefinition="The type of product or service." )
1468        protected Coding type;
1469
1470        /**
1471         * The practitioner who is responsible for the services rendered to the patient.
1472         */
1473        @Child(name = "provider", type = {Identifier.class, Practitioner.class}, order=3, min=0, max=1, modifier=false, summary=true)
1474        @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
1475        protected Type provider;
1476
1477        /**
1478         * The practitioner who is supervising the work of the servicing provider(s).
1479         */
1480        @Child(name = "supervisor", type = {Identifier.class, Practitioner.class}, order=4, min=0, max=1, modifier=false, summary=true)
1481        @Description(shortDefinition="Supervising Practitioner", formalDefinition="The practitioner who is supervising the work of the servicing provider(s)." )
1482        protected Type supervisor;
1483
1484        /**
1485         * The qualification which is applicable for this service.
1486         */
1487        @Child(name = "providerQualification", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
1488        @Description(shortDefinition="Type, classification or Specialization", formalDefinition="The qualification which is applicable for this service." )
1489        protected Coding providerQualification;
1490
1491        /**
1492         * Diagnosis applicable for this service or product line.
1493         */
1494        @Child(name = "diagnosisLinkId", type = {PositiveIntType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1495        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnosis applicable for this service or product line." )
1496        protected List<PositiveIntType> diagnosisLinkId;
1497
1498        /**
1499         * If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.
1500         */
1501        @Child(name = "service", type = {Coding.class}, order=7, min=1, max=1, modifier=false, summary=true)
1502        @Description(shortDefinition="Item Code", formalDefinition="If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied." )
1503        protected Coding service;
1504
1505        /**
1506         * Unusual circumstances which may influence adjudication.
1507         */
1508        @Child(name = "serviceModifier", type = {Coding.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1509        @Description(shortDefinition="Service/Product modifiers", formalDefinition="Unusual circumstances which may influence adjudication." )
1510        protected List<Coding> serviceModifier;
1511
1512        /**
1513         * Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or an appliance was lost or stolen.
1514         */
1515        @Child(name = "modifier", type = {Coding.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1516        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or an appliance was lost or stolen." )
1517        protected List<Coding> modifier;
1518
1519        /**
1520         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
1521         */
1522        @Child(name = "programCode", type = {Coding.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1523        @Description(shortDefinition="Program specific reason for item inclusion", formalDefinition="For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program." )
1524        protected List<Coding> programCode;
1525
1526        /**
1527         * The date or dates when the enclosed suite of services were performed or completed.
1528         */
1529        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=true)
1530        @Description(shortDefinition="Date or dates of Service", formalDefinition="The date or dates when the enclosed suite of services were performed or completed." )
1531        protected Type serviced;
1532
1533        /**
1534         * Where the service was provided.
1535         */
1536        @Child(name = "place", type = {Coding.class}, order=12, min=0, max=1, modifier=false, summary=true)
1537        @Description(shortDefinition="Place of service", formalDefinition="Where the service was provided." )
1538        protected Coding place;
1539
1540        /**
1541         * The number of repetitions of a service or product.
1542         */
1543        @Child(name = "quantity", type = {SimpleQuantity.class}, order=13, min=0, max=1, modifier=false, summary=true)
1544        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
1545        protected SimpleQuantity quantity;
1546
1547        /**
1548         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
1549         */
1550        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=true)
1551        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
1552        protected Money unitPrice;
1553
1554        /**
1555         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
1556         */
1557        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=true)
1558        @Description(shortDefinition="Price scaling factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
1559        protected DecimalType factor;
1560
1561        /**
1562         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
1563         */
1564        @Child(name = "points", type = {DecimalType.class}, order=16, min=0, max=1, modifier=false, summary=true)
1565        @Description(shortDefinition="Difficulty scaling factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point." )
1566        protected DecimalType points;
1567
1568        /**
1569         * The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
1570         */
1571        @Child(name = "net", type = {Money.class}, order=17, min=0, max=1, modifier=false, summary=true)
1572        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
1573        protected Money net;
1574
1575        /**
1576         * List of Unique Device Identifiers associated with this line item.
1577         */
1578        @Child(name = "udi", type = {Device.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1579        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
1580        protected List<Reference> udi;
1581        /**
1582         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
1583         */
1584        protected List<Device> udiTarget;
1585
1586
1587        /**
1588         * Physical service site on the patient (limb, tooth, etc).
1589         */
1590        @Child(name = "bodySite", type = {Coding.class}, order=19, min=0, max=1, modifier=false, summary=true)
1591        @Description(shortDefinition="Service Location", formalDefinition="Physical service site on the patient (limb, tooth, etc)." )
1592        protected Coding bodySite;
1593
1594        /**
1595         * A region or surface of the site, eg. limb region or tooth surface(s).
1596         */
1597        @Child(name = "subSite", type = {Coding.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1598        @Description(shortDefinition="Service Sub-location", formalDefinition="A region or surface of the site, eg. limb region or tooth surface(s)." )
1599        protected List<Coding> subSite;
1600
1601        /**
1602         * A list of note references to the notes provided below.
1603         */
1604        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1605        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
1606        protected List<PositiveIntType> noteNumber;
1607
1608        /**
1609         * The adjudications results.
1610         */
1611        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1612        @Description(shortDefinition="Adjudication details", formalDefinition="The adjudications results." )
1613        protected List<ItemAdjudicationComponent> adjudication;
1614
1615        /**
1616         * Second tier of goods and services.
1617         */
1618        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1619        @Description(shortDefinition="Additional items", formalDefinition="Second tier of goods and services." )
1620        protected List<DetailComponent> detail;
1621
1622        /**
1623         * The materials and placement date of prior fixed prosthesis.
1624         */
1625        @Child(name = "prosthesis", type = {}, order=24, min=0, max=1, modifier=false, summary=true)
1626        @Description(shortDefinition="Prosthetic details", formalDefinition="The materials and placement date of prior fixed prosthesis." )
1627        protected ProsthesisComponent prosthesis;
1628
1629        private static final long serialVersionUID = 2037926144L;
1630
1631    /**
1632     * Constructor
1633     */
1634      public ItemsComponent() {
1635        super();
1636      }
1637
1638    /**
1639     * Constructor
1640     */
1641      public ItemsComponent(PositiveIntType sequence, Coding type, Coding service) {
1642        super();
1643        this.sequence = sequence;
1644        this.type = type;
1645        this.service = service;
1646      }
1647
1648        /**
1649         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1650         */
1651        public PositiveIntType getSequenceElement() { 
1652          if (this.sequence == null)
1653            if (Configuration.errorOnAutoCreate())
1654              throw new Error("Attempt to auto-create ItemsComponent.sequence");
1655            else if (Configuration.doAutoCreate())
1656              this.sequence = new PositiveIntType(); // bb
1657          return this.sequence;
1658        }
1659
1660        public boolean hasSequenceElement() { 
1661          return this.sequence != null && !this.sequence.isEmpty();
1662        }
1663
1664        public boolean hasSequence() { 
1665          return this.sequence != null && !this.sequence.isEmpty();
1666        }
1667
1668        /**
1669         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1670         */
1671        public ItemsComponent setSequenceElement(PositiveIntType value) { 
1672          this.sequence = value;
1673          return this;
1674        }
1675
1676        /**
1677         * @return A service line number.
1678         */
1679        public int getSequence() { 
1680          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1681        }
1682
1683        /**
1684         * @param value A service line number.
1685         */
1686        public ItemsComponent setSequence(int value) { 
1687            if (this.sequence == null)
1688              this.sequence = new PositiveIntType();
1689            this.sequence.setValue(value);
1690          return this;
1691        }
1692
1693        /**
1694         * @return {@link #type} (The type of product or service.)
1695         */
1696        public Coding getType() { 
1697          if (this.type == null)
1698            if (Configuration.errorOnAutoCreate())
1699              throw new Error("Attempt to auto-create ItemsComponent.type");
1700            else if (Configuration.doAutoCreate())
1701              this.type = new Coding(); // cc
1702          return this.type;
1703        }
1704
1705        public boolean hasType() { 
1706          return this.type != null && !this.type.isEmpty();
1707        }
1708
1709        /**
1710         * @param value {@link #type} (The type of product or service.)
1711         */
1712        public ItemsComponent setType(Coding value) { 
1713          this.type = value;
1714          return this;
1715        }
1716
1717        /**
1718         * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1719         */
1720        public Type getProvider() { 
1721          return this.provider;
1722        }
1723
1724        /**
1725         * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1726         */
1727        public Identifier getProviderIdentifier() throws FHIRException { 
1728          if (!(this.provider instanceof Identifier))
1729            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.provider.getClass().getName()+" was encountered");
1730          return (Identifier) this.provider;
1731        }
1732
1733        public boolean hasProviderIdentifier() { 
1734          return this.provider instanceof Identifier;
1735        }
1736
1737        /**
1738         * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1739         */
1740        public Reference getProviderReference() throws FHIRException { 
1741          if (!(this.provider instanceof Reference))
1742            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.provider.getClass().getName()+" was encountered");
1743          return (Reference) this.provider;
1744        }
1745
1746        public boolean hasProviderReference() { 
1747          return this.provider instanceof Reference;
1748        }
1749
1750        public boolean hasProvider() { 
1751          return this.provider != null && !this.provider.isEmpty();
1752        }
1753
1754        /**
1755         * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1756         */
1757        public ItemsComponent setProvider(Type value) { 
1758          this.provider = value;
1759          return this;
1760        }
1761
1762        /**
1763         * @return {@link #supervisor} (The practitioner who is supervising the work of the servicing provider(s).)
1764         */
1765        public Type getSupervisor() { 
1766          return this.supervisor;
1767        }
1768
1769        /**
1770         * @return {@link #supervisor} (The practitioner who is supervising the work of the servicing provider(s).)
1771         */
1772        public Identifier getSupervisorIdentifier() throws FHIRException { 
1773          if (!(this.supervisor instanceof Identifier))
1774            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.supervisor.getClass().getName()+" was encountered");
1775          return (Identifier) this.supervisor;
1776        }
1777
1778        public boolean hasSupervisorIdentifier() { 
1779          return this.supervisor instanceof Identifier;
1780        }
1781
1782        /**
1783         * @return {@link #supervisor} (The practitioner who is supervising the work of the servicing provider(s).)
1784         */
1785        public Reference getSupervisorReference() throws FHIRException { 
1786          if (!(this.supervisor instanceof Reference))
1787            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.supervisor.getClass().getName()+" was encountered");
1788          return (Reference) this.supervisor;
1789        }
1790
1791        public boolean hasSupervisorReference() { 
1792          return this.supervisor instanceof Reference;
1793        }
1794
1795        public boolean hasSupervisor() { 
1796          return this.supervisor != null && !this.supervisor.isEmpty();
1797        }
1798
1799        /**
1800         * @param value {@link #supervisor} (The practitioner who is supervising the work of the servicing provider(s).)
1801         */
1802        public ItemsComponent setSupervisor(Type value) { 
1803          this.supervisor = value;
1804          return this;
1805        }
1806
1807        /**
1808         * @return {@link #providerQualification} (The qualification which is applicable for this service.)
1809         */
1810        public Coding getProviderQualification() { 
1811          if (this.providerQualification == null)
1812            if (Configuration.errorOnAutoCreate())
1813              throw new Error("Attempt to auto-create ItemsComponent.providerQualification");
1814            else if (Configuration.doAutoCreate())
1815              this.providerQualification = new Coding(); // cc
1816          return this.providerQualification;
1817        }
1818
1819        public boolean hasProviderQualification() { 
1820          return this.providerQualification != null && !this.providerQualification.isEmpty();
1821        }
1822
1823        /**
1824         * @param value {@link #providerQualification} (The qualification which is applicable for this service.)
1825         */
1826        public ItemsComponent setProviderQualification(Coding value) { 
1827          this.providerQualification = value;
1828          return this;
1829        }
1830
1831        /**
1832         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1833         */
1834        public List<PositiveIntType> getDiagnosisLinkId() { 
1835          if (this.diagnosisLinkId == null)
1836            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
1837          return this.diagnosisLinkId;
1838        }
1839
1840        public boolean hasDiagnosisLinkId() { 
1841          if (this.diagnosisLinkId == null)
1842            return false;
1843          for (PositiveIntType item : this.diagnosisLinkId)
1844            if (!item.isEmpty())
1845              return true;
1846          return false;
1847        }
1848
1849        /**
1850         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1851         */
1852    // syntactic sugar
1853        public PositiveIntType addDiagnosisLinkIdElement() {//2 
1854          PositiveIntType t = new PositiveIntType();
1855          if (this.diagnosisLinkId == null)
1856            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
1857          this.diagnosisLinkId.add(t);
1858          return t;
1859        }
1860
1861        /**
1862         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1863         */
1864        public ItemsComponent addDiagnosisLinkId(int value) { //1
1865          PositiveIntType t = new PositiveIntType();
1866          t.setValue(value);
1867          if (this.diagnosisLinkId == null)
1868            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
1869          this.diagnosisLinkId.add(t);
1870          return this;
1871        }
1872
1873        /**
1874         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1875         */
1876        public boolean hasDiagnosisLinkId(int value) { 
1877          if (this.diagnosisLinkId == null)
1878            return false;
1879          for (PositiveIntType v : this.diagnosisLinkId)
1880            if (v.equals(value)) // positiveInt
1881              return true;
1882          return false;
1883        }
1884
1885        /**
1886         * @return {@link #service} (If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.)
1887         */
1888        public Coding getService() { 
1889          if (this.service == null)
1890            if (Configuration.errorOnAutoCreate())
1891              throw new Error("Attempt to auto-create ItemsComponent.service");
1892            else if (Configuration.doAutoCreate())
1893              this.service = new Coding(); // cc
1894          return this.service;
1895        }
1896
1897        public boolean hasService() { 
1898          return this.service != null && !this.service.isEmpty();
1899        }
1900
1901        /**
1902         * @param value {@link #service} (If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.)
1903         */
1904        public ItemsComponent setService(Coding value) { 
1905          this.service = value;
1906          return this;
1907        }
1908
1909        /**
1910         * @return {@link #serviceModifier} (Unusual circumstances which may influence adjudication.)
1911         */
1912        public List<Coding> getServiceModifier() { 
1913          if (this.serviceModifier == null)
1914            this.serviceModifier = new ArrayList<Coding>();
1915          return this.serviceModifier;
1916        }
1917
1918        public boolean hasServiceModifier() { 
1919          if (this.serviceModifier == null)
1920            return false;
1921          for (Coding item : this.serviceModifier)
1922            if (!item.isEmpty())
1923              return true;
1924          return false;
1925        }
1926
1927        /**
1928         * @return {@link #serviceModifier} (Unusual circumstances which may influence adjudication.)
1929         */
1930    // syntactic sugar
1931        public Coding addServiceModifier() { //3
1932          Coding t = new Coding();
1933          if (this.serviceModifier == null)
1934            this.serviceModifier = new ArrayList<Coding>();
1935          this.serviceModifier.add(t);
1936          return t;
1937        }
1938
1939    // syntactic sugar
1940        public ItemsComponent addServiceModifier(Coding t) { //3
1941          if (t == null)
1942            return this;
1943          if (this.serviceModifier == null)
1944            this.serviceModifier = new ArrayList<Coding>();
1945          this.serviceModifier.add(t);
1946          return this;
1947        }
1948
1949        /**
1950         * @return {@link #modifier} (Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or an appliance was lost or stolen.)
1951         */
1952        public List<Coding> getModifier() { 
1953          if (this.modifier == null)
1954            this.modifier = new ArrayList<Coding>();
1955          return this.modifier;
1956        }
1957
1958        public boolean hasModifier() { 
1959          if (this.modifier == null)
1960            return false;
1961          for (Coding item : this.modifier)
1962            if (!item.isEmpty())
1963              return true;
1964          return false;
1965        }
1966
1967        /**
1968         * @return {@link #modifier} (Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or an appliance was lost or stolen.)
1969         */
1970    // syntactic sugar
1971        public Coding addModifier() { //3
1972          Coding t = new Coding();
1973          if (this.modifier == null)
1974            this.modifier = new ArrayList<Coding>();
1975          this.modifier.add(t);
1976          return t;
1977        }
1978
1979    // syntactic sugar
1980        public ItemsComponent addModifier(Coding t) { //3
1981          if (t == null)
1982            return this;
1983          if (this.modifier == null)
1984            this.modifier = new ArrayList<Coding>();
1985          this.modifier.add(t);
1986          return this;
1987        }
1988
1989        /**
1990         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
1991         */
1992        public List<Coding> getProgramCode() { 
1993          if (this.programCode == null)
1994            this.programCode = new ArrayList<Coding>();
1995          return this.programCode;
1996        }
1997
1998        public boolean hasProgramCode() { 
1999          if (this.programCode == null)
2000            return false;
2001          for (Coding item : this.programCode)
2002            if (!item.isEmpty())
2003              return true;
2004          return false;
2005        }
2006
2007        /**
2008         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
2009         */
2010    // syntactic sugar
2011        public Coding addProgramCode() { //3
2012          Coding t = new Coding();
2013          if (this.programCode == null)
2014            this.programCode = new ArrayList<Coding>();
2015          this.programCode.add(t);
2016          return t;
2017        }
2018
2019    // syntactic sugar
2020        public ItemsComponent addProgramCode(Coding t) { //3
2021          if (t == null)
2022            return this;
2023          if (this.programCode == null)
2024            this.programCode = new ArrayList<Coding>();
2025          this.programCode.add(t);
2026          return this;
2027        }
2028
2029        /**
2030         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2031         */
2032        public Type getServiced() { 
2033          return this.serviced;
2034        }
2035
2036        /**
2037         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2038         */
2039        public DateType getServicedDateType() throws FHIRException { 
2040          if (!(this.serviced instanceof DateType))
2041            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
2042          return (DateType) this.serviced;
2043        }
2044
2045        public boolean hasServicedDateType() { 
2046          return this.serviced instanceof DateType;
2047        }
2048
2049        /**
2050         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2051         */
2052        public Period getServicedPeriod() throws FHIRException { 
2053          if (!(this.serviced instanceof Period))
2054            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
2055          return (Period) this.serviced;
2056        }
2057
2058        public boolean hasServicedPeriod() { 
2059          return this.serviced instanceof Period;
2060        }
2061
2062        public boolean hasServiced() { 
2063          return this.serviced != null && !this.serviced.isEmpty();
2064        }
2065
2066        /**
2067         * @param value {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2068         */
2069        public ItemsComponent setServiced(Type value) { 
2070          this.serviced = value;
2071          return this;
2072        }
2073
2074        /**
2075         * @return {@link #place} (Where the service was provided.)
2076         */
2077        public Coding getPlace() { 
2078          if (this.place == null)
2079            if (Configuration.errorOnAutoCreate())
2080              throw new Error("Attempt to auto-create ItemsComponent.place");
2081            else if (Configuration.doAutoCreate())
2082              this.place = new Coding(); // cc
2083          return this.place;
2084        }
2085
2086        public boolean hasPlace() { 
2087          return this.place != null && !this.place.isEmpty();
2088        }
2089
2090        /**
2091         * @param value {@link #place} (Where the service was provided.)
2092         */
2093        public ItemsComponent setPlace(Coding value) { 
2094          this.place = value;
2095          return this;
2096        }
2097
2098        /**
2099         * @return {@link #quantity} (The number of repetitions of a service or product.)
2100         */
2101        public SimpleQuantity getQuantity() { 
2102          if (this.quantity == null)
2103            if (Configuration.errorOnAutoCreate())
2104              throw new Error("Attempt to auto-create ItemsComponent.quantity");
2105            else if (Configuration.doAutoCreate())
2106              this.quantity = new SimpleQuantity(); // cc
2107          return this.quantity;
2108        }
2109
2110        public boolean hasQuantity() { 
2111          return this.quantity != null && !this.quantity.isEmpty();
2112        }
2113
2114        /**
2115         * @param value {@link #quantity} (The number of repetitions of a service or product.)
2116         */
2117        public ItemsComponent setQuantity(SimpleQuantity value) { 
2118          this.quantity = value;
2119          return this;
2120        }
2121
2122        /**
2123         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
2124         */
2125        public Money getUnitPrice() { 
2126          if (this.unitPrice == null)
2127            if (Configuration.errorOnAutoCreate())
2128              throw new Error("Attempt to auto-create ItemsComponent.unitPrice");
2129            else if (Configuration.doAutoCreate())
2130              this.unitPrice = new Money(); // cc
2131          return this.unitPrice;
2132        }
2133
2134        public boolean hasUnitPrice() { 
2135          return this.unitPrice != null && !this.unitPrice.isEmpty();
2136        }
2137
2138        /**
2139         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
2140         */
2141        public ItemsComponent setUnitPrice(Money value) { 
2142          this.unitPrice = value;
2143          return this;
2144        }
2145
2146        /**
2147         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
2148         */
2149        public DecimalType getFactorElement() { 
2150          if (this.factor == null)
2151            if (Configuration.errorOnAutoCreate())
2152              throw new Error("Attempt to auto-create ItemsComponent.factor");
2153            else if (Configuration.doAutoCreate())
2154              this.factor = new DecimalType(); // bb
2155          return this.factor;
2156        }
2157
2158        public boolean hasFactorElement() { 
2159          return this.factor != null && !this.factor.isEmpty();
2160        }
2161
2162        public boolean hasFactor() { 
2163          return this.factor != null && !this.factor.isEmpty();
2164        }
2165
2166        /**
2167         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
2168         */
2169        public ItemsComponent setFactorElement(DecimalType value) { 
2170          this.factor = value;
2171          return this;
2172        }
2173
2174        /**
2175         * @return A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
2176         */
2177        public BigDecimal getFactor() { 
2178          return this.factor == null ? null : this.factor.getValue();
2179        }
2180
2181        /**
2182         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
2183         */
2184        public ItemsComponent setFactor(BigDecimal value) { 
2185          if (value == null)
2186            this.factor = null;
2187          else {
2188            if (this.factor == null)
2189              this.factor = new DecimalType();
2190            this.factor.setValue(value);
2191          }
2192          return this;
2193        }
2194
2195        /**
2196         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
2197         */
2198        public ItemsComponent setFactor(long value) { 
2199              this.factor = new DecimalType();
2200            this.factor.setValue(value);
2201          return this;
2202        }
2203
2204        /**
2205         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
2206         */
2207        public ItemsComponent setFactor(double value) { 
2208              this.factor = new DecimalType();
2209            this.factor.setValue(value);
2210          return this;
2211        }
2212
2213        /**
2214         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
2215         */
2216        public DecimalType getPointsElement() { 
2217          if (this.points == null)
2218            if (Configuration.errorOnAutoCreate())
2219              throw new Error("Attempt to auto-create ItemsComponent.points");
2220            else if (Configuration.doAutoCreate())
2221              this.points = new DecimalType(); // bb
2222          return this.points;
2223        }
2224
2225        public boolean hasPointsElement() { 
2226          return this.points != null && !this.points.isEmpty();
2227        }
2228
2229        public boolean hasPoints() { 
2230          return this.points != null && !this.points.isEmpty();
2231        }
2232
2233        /**
2234         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
2235         */
2236        public ItemsComponent setPointsElement(DecimalType value) { 
2237          this.points = value;
2238          return this;
2239        }
2240
2241        /**
2242         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
2243         */
2244        public BigDecimal getPoints() { 
2245          return this.points == null ? null : this.points.getValue();
2246        }
2247
2248        /**
2249         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
2250         */
2251        public ItemsComponent setPoints(BigDecimal value) { 
2252          if (value == null)
2253            this.points = null;
2254          else {
2255            if (this.points == null)
2256              this.points = new DecimalType();
2257            this.points.setValue(value);
2258          }
2259          return this;
2260        }
2261
2262        /**
2263         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
2264         */
2265        public ItemsComponent setPoints(long value) { 
2266              this.points = new DecimalType();
2267            this.points.setValue(value);
2268          return this;
2269        }
2270
2271        /**
2272         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
2273         */
2274        public ItemsComponent setPoints(double value) { 
2275              this.points = new DecimalType();
2276            this.points.setValue(value);
2277          return this;
2278        }
2279
2280        /**
2281         * @return {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
2282         */
2283        public Money getNet() { 
2284          if (this.net == null)
2285            if (Configuration.errorOnAutoCreate())
2286              throw new Error("Attempt to auto-create ItemsComponent.net");
2287            else if (Configuration.doAutoCreate())
2288              this.net = new Money(); // cc
2289          return this.net;
2290        }
2291
2292        public boolean hasNet() { 
2293          return this.net != null && !this.net.isEmpty();
2294        }
2295
2296        /**
2297         * @param value {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
2298         */
2299        public ItemsComponent setNet(Money value) { 
2300          this.net = value;
2301          return this;
2302        }
2303
2304        /**
2305         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
2306         */
2307        public List<Reference> getUdi() { 
2308          if (this.udi == null)
2309            this.udi = new ArrayList<Reference>();
2310          return this.udi;
2311        }
2312
2313        public boolean hasUdi() { 
2314          if (this.udi == null)
2315            return false;
2316          for (Reference item : this.udi)
2317            if (!item.isEmpty())
2318              return true;
2319          return false;
2320        }
2321
2322        /**
2323         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
2324         */
2325    // syntactic sugar
2326        public Reference addUdi() { //3
2327          Reference t = new Reference();
2328          if (this.udi == null)
2329            this.udi = new ArrayList<Reference>();
2330          this.udi.add(t);
2331          return t;
2332        }
2333
2334    // syntactic sugar
2335        public ItemsComponent addUdi(Reference t) { //3
2336          if (t == null)
2337            return this;
2338          if (this.udi == null)
2339            this.udi = new ArrayList<Reference>();
2340          this.udi.add(t);
2341          return this;
2342        }
2343
2344        /**
2345         * @return {@link #udi} (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. List of Unique Device Identifiers associated with this line item.)
2346         */
2347        public List<Device> getUdiTarget() { 
2348          if (this.udiTarget == null)
2349            this.udiTarget = new ArrayList<Device>();
2350          return this.udiTarget;
2351        }
2352
2353    // syntactic sugar
2354        /**
2355         * @return {@link #udi} (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. List of Unique Device Identifiers associated with this line item.)
2356         */
2357        public Device addUdiTarget() { 
2358          Device r = new Device();
2359          if (this.udiTarget == null)
2360            this.udiTarget = new ArrayList<Device>();
2361          this.udiTarget.add(r);
2362          return r;
2363        }
2364
2365        /**
2366         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
2367         */
2368        public Coding getBodySite() { 
2369          if (this.bodySite == null)
2370            if (Configuration.errorOnAutoCreate())
2371              throw new Error("Attempt to auto-create ItemsComponent.bodySite");
2372            else if (Configuration.doAutoCreate())
2373              this.bodySite = new Coding(); // cc
2374          return this.bodySite;
2375        }
2376
2377        public boolean hasBodySite() { 
2378          return this.bodySite != null && !this.bodySite.isEmpty();
2379        }
2380
2381        /**
2382         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
2383         */
2384        public ItemsComponent setBodySite(Coding value) { 
2385          this.bodySite = value;
2386          return this;
2387        }
2388
2389        /**
2390         * @return {@link #subSite} (A region or surface of the site, eg. limb region or tooth surface(s).)
2391         */
2392        public List<Coding> getSubSite() { 
2393          if (this.subSite == null)
2394            this.subSite = new ArrayList<Coding>();
2395          return this.subSite;
2396        }
2397
2398        public boolean hasSubSite() { 
2399          if (this.subSite == null)
2400            return false;
2401          for (Coding item : this.subSite)
2402            if (!item.isEmpty())
2403              return true;
2404          return false;
2405        }
2406
2407        /**
2408         * @return {@link #subSite} (A region or surface of the site, eg. limb region or tooth surface(s).)
2409         */
2410    // syntactic sugar
2411        public Coding addSubSite() { //3
2412          Coding t = new Coding();
2413          if (this.subSite == null)
2414            this.subSite = new ArrayList<Coding>();
2415          this.subSite.add(t);
2416          return t;
2417        }
2418
2419    // syntactic sugar
2420        public ItemsComponent addSubSite(Coding t) { //3
2421          if (t == null)
2422            return this;
2423          if (this.subSite == null)
2424            this.subSite = new ArrayList<Coding>();
2425          this.subSite.add(t);
2426          return this;
2427        }
2428
2429        /**
2430         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
2431         */
2432        public List<PositiveIntType> getNoteNumber() { 
2433          if (this.noteNumber == null)
2434            this.noteNumber = new ArrayList<PositiveIntType>();
2435          return this.noteNumber;
2436        }
2437
2438        public boolean hasNoteNumber() { 
2439          if (this.noteNumber == null)
2440            return false;
2441          for (PositiveIntType item : this.noteNumber)
2442            if (!item.isEmpty())
2443              return true;
2444          return false;
2445        }
2446
2447        /**
2448         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
2449         */
2450    // syntactic sugar
2451        public PositiveIntType addNoteNumberElement() {//2 
2452          PositiveIntType t = new PositiveIntType();
2453          if (this.noteNumber == null)
2454            this.noteNumber = new ArrayList<PositiveIntType>();
2455          this.noteNumber.add(t);
2456          return t;
2457        }
2458
2459        /**
2460         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
2461         */
2462        public ItemsComponent addNoteNumber(int value) { //1
2463          PositiveIntType t = new PositiveIntType();
2464          t.setValue(value);
2465          if (this.noteNumber == null)
2466            this.noteNumber = new ArrayList<PositiveIntType>();
2467          this.noteNumber.add(t);
2468          return this;
2469        }
2470
2471        /**
2472         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
2473         */
2474        public boolean hasNoteNumber(int value) { 
2475          if (this.noteNumber == null)
2476            return false;
2477          for (PositiveIntType v : this.noteNumber)
2478            if (v.equals(value)) // positiveInt
2479              return true;
2480          return false;
2481        }
2482
2483        /**
2484         * @return {@link #adjudication} (The adjudications results.)
2485         */
2486        public List<ItemAdjudicationComponent> getAdjudication() { 
2487          if (this.adjudication == null)
2488            this.adjudication = new ArrayList<ItemAdjudicationComponent>();
2489          return this.adjudication;
2490        }
2491
2492        public boolean hasAdjudication() { 
2493          if (this.adjudication == null)
2494            return false;
2495          for (ItemAdjudicationComponent item : this.adjudication)
2496            if (!item.isEmpty())
2497              return true;
2498          return false;
2499        }
2500
2501        /**
2502         * @return {@link #adjudication} (The adjudications results.)
2503         */
2504    // syntactic sugar
2505        public ItemAdjudicationComponent addAdjudication() { //3
2506          ItemAdjudicationComponent t = new ItemAdjudicationComponent();
2507          if (this.adjudication == null)
2508            this.adjudication = new ArrayList<ItemAdjudicationComponent>();
2509          this.adjudication.add(t);
2510          return t;
2511        }
2512
2513    // syntactic sugar
2514        public ItemsComponent addAdjudication(ItemAdjudicationComponent t) { //3
2515          if (t == null)
2516            return this;
2517          if (this.adjudication == null)
2518            this.adjudication = new ArrayList<ItemAdjudicationComponent>();
2519          this.adjudication.add(t);
2520          return this;
2521        }
2522
2523        /**
2524         * @return {@link #detail} (Second tier of goods and services.)
2525         */
2526        public List<DetailComponent> getDetail() { 
2527          if (this.detail == null)
2528            this.detail = new ArrayList<DetailComponent>();
2529          return this.detail;
2530        }
2531
2532        public boolean hasDetail() { 
2533          if (this.detail == null)
2534            return false;
2535          for (DetailComponent item : this.detail)
2536            if (!item.isEmpty())
2537              return true;
2538          return false;
2539        }
2540
2541        /**
2542         * @return {@link #detail} (Second tier of goods and services.)
2543         */
2544    // syntactic sugar
2545        public DetailComponent addDetail() { //3
2546          DetailComponent t = new DetailComponent();
2547          if (this.detail == null)
2548            this.detail = new ArrayList<DetailComponent>();
2549          this.detail.add(t);
2550          return t;
2551        }
2552
2553    // syntactic sugar
2554        public ItemsComponent addDetail(DetailComponent t) { //3
2555          if (t == null)
2556            return this;
2557          if (this.detail == null)
2558            this.detail = new ArrayList<DetailComponent>();
2559          this.detail.add(t);
2560          return this;
2561        }
2562
2563        /**
2564         * @return {@link #prosthesis} (The materials and placement date of prior fixed prosthesis.)
2565         */
2566        public ProsthesisComponent getProsthesis() { 
2567          if (this.prosthesis == null)
2568            if (Configuration.errorOnAutoCreate())
2569              throw new Error("Attempt to auto-create ItemsComponent.prosthesis");
2570            else if (Configuration.doAutoCreate())
2571              this.prosthesis = new ProsthesisComponent(); // cc
2572          return this.prosthesis;
2573        }
2574
2575        public boolean hasProsthesis() { 
2576          return this.prosthesis != null && !this.prosthesis.isEmpty();
2577        }
2578
2579        /**
2580         * @param value {@link #prosthesis} (The materials and placement date of prior fixed prosthesis.)
2581         */
2582        public ItemsComponent setProsthesis(ProsthesisComponent value) { 
2583          this.prosthesis = value;
2584          return this;
2585        }
2586
2587        protected void listChildren(List<Property> childrenList) {
2588          super.listChildren(childrenList);
2589          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
2590          childrenList.add(new Property("type", "Coding", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
2591          childrenList.add(new Property("provider[x]", "Identifier|Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider));
2592          childrenList.add(new Property("supervisor[x]", "Identifier|Reference(Practitioner)", "The practitioner who is supervising the work of the servicing provider(s).", 0, java.lang.Integer.MAX_VALUE, supervisor));
2593          childrenList.add(new Property("providerQualification", "Coding", "The qualification which is applicable for this service.", 0, java.lang.Integer.MAX_VALUE, providerQualification));
2594          childrenList.add(new Property("diagnosisLinkId", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisLinkId));
2595          childrenList.add(new Property("service", "Coding", "If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
2596          childrenList.add(new Property("serviceModifier", "Coding", "Unusual circumstances which may influence adjudication.", 0, java.lang.Integer.MAX_VALUE, serviceModifier));
2597          childrenList.add(new Property("modifier", "Coding", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or an appliance was lost or stolen.", 0, java.lang.Integer.MAX_VALUE, modifier));
2598          childrenList.add(new Property("programCode", "Coding", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
2599          childrenList.add(new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, serviced));
2600          childrenList.add(new Property("place", "Coding", "Where the service was provided.", 0, java.lang.Integer.MAX_VALUE, place));
2601          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
2602          childrenList.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, java.lang.Integer.MAX_VALUE, unitPrice));
2603          childrenList.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, java.lang.Integer.MAX_VALUE, factor));
2604          childrenList.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.", 0, java.lang.Integer.MAX_VALUE, points));
2605          childrenList.add(new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, java.lang.Integer.MAX_VALUE, net));
2606          childrenList.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2607          childrenList.add(new Property("bodySite", "Coding", "Physical service site on the patient (limb, tooth, etc).", 0, java.lang.Integer.MAX_VALUE, bodySite));
2608          childrenList.add(new Property("subSite", "Coding", "A region or surface of the site, eg. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
2609          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
2610          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
2611          childrenList.add(new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
2612          childrenList.add(new Property("prosthesis", "", "The materials and placement date of prior fixed prosthesis.", 0, java.lang.Integer.MAX_VALUE, prosthesis));
2613        }
2614
2615      @Override
2616      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2617        switch (hash) {
2618        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2619        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
2620        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Type
2621        case -1697229976: /*supervisor*/ return this.supervisor == null ? new Base[0] : new Base[] {this.supervisor}; // Type
2622        case -1240156290: /*providerQualification*/ return this.providerQualification == null ? new Base[0] : new Base[] {this.providerQualification}; // Coding
2623        case -1659207418: /*diagnosisLinkId*/ return this.diagnosisLinkId == null ? new Base[0] : this.diagnosisLinkId.toArray(new Base[this.diagnosisLinkId.size()]); // PositiveIntType
2624        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // Coding
2625        case 615164076: /*serviceModifier*/ return this.serviceModifier == null ? new Base[0] : this.serviceModifier.toArray(new Base[this.serviceModifier.size()]); // Coding
2626        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // Coding
2627        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // Coding
2628        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
2629        case 106748167: /*place*/ return this.place == null ? new Base[0] : new Base[] {this.place}; // Coding
2630        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
2631        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
2632        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
2633        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
2634        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
2635        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2636        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // Coding
2637        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // Coding
2638        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
2639        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // ItemAdjudicationComponent
2640        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
2641        case -2138744398: /*prosthesis*/ return this.prosthesis == null ? new Base[0] : new Base[] {this.prosthesis}; // ProsthesisComponent
2642        default: return super.getProperty(hash, name, checkValid);
2643        }
2644
2645      }
2646
2647      @Override
2648      public void setProperty(int hash, String name, Base value) throws FHIRException {
2649        switch (hash) {
2650        case 1349547969: // sequence
2651          this.sequence = castToPositiveInt(value); // PositiveIntType
2652          break;
2653        case 3575610: // type
2654          this.type = castToCoding(value); // Coding
2655          break;
2656        case -987494927: // provider
2657          this.provider = (Type) value; // Type
2658          break;
2659        case -1697229976: // supervisor
2660          this.supervisor = (Type) value; // Type
2661          break;
2662        case -1240156290: // providerQualification
2663          this.providerQualification = castToCoding(value); // Coding
2664          break;
2665        case -1659207418: // diagnosisLinkId
2666          this.getDiagnosisLinkId().add(castToPositiveInt(value)); // PositiveIntType
2667          break;
2668        case 1984153269: // service
2669          this.service = castToCoding(value); // Coding
2670          break;
2671        case 615164076: // serviceModifier
2672          this.getServiceModifier().add(castToCoding(value)); // Coding
2673          break;
2674        case -615513385: // modifier
2675          this.getModifier().add(castToCoding(value)); // Coding
2676          break;
2677        case 1010065041: // programCode
2678          this.getProgramCode().add(castToCoding(value)); // Coding
2679          break;
2680        case 1379209295: // serviced
2681          this.serviced = (Type) value; // Type
2682          break;
2683        case 106748167: // place
2684          this.place = castToCoding(value); // Coding
2685          break;
2686        case -1285004149: // quantity
2687          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2688          break;
2689        case -486196699: // unitPrice
2690          this.unitPrice = castToMoney(value); // Money
2691          break;
2692        case -1282148017: // factor
2693          this.factor = castToDecimal(value); // DecimalType
2694          break;
2695        case -982754077: // points
2696          this.points = castToDecimal(value); // DecimalType
2697          break;
2698        case 108957: // net
2699          this.net = castToMoney(value); // Money
2700          break;
2701        case 115642: // udi
2702          this.getUdi().add(castToReference(value)); // Reference
2703          break;
2704        case 1702620169: // bodySite
2705          this.bodySite = castToCoding(value); // Coding
2706          break;
2707        case -1868566105: // subSite
2708          this.getSubSite().add(castToCoding(value)); // Coding
2709          break;
2710        case -1110033957: // noteNumber
2711          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
2712          break;
2713        case -231349275: // adjudication
2714          this.getAdjudication().add((ItemAdjudicationComponent) value); // ItemAdjudicationComponent
2715          break;
2716        case -1335224239: // detail
2717          this.getDetail().add((DetailComponent) value); // DetailComponent
2718          break;
2719        case -2138744398: // prosthesis
2720          this.prosthesis = (ProsthesisComponent) value; // ProsthesisComponent
2721          break;
2722        default: super.setProperty(hash, name, value);
2723        }
2724
2725      }
2726
2727      @Override
2728      public void setProperty(String name, Base value) throws FHIRException {
2729        if (name.equals("sequence"))
2730          this.sequence = castToPositiveInt(value); // PositiveIntType
2731        else if (name.equals("type"))
2732          this.type = castToCoding(value); // Coding
2733        else if (name.equals("provider[x]"))
2734          this.provider = (Type) value; // Type
2735        else if (name.equals("supervisor[x]"))
2736          this.supervisor = (Type) value; // Type
2737        else if (name.equals("providerQualification"))
2738          this.providerQualification = castToCoding(value); // Coding
2739        else if (name.equals("diagnosisLinkId"))
2740          this.getDiagnosisLinkId().add(castToPositiveInt(value));
2741        else if (name.equals("service"))
2742          this.service = castToCoding(value); // Coding
2743        else if (name.equals("serviceModifier"))
2744          this.getServiceModifier().add(castToCoding(value));
2745        else if (name.equals("modifier"))
2746          this.getModifier().add(castToCoding(value));
2747        else if (name.equals("programCode"))
2748          this.getProgramCode().add(castToCoding(value));
2749        else if (name.equals("serviced[x]"))
2750          this.serviced = (Type) value; // Type
2751        else if (name.equals("place"))
2752          this.place = castToCoding(value); // Coding
2753        else if (name.equals("quantity"))
2754          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2755        else if (name.equals("unitPrice"))
2756          this.unitPrice = castToMoney(value); // Money
2757        else if (name.equals("factor"))
2758          this.factor = castToDecimal(value); // DecimalType
2759        else if (name.equals("points"))
2760          this.points = castToDecimal(value); // DecimalType
2761        else if (name.equals("net"))
2762          this.net = castToMoney(value); // Money
2763        else if (name.equals("udi"))
2764          this.getUdi().add(castToReference(value));
2765        else if (name.equals("bodySite"))
2766          this.bodySite = castToCoding(value); // Coding
2767        else if (name.equals("subSite"))
2768          this.getSubSite().add(castToCoding(value));
2769        else if (name.equals("noteNumber"))
2770          this.getNoteNumber().add(castToPositiveInt(value));
2771        else if (name.equals("adjudication"))
2772          this.getAdjudication().add((ItemAdjudicationComponent) value);
2773        else if (name.equals("detail"))
2774          this.getDetail().add((DetailComponent) value);
2775        else if (name.equals("prosthesis"))
2776          this.prosthesis = (ProsthesisComponent) value; // ProsthesisComponent
2777        else
2778          super.setProperty(name, value);
2779      }
2780
2781      @Override
2782      public Base makeProperty(int hash, String name) throws FHIRException {
2783        switch (hash) {
2784        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
2785        case 3575610:  return getType(); // Coding
2786        case 2064698607:  return getProvider(); // Type
2787        case -1823115240:  return getSupervisor(); // Type
2788        case -1240156290:  return getProviderQualification(); // Coding
2789        case -1659207418: throw new FHIRException("Cannot make property diagnosisLinkId as it is not a complex type"); // PositiveIntType
2790        case 1984153269:  return getService(); // Coding
2791        case 615164076:  return addServiceModifier(); // Coding
2792        case -615513385:  return addModifier(); // Coding
2793        case 1010065041:  return addProgramCode(); // Coding
2794        case -1927922223:  return getServiced(); // Type
2795        case 106748167:  return getPlace(); // Coding
2796        case -1285004149:  return getQuantity(); // SimpleQuantity
2797        case -486196699:  return getUnitPrice(); // Money
2798        case -1282148017: throw new FHIRException("Cannot make property factor as it is not a complex type"); // DecimalType
2799        case -982754077: throw new FHIRException("Cannot make property points as it is not a complex type"); // DecimalType
2800        case 108957:  return getNet(); // Money
2801        case 115642:  return addUdi(); // Reference
2802        case 1702620169:  return getBodySite(); // Coding
2803        case -1868566105:  return addSubSite(); // Coding
2804        case -1110033957: throw new FHIRException("Cannot make property noteNumber as it is not a complex type"); // PositiveIntType
2805        case -231349275:  return addAdjudication(); // ItemAdjudicationComponent
2806        case -1335224239:  return addDetail(); // DetailComponent
2807        case -2138744398:  return getProsthesis(); // ProsthesisComponent
2808        default: return super.makeProperty(hash, name);
2809        }
2810
2811      }
2812
2813      @Override
2814      public Base addChild(String name) throws FHIRException {
2815        if (name.equals("sequence")) {
2816          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2817        }
2818        else if (name.equals("type")) {
2819          this.type = new Coding();
2820          return this.type;
2821        }
2822        else if (name.equals("providerIdentifier")) {
2823          this.provider = new Identifier();
2824          return this.provider;
2825        }
2826        else if (name.equals("providerReference")) {
2827          this.provider = new Reference();
2828          return this.provider;
2829        }
2830        else if (name.equals("supervisorIdentifier")) {
2831          this.supervisor = new Identifier();
2832          return this.supervisor;
2833        }
2834        else if (name.equals("supervisorReference")) {
2835          this.supervisor = new Reference();
2836          return this.supervisor;
2837        }
2838        else if (name.equals("providerQualification")) {
2839          this.providerQualification = new Coding();
2840          return this.providerQualification;
2841        }
2842        else if (name.equals("diagnosisLinkId")) {
2843          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisLinkId");
2844        }
2845        else if (name.equals("service")) {
2846          this.service = new Coding();
2847          return this.service;
2848        }
2849        else if (name.equals("serviceModifier")) {
2850          return addServiceModifier();
2851        }
2852        else if (name.equals("modifier")) {
2853          return addModifier();
2854        }
2855        else if (name.equals("programCode")) {
2856          return addProgramCode();
2857        }
2858        else if (name.equals("servicedDate")) {
2859          this.serviced = new DateType();
2860          return this.serviced;
2861        }
2862        else if (name.equals("servicedPeriod")) {
2863          this.serviced = new Period();
2864          return this.serviced;
2865        }
2866        else if (name.equals("place")) {
2867          this.place = new Coding();
2868          return this.place;
2869        }
2870        else if (name.equals("quantity")) {
2871          this.quantity = new SimpleQuantity();
2872          return this.quantity;
2873        }
2874        else if (name.equals("unitPrice")) {
2875          this.unitPrice = new Money();
2876          return this.unitPrice;
2877        }
2878        else if (name.equals("factor")) {
2879          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
2880        }
2881        else if (name.equals("points")) {
2882          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.points");
2883        }
2884        else if (name.equals("net")) {
2885          this.net = new Money();
2886          return this.net;
2887        }
2888        else if (name.equals("udi")) {
2889          return addUdi();
2890        }
2891        else if (name.equals("bodySite")) {
2892          this.bodySite = new Coding();
2893          return this.bodySite;
2894        }
2895        else if (name.equals("subSite")) {
2896          return addSubSite();
2897        }
2898        else if (name.equals("noteNumber")) {
2899          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
2900        }
2901        else if (name.equals("adjudication")) {
2902          return addAdjudication();
2903        }
2904        else if (name.equals("detail")) {
2905          return addDetail();
2906        }
2907        else if (name.equals("prosthesis")) {
2908          this.prosthesis = new ProsthesisComponent();
2909          return this.prosthesis;
2910        }
2911        else
2912          return super.addChild(name);
2913      }
2914
2915      public ItemsComponent copy() {
2916        ItemsComponent dst = new ItemsComponent();
2917        copyValues(dst);
2918        dst.sequence = sequence == null ? null : sequence.copy();
2919        dst.type = type == null ? null : type.copy();
2920        dst.provider = provider == null ? null : provider.copy();
2921        dst.supervisor = supervisor == null ? null : supervisor.copy();
2922        dst.providerQualification = providerQualification == null ? null : providerQualification.copy();
2923        if (diagnosisLinkId != null) {
2924          dst.diagnosisLinkId = new ArrayList<PositiveIntType>();
2925          for (PositiveIntType i : diagnosisLinkId)
2926            dst.diagnosisLinkId.add(i.copy());
2927        };
2928        dst.service = service == null ? null : service.copy();
2929        if (serviceModifier != null) {
2930          dst.serviceModifier = new ArrayList<Coding>();
2931          for (Coding i : serviceModifier)
2932            dst.serviceModifier.add(i.copy());
2933        };
2934        if (modifier != null) {
2935          dst.modifier = new ArrayList<Coding>();
2936          for (Coding i : modifier)
2937            dst.modifier.add(i.copy());
2938        };
2939        if (programCode != null) {
2940          dst.programCode = new ArrayList<Coding>();
2941          for (Coding i : programCode)
2942            dst.programCode.add(i.copy());
2943        };
2944        dst.serviced = serviced == null ? null : serviced.copy();
2945        dst.place = place == null ? null : place.copy();
2946        dst.quantity = quantity == null ? null : quantity.copy();
2947        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
2948        dst.factor = factor == null ? null : factor.copy();
2949        dst.points = points == null ? null : points.copy();
2950        dst.net = net == null ? null : net.copy();
2951        if (udi != null) {
2952          dst.udi = new ArrayList<Reference>();
2953          for (Reference i : udi)
2954            dst.udi.add(i.copy());
2955        };
2956        dst.bodySite = bodySite == null ? null : bodySite.copy();
2957        if (subSite != null) {
2958          dst.subSite = new ArrayList<Coding>();
2959          for (Coding i : subSite)
2960            dst.subSite.add(i.copy());
2961        };
2962        if (noteNumber != null) {
2963          dst.noteNumber = new ArrayList<PositiveIntType>();
2964          for (PositiveIntType i : noteNumber)
2965            dst.noteNumber.add(i.copy());
2966        };
2967        if (adjudication != null) {
2968          dst.adjudication = new ArrayList<ItemAdjudicationComponent>();
2969          for (ItemAdjudicationComponent i : adjudication)
2970            dst.adjudication.add(i.copy());
2971        };
2972        if (detail != null) {
2973          dst.detail = new ArrayList<DetailComponent>();
2974          for (DetailComponent i : detail)
2975            dst.detail.add(i.copy());
2976        };
2977        dst.prosthesis = prosthesis == null ? null : prosthesis.copy();
2978        return dst;
2979      }
2980
2981      @Override
2982      public boolean equalsDeep(Base other) {
2983        if (!super.equalsDeep(other))
2984          return false;
2985        if (!(other instanceof ItemsComponent))
2986          return false;
2987        ItemsComponent o = (ItemsComponent) other;
2988        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(provider, o.provider, true)
2989           && compareDeep(supervisor, o.supervisor, true) && compareDeep(providerQualification, o.providerQualification, true)
2990           && compareDeep(diagnosisLinkId, o.diagnosisLinkId, true) && compareDeep(service, o.service, true)
2991           && compareDeep(serviceModifier, o.serviceModifier, true) && compareDeep(modifier, o.modifier, true)
2992           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(place, o.place, true)
2993           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
2994           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
2995           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(noteNumber, o.noteNumber, true)
2996           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true) && compareDeep(prosthesis, o.prosthesis, true)
2997          ;
2998      }
2999
3000      @Override
3001      public boolean equalsShallow(Base other) {
3002        if (!super.equalsShallow(other))
3003          return false;
3004        if (!(other instanceof ItemsComponent))
3005          return false;
3006        ItemsComponent o = (ItemsComponent) other;
3007        return compareValues(sequence, o.sequence, true) && compareValues(diagnosisLinkId, o.diagnosisLinkId, true)
3008           && compareValues(factor, o.factor, true) && compareValues(points, o.points, true) && compareValues(noteNumber, o.noteNumber, true)
3009          ;
3010      }
3011
3012      public boolean isEmpty() {
3013        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (type == null || type.isEmpty())
3014           && (provider == null || provider.isEmpty()) && (supervisor == null || supervisor.isEmpty())
3015           && (providerQualification == null || providerQualification.isEmpty()) && (diagnosisLinkId == null || diagnosisLinkId.isEmpty())
3016           && (service == null || service.isEmpty()) && (serviceModifier == null || serviceModifier.isEmpty())
3017           && (modifier == null || modifier.isEmpty()) && (programCode == null || programCode.isEmpty())
3018           && (serviced == null || serviced.isEmpty()) && (place == null || place.isEmpty()) && (quantity == null || quantity.isEmpty())
3019           && (unitPrice == null || unitPrice.isEmpty()) && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty())
3020           && (net == null || net.isEmpty()) && (udi == null || udi.isEmpty()) && (bodySite == null || bodySite.isEmpty())
3021           && (subSite == null || subSite.isEmpty()) && (noteNumber == null || noteNumber.isEmpty())
3022           && (adjudication == null || adjudication.isEmpty()) && (detail == null || detail.isEmpty())
3023           && (prosthesis == null || prosthesis.isEmpty());
3024      }
3025
3026  public String fhirType() {
3027    return "ExplanationOfBenefit.item";
3028
3029  }
3030
3031  }
3032
3033    @Block()
3034    public static class ItemAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
3035        /**
3036         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
3037         */
3038        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
3039        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
3040        protected Coding category;
3041
3042        /**
3043         * Adjudication reason such as limit reached.
3044         */
3045        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
3046        @Description(shortDefinition="Adjudication reason", formalDefinition="Adjudication reason such as limit reached." )
3047        protected Coding reason;
3048
3049        /**
3050         * Monitory amount associated with the code.
3051         */
3052        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
3053        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
3054        protected Money amount;
3055
3056        /**
3057         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
3058         */
3059        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3060        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
3061        protected DecimalType value;
3062
3063        private static final long serialVersionUID = -1926987562L;
3064
3065    /**
3066     * Constructor
3067     */
3068      public ItemAdjudicationComponent() {
3069        super();
3070      }
3071
3072    /**
3073     * Constructor
3074     */
3075      public ItemAdjudicationComponent(Coding category) {
3076        super();
3077        this.category = category;
3078      }
3079
3080        /**
3081         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
3082         */
3083        public Coding getCategory() { 
3084          if (this.category == null)
3085            if (Configuration.errorOnAutoCreate())
3086              throw new Error("Attempt to auto-create ItemAdjudicationComponent.category");
3087            else if (Configuration.doAutoCreate())
3088              this.category = new Coding(); // cc
3089          return this.category;
3090        }
3091
3092        public boolean hasCategory() { 
3093          return this.category != null && !this.category.isEmpty();
3094        }
3095
3096        /**
3097         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
3098         */
3099        public ItemAdjudicationComponent setCategory(Coding value) { 
3100          this.category = value;
3101          return this;
3102        }
3103
3104        /**
3105         * @return {@link #reason} (Adjudication reason such as limit reached.)
3106         */
3107        public Coding getReason() { 
3108          if (this.reason == null)
3109            if (Configuration.errorOnAutoCreate())
3110              throw new Error("Attempt to auto-create ItemAdjudicationComponent.reason");
3111            else if (Configuration.doAutoCreate())
3112              this.reason = new Coding(); // cc
3113          return this.reason;
3114        }
3115
3116        public boolean hasReason() { 
3117          return this.reason != null && !this.reason.isEmpty();
3118        }
3119
3120        /**
3121         * @param value {@link #reason} (Adjudication reason such as limit reached.)
3122         */
3123        public ItemAdjudicationComponent setReason(Coding value) { 
3124          this.reason = value;
3125          return this;
3126        }
3127
3128        /**
3129         * @return {@link #amount} (Monitory amount associated with the code.)
3130         */
3131        public Money getAmount() { 
3132          if (this.amount == null)
3133            if (Configuration.errorOnAutoCreate())
3134              throw new Error("Attempt to auto-create ItemAdjudicationComponent.amount");
3135            else if (Configuration.doAutoCreate())
3136              this.amount = new Money(); // cc
3137          return this.amount;
3138        }
3139
3140        public boolean hasAmount() { 
3141          return this.amount != null && !this.amount.isEmpty();
3142        }
3143
3144        /**
3145         * @param value {@link #amount} (Monitory amount associated with the code.)
3146         */
3147        public ItemAdjudicationComponent setAmount(Money value) { 
3148          this.amount = value;
3149          return this;
3150        }
3151
3152        /**
3153         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
3154         */
3155        public DecimalType getValueElement() { 
3156          if (this.value == null)
3157            if (Configuration.errorOnAutoCreate())
3158              throw new Error("Attempt to auto-create ItemAdjudicationComponent.value");
3159            else if (Configuration.doAutoCreate())
3160              this.value = new DecimalType(); // bb
3161          return this.value;
3162        }
3163
3164        public boolean hasValueElement() { 
3165          return this.value != null && !this.value.isEmpty();
3166        }
3167
3168        public boolean hasValue() { 
3169          return this.value != null && !this.value.isEmpty();
3170        }
3171
3172        /**
3173         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
3174         */
3175        public ItemAdjudicationComponent setValueElement(DecimalType value) { 
3176          this.value = value;
3177          return this;
3178        }
3179
3180        /**
3181         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
3182         */
3183        public BigDecimal getValue() { 
3184          return this.value == null ? null : this.value.getValue();
3185        }
3186
3187        /**
3188         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
3189         */
3190        public ItemAdjudicationComponent setValue(BigDecimal value) { 
3191          if (value == null)
3192            this.value = null;
3193          else {
3194            if (this.value == null)
3195              this.value = new DecimalType();
3196            this.value.setValue(value);
3197          }
3198          return this;
3199        }
3200
3201        /**
3202         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
3203         */
3204        public ItemAdjudicationComponent setValue(long value) { 
3205              this.value = new DecimalType();
3206            this.value.setValue(value);
3207          return this;
3208        }
3209
3210        /**
3211         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
3212         */
3213        public ItemAdjudicationComponent setValue(double value) { 
3214              this.value = new DecimalType();
3215            this.value.setValue(value);
3216          return this;
3217        }
3218
3219        protected void listChildren(List<Property> childrenList) {
3220          super.listChildren(childrenList);
3221          childrenList.add(new Property("category", "Coding", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
3222          childrenList.add(new Property("reason", "Coding", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
3223          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
3224          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
3225        }
3226
3227      @Override
3228      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3229        switch (hash) {
3230        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
3231        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
3232        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
3233        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
3234        default: return super.getProperty(hash, name, checkValid);
3235        }
3236
3237      }
3238
3239      @Override
3240      public void setProperty(int hash, String name, Base value) throws FHIRException {
3241        switch (hash) {
3242        case 50511102: // category
3243          this.category = castToCoding(value); // Coding
3244          break;
3245        case -934964668: // reason
3246          this.reason = castToCoding(value); // Coding
3247          break;
3248        case -1413853096: // amount
3249          this.amount = castToMoney(value); // Money
3250          break;
3251        case 111972721: // value
3252          this.value = castToDecimal(value); // DecimalType
3253          break;
3254        default: super.setProperty(hash, name, value);
3255        }
3256
3257      }
3258
3259      @Override
3260      public void setProperty(String name, Base value) throws FHIRException {
3261        if (name.equals("category"))
3262          this.category = castToCoding(value); // Coding
3263        else if (name.equals("reason"))
3264          this.reason = castToCoding(value); // Coding
3265        else if (name.equals("amount"))
3266          this.amount = castToMoney(value); // Money
3267        else if (name.equals("value"))
3268          this.value = castToDecimal(value); // DecimalType
3269        else
3270          super.setProperty(name, value);
3271      }
3272
3273      @Override
3274      public Base makeProperty(int hash, String name) throws FHIRException {
3275        switch (hash) {
3276        case 50511102:  return getCategory(); // Coding
3277        case -934964668:  return getReason(); // Coding
3278        case -1413853096:  return getAmount(); // Money
3279        case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // DecimalType
3280        default: return super.makeProperty(hash, name);
3281        }
3282
3283      }
3284
3285      @Override
3286      public Base addChild(String name) throws FHIRException {
3287        if (name.equals("category")) {
3288          this.category = new Coding();
3289          return this.category;
3290        }
3291        else if (name.equals("reason")) {
3292          this.reason = new Coding();
3293          return this.reason;
3294        }
3295        else if (name.equals("amount")) {
3296          this.amount = new Money();
3297          return this.amount;
3298        }
3299        else if (name.equals("value")) {
3300          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
3301        }
3302        else
3303          return super.addChild(name);
3304      }
3305
3306      public ItemAdjudicationComponent copy() {
3307        ItemAdjudicationComponent dst = new ItemAdjudicationComponent();
3308        copyValues(dst);
3309        dst.category = category == null ? null : category.copy();
3310        dst.reason = reason == null ? null : reason.copy();
3311        dst.amount = amount == null ? null : amount.copy();
3312        dst.value = value == null ? null : value.copy();
3313        return dst;
3314      }
3315
3316      @Override
3317      public boolean equalsDeep(Base other) {
3318        if (!super.equalsDeep(other))
3319          return false;
3320        if (!(other instanceof ItemAdjudicationComponent))
3321          return false;
3322        ItemAdjudicationComponent o = (ItemAdjudicationComponent) other;
3323        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
3324           && compareDeep(value, o.value, true);
3325      }
3326
3327      @Override
3328      public boolean equalsShallow(Base other) {
3329        if (!super.equalsShallow(other))
3330          return false;
3331        if (!(other instanceof ItemAdjudicationComponent))
3332          return false;
3333        ItemAdjudicationComponent o = (ItemAdjudicationComponent) other;
3334        return compareValues(value, o.value, true);
3335      }
3336
3337      public boolean isEmpty() {
3338        return super.isEmpty() && (category == null || category.isEmpty()) && (reason == null || reason.isEmpty())
3339           && (amount == null || amount.isEmpty()) && (value == null || value.isEmpty());
3340      }
3341
3342  public String fhirType() {
3343    return "ExplanationOfBenefit.item.adjudication";
3344
3345  }
3346
3347  }
3348
3349    @Block()
3350    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
3351        /**
3352         * A service line number.
3353         */
3354        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
3355        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
3356        protected PositiveIntType sequence;
3357
3358        /**
3359         * The type of product or service.
3360         */
3361        @Child(name = "type", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
3362        @Description(shortDefinition="Group or type of product or service", formalDefinition="The type of product or service." )
3363        protected Coding type;
3364
3365        /**
3366         * If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.
3367         */
3368        @Child(name = "service", type = {Coding.class}, order=3, min=1, max=1, modifier=false, summary=true)
3369        @Description(shortDefinition="Additional item codes", formalDefinition="If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied." )
3370        protected Coding service;
3371
3372        /**
3373         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
3374         */
3375        @Child(name = "programCode", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3376        @Description(shortDefinition="Program specific reason for item inclusion", formalDefinition="For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program." )
3377        protected List<Coding> programCode;
3378
3379        /**
3380         * The number of repetitions of a service or product.
3381         */
3382        @Child(name = "quantity", type = {SimpleQuantity.class}, order=5, min=0, max=1, modifier=false, summary=true)
3383        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
3384        protected SimpleQuantity quantity;
3385
3386        /**
3387         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
3388         */
3389        @Child(name = "unitPrice", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=true)
3390        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
3391        protected Money unitPrice;
3392
3393        /**
3394         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3395         */
3396        @Child(name = "factor", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=true)
3397        @Description(shortDefinition="Price scaling factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
3398        protected DecimalType factor;
3399
3400        /**
3401         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
3402         */
3403        @Child(name = "points", type = {DecimalType.class}, order=8, min=0, max=1, modifier=false, summary=true)
3404        @Description(shortDefinition="Difficulty scaling factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point." )
3405        protected DecimalType points;
3406
3407        /**
3408         * The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
3409         */
3410        @Child(name = "net", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=true)
3411        @Description(shortDefinition="Total additional item cost", formalDefinition="The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
3412        protected Money net;
3413
3414        /**
3415         * List of Unique Device Identifiers associated with this line item.
3416         */
3417        @Child(name = "udi", type = {Device.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3418        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
3419        protected List<Reference> udi;
3420        /**
3421         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
3422         */
3423        protected List<Device> udiTarget;
3424
3425
3426        /**
3427         * The adjudications results.
3428         */
3429        @Child(name = "adjudication", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3430        @Description(shortDefinition="Detail adjudication", formalDefinition="The adjudications results." )
3431        protected List<DetailAdjudicationComponent> adjudication;
3432
3433        /**
3434         * Third tier of goods and services.
3435         */
3436        @Child(name = "subDetail", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3437        @Description(shortDefinition="Additional items", formalDefinition="Third tier of goods and services." )
3438        protected List<SubDetailComponent> subDetail;
3439
3440        private static final long serialVersionUID = -240637412L;
3441
3442    /**
3443     * Constructor
3444     */
3445      public DetailComponent() {
3446        super();
3447      }
3448
3449    /**
3450     * Constructor
3451     */
3452      public DetailComponent(PositiveIntType sequence, Coding type, Coding service) {
3453        super();
3454        this.sequence = sequence;
3455        this.type = type;
3456        this.service = service;
3457      }
3458
3459        /**
3460         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3461         */
3462        public PositiveIntType getSequenceElement() { 
3463          if (this.sequence == null)
3464            if (Configuration.errorOnAutoCreate())
3465              throw new Error("Attempt to auto-create DetailComponent.sequence");
3466            else if (Configuration.doAutoCreate())
3467              this.sequence = new PositiveIntType(); // bb
3468          return this.sequence;
3469        }
3470
3471        public boolean hasSequenceElement() { 
3472          return this.sequence != null && !this.sequence.isEmpty();
3473        }
3474
3475        public boolean hasSequence() { 
3476          return this.sequence != null && !this.sequence.isEmpty();
3477        }
3478
3479        /**
3480         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3481         */
3482        public DetailComponent setSequenceElement(PositiveIntType value) { 
3483          this.sequence = value;
3484          return this;
3485        }
3486
3487        /**
3488         * @return A service line number.
3489         */
3490        public int getSequence() { 
3491          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3492        }
3493
3494        /**
3495         * @param value A service line number.
3496         */
3497        public DetailComponent setSequence(int value) { 
3498            if (this.sequence == null)
3499              this.sequence = new PositiveIntType();
3500            this.sequence.setValue(value);
3501          return this;
3502        }
3503
3504        /**
3505         * @return {@link #type} (The type of product or service.)
3506         */
3507        public Coding getType() { 
3508          if (this.type == null)
3509            if (Configuration.errorOnAutoCreate())
3510              throw new Error("Attempt to auto-create DetailComponent.type");
3511            else if (Configuration.doAutoCreate())
3512              this.type = new Coding(); // cc
3513          return this.type;
3514        }
3515
3516        public boolean hasType() { 
3517          return this.type != null && !this.type.isEmpty();
3518        }
3519
3520        /**
3521         * @param value {@link #type} (The type of product or service.)
3522         */
3523        public DetailComponent setType(Coding value) { 
3524          this.type = value;
3525          return this;
3526        }
3527
3528        /**
3529         * @return {@link #service} (If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.)
3530         */
3531        public Coding getService() { 
3532          if (this.service == null)
3533            if (Configuration.errorOnAutoCreate())
3534              throw new Error("Attempt to auto-create DetailComponent.service");
3535            else if (Configuration.doAutoCreate())
3536              this.service = new Coding(); // cc
3537          return this.service;
3538        }
3539
3540        public boolean hasService() { 
3541          return this.service != null && !this.service.isEmpty();
3542        }
3543
3544        /**
3545         * @param value {@link #service} (If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.)
3546         */
3547        public DetailComponent setService(Coding value) { 
3548          this.service = value;
3549          return this;
3550        }
3551
3552        /**
3553         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
3554         */
3555        public List<Coding> getProgramCode() { 
3556          if (this.programCode == null)
3557            this.programCode = new ArrayList<Coding>();
3558          return this.programCode;
3559        }
3560
3561        public boolean hasProgramCode() { 
3562          if (this.programCode == null)
3563            return false;
3564          for (Coding item : this.programCode)
3565            if (!item.isEmpty())
3566              return true;
3567          return false;
3568        }
3569
3570        /**
3571         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
3572         */
3573    // syntactic sugar
3574        public Coding addProgramCode() { //3
3575          Coding t = new Coding();
3576          if (this.programCode == null)
3577            this.programCode = new ArrayList<Coding>();
3578          this.programCode.add(t);
3579          return t;
3580        }
3581
3582    // syntactic sugar
3583        public DetailComponent addProgramCode(Coding t) { //3
3584          if (t == null)
3585            return this;
3586          if (this.programCode == null)
3587            this.programCode = new ArrayList<Coding>();
3588          this.programCode.add(t);
3589          return this;
3590        }
3591
3592        /**
3593         * @return {@link #quantity} (The number of repetitions of a service or product.)
3594         */
3595        public SimpleQuantity getQuantity() { 
3596          if (this.quantity == null)
3597            if (Configuration.errorOnAutoCreate())
3598              throw new Error("Attempt to auto-create DetailComponent.quantity");
3599            else if (Configuration.doAutoCreate())
3600              this.quantity = new SimpleQuantity(); // cc
3601          return this.quantity;
3602        }
3603
3604        public boolean hasQuantity() { 
3605          return this.quantity != null && !this.quantity.isEmpty();
3606        }
3607
3608        /**
3609         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3610         */
3611        public DetailComponent setQuantity(SimpleQuantity value) { 
3612          this.quantity = value;
3613          return this;
3614        }
3615
3616        /**
3617         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
3618         */
3619        public Money getUnitPrice() { 
3620          if (this.unitPrice == null)
3621            if (Configuration.errorOnAutoCreate())
3622              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
3623            else if (Configuration.doAutoCreate())
3624              this.unitPrice = new Money(); // cc
3625          return this.unitPrice;
3626        }
3627
3628        public boolean hasUnitPrice() { 
3629          return this.unitPrice != null && !this.unitPrice.isEmpty();
3630        }
3631
3632        /**
3633         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
3634         */
3635        public DetailComponent setUnitPrice(Money value) { 
3636          this.unitPrice = value;
3637          return this;
3638        }
3639
3640        /**
3641         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
3642         */
3643        public DecimalType getFactorElement() { 
3644          if (this.factor == null)
3645            if (Configuration.errorOnAutoCreate())
3646              throw new Error("Attempt to auto-create DetailComponent.factor");
3647            else if (Configuration.doAutoCreate())
3648              this.factor = new DecimalType(); // bb
3649          return this.factor;
3650        }
3651
3652        public boolean hasFactorElement() { 
3653          return this.factor != null && !this.factor.isEmpty();
3654        }
3655
3656        public boolean hasFactor() { 
3657          return this.factor != null && !this.factor.isEmpty();
3658        }
3659
3660        /**
3661         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
3662         */
3663        public DetailComponent setFactorElement(DecimalType value) { 
3664          this.factor = value;
3665          return this;
3666        }
3667
3668        /**
3669         * @return A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3670         */
3671        public BigDecimal getFactor() { 
3672          return this.factor == null ? null : this.factor.getValue();
3673        }
3674
3675        /**
3676         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3677         */
3678        public DetailComponent setFactor(BigDecimal value) { 
3679          if (value == null)
3680            this.factor = null;
3681          else {
3682            if (this.factor == null)
3683              this.factor = new DecimalType();
3684            this.factor.setValue(value);
3685          }
3686          return this;
3687        }
3688
3689        /**
3690         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3691         */
3692        public DetailComponent setFactor(long value) { 
3693              this.factor = new DecimalType();
3694            this.factor.setValue(value);
3695          return this;
3696        }
3697
3698        /**
3699         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3700         */
3701        public DetailComponent setFactor(double value) { 
3702              this.factor = new DecimalType();
3703            this.factor.setValue(value);
3704          return this;
3705        }
3706
3707        /**
3708         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
3709         */
3710        public DecimalType getPointsElement() { 
3711          if (this.points == null)
3712            if (Configuration.errorOnAutoCreate())
3713              throw new Error("Attempt to auto-create DetailComponent.points");
3714            else if (Configuration.doAutoCreate())
3715              this.points = new DecimalType(); // bb
3716          return this.points;
3717        }
3718
3719        public boolean hasPointsElement() { 
3720          return this.points != null && !this.points.isEmpty();
3721        }
3722
3723        public boolean hasPoints() { 
3724          return this.points != null && !this.points.isEmpty();
3725        }
3726
3727        /**
3728         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
3729         */
3730        public DetailComponent setPointsElement(DecimalType value) { 
3731          this.points = value;
3732          return this;
3733        }
3734
3735        /**
3736         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
3737         */
3738        public BigDecimal getPoints() { 
3739          return this.points == null ? null : this.points.getValue();
3740        }
3741
3742        /**
3743         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
3744         */
3745        public DetailComponent setPoints(BigDecimal value) { 
3746          if (value == null)
3747            this.points = null;
3748          else {
3749            if (this.points == null)
3750              this.points = new DecimalType();
3751            this.points.setValue(value);
3752          }
3753          return this;
3754        }
3755
3756        /**
3757         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
3758         */
3759        public DetailComponent setPoints(long value) { 
3760              this.points = new DecimalType();
3761            this.points.setValue(value);
3762          return this;
3763        }
3764
3765        /**
3766         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
3767         */
3768        public DetailComponent setPoints(double value) { 
3769              this.points = new DecimalType();
3770            this.points.setValue(value);
3771          return this;
3772        }
3773
3774        /**
3775         * @return {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
3776         */
3777        public Money getNet() { 
3778          if (this.net == null)
3779            if (Configuration.errorOnAutoCreate())
3780              throw new Error("Attempt to auto-create DetailComponent.net");
3781            else if (Configuration.doAutoCreate())
3782              this.net = new Money(); // cc
3783          return this.net;
3784        }
3785
3786        public boolean hasNet() { 
3787          return this.net != null && !this.net.isEmpty();
3788        }
3789
3790        /**
3791         * @param value {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
3792         */
3793        public DetailComponent setNet(Money value) { 
3794          this.net = value;
3795          return this;
3796        }
3797
3798        /**
3799         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
3800         */
3801        public List<Reference> getUdi() { 
3802          if (this.udi == null)
3803            this.udi = new ArrayList<Reference>();
3804          return this.udi;
3805        }
3806
3807        public boolean hasUdi() { 
3808          if (this.udi == null)
3809            return false;
3810          for (Reference item : this.udi)
3811            if (!item.isEmpty())
3812              return true;
3813          return false;
3814        }
3815
3816        /**
3817         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
3818         */
3819    // syntactic sugar
3820        public Reference addUdi() { //3
3821          Reference t = new Reference();
3822          if (this.udi == null)
3823            this.udi = new ArrayList<Reference>();
3824          this.udi.add(t);
3825          return t;
3826        }
3827
3828    // syntactic sugar
3829        public DetailComponent addUdi(Reference t) { //3
3830          if (t == null)
3831            return this;
3832          if (this.udi == null)
3833            this.udi = new ArrayList<Reference>();
3834          this.udi.add(t);
3835          return this;
3836        }
3837
3838        /**
3839         * @return {@link #udi} (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. List of Unique Device Identifiers associated with this line item.)
3840         */
3841        public List<Device> getUdiTarget() { 
3842          if (this.udiTarget == null)
3843            this.udiTarget = new ArrayList<Device>();
3844          return this.udiTarget;
3845        }
3846
3847    // syntactic sugar
3848        /**
3849         * @return {@link #udi} (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. List of Unique Device Identifiers associated with this line item.)
3850         */
3851        public Device addUdiTarget() { 
3852          Device r = new Device();
3853          if (this.udiTarget == null)
3854            this.udiTarget = new ArrayList<Device>();
3855          this.udiTarget.add(r);
3856          return r;
3857        }
3858
3859        /**
3860         * @return {@link #adjudication} (The adjudications results.)
3861         */
3862        public List<DetailAdjudicationComponent> getAdjudication() { 
3863          if (this.adjudication == null)
3864            this.adjudication = new ArrayList<DetailAdjudicationComponent>();
3865          return this.adjudication;
3866        }
3867
3868        public boolean hasAdjudication() { 
3869          if (this.adjudication == null)
3870            return false;
3871          for (DetailAdjudicationComponent item : this.adjudication)
3872            if (!item.isEmpty())
3873              return true;
3874          return false;
3875        }
3876
3877        /**
3878         * @return {@link #adjudication} (The adjudications results.)
3879         */
3880    // syntactic sugar
3881        public DetailAdjudicationComponent addAdjudication() { //3
3882          DetailAdjudicationComponent t = new DetailAdjudicationComponent();
3883          if (this.adjudication == null)
3884            this.adjudication = new ArrayList<DetailAdjudicationComponent>();
3885          this.adjudication.add(t);
3886          return t;
3887        }
3888
3889    // syntactic sugar
3890        public DetailComponent addAdjudication(DetailAdjudicationComponent t) { //3
3891          if (t == null)
3892            return this;
3893          if (this.adjudication == null)
3894            this.adjudication = new ArrayList<DetailAdjudicationComponent>();
3895          this.adjudication.add(t);
3896          return this;
3897        }
3898
3899        /**
3900         * @return {@link #subDetail} (Third tier of goods and services.)
3901         */
3902        public List<SubDetailComponent> getSubDetail() { 
3903          if (this.subDetail == null)
3904            this.subDetail = new ArrayList<SubDetailComponent>();
3905          return this.subDetail;
3906        }
3907
3908        public boolean hasSubDetail() { 
3909          if (this.subDetail == null)
3910            return false;
3911          for (SubDetailComponent item : this.subDetail)
3912            if (!item.isEmpty())
3913              return true;
3914          return false;
3915        }
3916
3917        /**
3918         * @return {@link #subDetail} (Third tier of goods and services.)
3919         */
3920    // syntactic sugar
3921        public SubDetailComponent addSubDetail() { //3
3922          SubDetailComponent t = new SubDetailComponent();
3923          if (this.subDetail == null)
3924            this.subDetail = new ArrayList<SubDetailComponent>();
3925          this.subDetail.add(t);
3926          return t;
3927        }
3928
3929    // syntactic sugar
3930        public DetailComponent addSubDetail(SubDetailComponent t) { //3
3931          if (t == null)
3932            return this;
3933          if (this.subDetail == null)
3934            this.subDetail = new ArrayList<SubDetailComponent>();
3935          this.subDetail.add(t);
3936          return this;
3937        }
3938
3939        protected void listChildren(List<Property> childrenList) {
3940          super.listChildren(childrenList);
3941          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
3942          childrenList.add(new Property("type", "Coding", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
3943          childrenList.add(new Property("service", "Coding", "If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
3944          childrenList.add(new Property("programCode", "Coding", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
3945          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
3946          childrenList.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, java.lang.Integer.MAX_VALUE, unitPrice));
3947          childrenList.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, java.lang.Integer.MAX_VALUE, factor));
3948          childrenList.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.", 0, java.lang.Integer.MAX_VALUE, points));
3949          childrenList.add(new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, java.lang.Integer.MAX_VALUE, net));
3950          childrenList.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
3951          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
3952          childrenList.add(new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
3953        }
3954
3955      @Override
3956      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3957        switch (hash) {
3958        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
3959        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
3960        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // Coding
3961        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // Coding
3962        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
3963        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
3964        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
3965        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
3966        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
3967        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
3968        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // DetailAdjudicationComponent
3969        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
3970        default: return super.getProperty(hash, name, checkValid);
3971        }
3972
3973      }
3974
3975      @Override
3976      public void setProperty(int hash, String name, Base value) throws FHIRException {
3977        switch (hash) {
3978        case 1349547969: // sequence
3979          this.sequence = castToPositiveInt(value); // PositiveIntType
3980          break;
3981        case 3575610: // type
3982          this.type = castToCoding(value); // Coding
3983          break;
3984        case 1984153269: // service
3985          this.service = castToCoding(value); // Coding
3986          break;
3987        case 1010065041: // programCode
3988          this.getProgramCode().add(castToCoding(value)); // Coding
3989          break;
3990        case -1285004149: // quantity
3991          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
3992          break;
3993        case -486196699: // unitPrice
3994          this.unitPrice = castToMoney(value); // Money
3995          break;
3996        case -1282148017: // factor
3997          this.factor = castToDecimal(value); // DecimalType
3998          break;
3999        case -982754077: // points
4000          this.points = castToDecimal(value); // DecimalType
4001          break;
4002        case 108957: // net
4003          this.net = castToMoney(value); // Money
4004          break;
4005        case 115642: // udi
4006          this.getUdi().add(castToReference(value)); // Reference
4007          break;
4008        case -231349275: // adjudication
4009          this.getAdjudication().add((DetailAdjudicationComponent) value); // DetailAdjudicationComponent
4010          break;
4011        case -828829007: // subDetail
4012          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
4013          break;
4014        default: super.setProperty(hash, name, value);
4015        }
4016
4017      }
4018
4019      @Override
4020      public void setProperty(String name, Base value) throws FHIRException {
4021        if (name.equals("sequence"))
4022          this.sequence = castToPositiveInt(value); // PositiveIntType
4023        else if (name.equals("type"))
4024          this.type = castToCoding(value); // Coding
4025        else if (name.equals("service"))
4026          this.service = castToCoding(value); // Coding
4027        else if (name.equals("programCode"))
4028          this.getProgramCode().add(castToCoding(value));
4029        else if (name.equals("quantity"))
4030          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4031        else if (name.equals("unitPrice"))
4032          this.unitPrice = castToMoney(value); // Money
4033        else if (name.equals("factor"))
4034          this.factor = castToDecimal(value); // DecimalType
4035        else if (name.equals("points"))
4036          this.points = castToDecimal(value); // DecimalType
4037        else if (name.equals("net"))
4038          this.net = castToMoney(value); // Money
4039        else if (name.equals("udi"))
4040          this.getUdi().add(castToReference(value));
4041        else if (name.equals("adjudication"))
4042          this.getAdjudication().add((DetailAdjudicationComponent) value);
4043        else if (name.equals("subDetail"))
4044          this.getSubDetail().add((SubDetailComponent) value);
4045        else
4046          super.setProperty(name, value);
4047      }
4048
4049      @Override
4050      public Base makeProperty(int hash, String name) throws FHIRException {
4051        switch (hash) {
4052        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
4053        case 3575610:  return getType(); // Coding
4054        case 1984153269:  return getService(); // Coding
4055        case 1010065041:  return addProgramCode(); // Coding
4056        case -1285004149:  return getQuantity(); // SimpleQuantity
4057        case -486196699:  return getUnitPrice(); // Money
4058        case -1282148017: throw new FHIRException("Cannot make property factor as it is not a complex type"); // DecimalType
4059        case -982754077: throw new FHIRException("Cannot make property points as it is not a complex type"); // DecimalType
4060        case 108957:  return getNet(); // Money
4061        case 115642:  return addUdi(); // Reference
4062        case -231349275:  return addAdjudication(); // DetailAdjudicationComponent
4063        case -828829007:  return addSubDetail(); // SubDetailComponent
4064        default: return super.makeProperty(hash, name);
4065        }
4066
4067      }
4068
4069      @Override
4070      public Base addChild(String name) throws FHIRException {
4071        if (name.equals("sequence")) {
4072          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
4073        }
4074        else if (name.equals("type")) {
4075          this.type = new Coding();
4076          return this.type;
4077        }
4078        else if (name.equals("service")) {
4079          this.service = new Coding();
4080          return this.service;
4081        }
4082        else if (name.equals("programCode")) {
4083          return addProgramCode();
4084        }
4085        else if (name.equals("quantity")) {
4086          this.quantity = new SimpleQuantity();
4087          return this.quantity;
4088        }
4089        else if (name.equals("unitPrice")) {
4090          this.unitPrice = new Money();
4091          return this.unitPrice;
4092        }
4093        else if (name.equals("factor")) {
4094          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
4095        }
4096        else if (name.equals("points")) {
4097          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.points");
4098        }
4099        else if (name.equals("net")) {
4100          this.net = new Money();
4101          return this.net;
4102        }
4103        else if (name.equals("udi")) {
4104          return addUdi();
4105        }
4106        else if (name.equals("adjudication")) {
4107          return addAdjudication();
4108        }
4109        else if (name.equals("subDetail")) {
4110          return addSubDetail();
4111        }
4112        else
4113          return super.addChild(name);
4114      }
4115
4116      public DetailComponent copy() {
4117        DetailComponent dst = new DetailComponent();
4118        copyValues(dst);
4119        dst.sequence = sequence == null ? null : sequence.copy();
4120        dst.type = type == null ? null : type.copy();
4121        dst.service = service == null ? null : service.copy();
4122        if (programCode != null) {
4123          dst.programCode = new ArrayList<Coding>();
4124          for (Coding i : programCode)
4125            dst.programCode.add(i.copy());
4126        };
4127        dst.quantity = quantity == null ? null : quantity.copy();
4128        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4129        dst.factor = factor == null ? null : factor.copy();
4130        dst.points = points == null ? null : points.copy();
4131        dst.net = net == null ? null : net.copy();
4132        if (udi != null) {
4133          dst.udi = new ArrayList<Reference>();
4134          for (Reference i : udi)
4135            dst.udi.add(i.copy());
4136        };
4137        if (adjudication != null) {
4138          dst.adjudication = new ArrayList<DetailAdjudicationComponent>();
4139          for (DetailAdjudicationComponent i : adjudication)
4140            dst.adjudication.add(i.copy());
4141        };
4142        if (subDetail != null) {
4143          dst.subDetail = new ArrayList<SubDetailComponent>();
4144          for (SubDetailComponent i : subDetail)
4145            dst.subDetail.add(i.copy());
4146        };
4147        return dst;
4148      }
4149
4150      @Override
4151      public boolean equalsDeep(Base other) {
4152        if (!super.equalsDeep(other))
4153          return false;
4154        if (!(other instanceof DetailComponent))
4155          return false;
4156        DetailComponent o = (DetailComponent) other;
4157        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(service, o.service, true)
4158           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
4159           && compareDeep(factor, o.factor, true) && compareDeep(points, o.points, true) && compareDeep(net, o.net, true)
4160           && compareDeep(udi, o.udi, true) && compareDeep(adjudication, o.adjudication, true) && compareDeep(subDetail, o.subDetail, true)
4161          ;
4162      }
4163
4164      @Override
4165      public boolean equalsShallow(Base other) {
4166        if (!super.equalsShallow(other))
4167          return false;
4168        if (!(other instanceof DetailComponent))
4169          return false;
4170        DetailComponent o = (DetailComponent) other;
4171        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(points, o.points, true)
4172          ;
4173      }
4174
4175      public boolean isEmpty() {
4176        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (type == null || type.isEmpty())
4177           && (service == null || service.isEmpty()) && (programCode == null || programCode.isEmpty())
4178           && (quantity == null || quantity.isEmpty()) && (unitPrice == null || unitPrice.isEmpty())
4179           && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty()) && (net == null || net.isEmpty())
4180           && (udi == null || udi.isEmpty()) && (adjudication == null || adjudication.isEmpty()) && (subDetail == null || subDetail.isEmpty())
4181          ;
4182      }
4183
4184  public String fhirType() {
4185    return "ExplanationOfBenefit.item.detail";
4186
4187  }
4188
4189  }
4190
4191    @Block()
4192    public static class DetailAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
4193        /**
4194         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
4195         */
4196        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
4197        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
4198        protected Coding category;
4199
4200        /**
4201         * Adjudication reason such as limit reached.
4202         */
4203        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
4204        @Description(shortDefinition="Adjudication reason", formalDefinition="Adjudication reason such as limit reached." )
4205        protected Coding reason;
4206
4207        /**
4208         * Monitory amount associated with the code.
4209         */
4210        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
4211        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
4212        protected Money amount;
4213
4214        /**
4215         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4216         */
4217        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
4218        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
4219        protected DecimalType value;
4220
4221        private static final long serialVersionUID = -1926987562L;
4222
4223    /**
4224     * Constructor
4225     */
4226      public DetailAdjudicationComponent() {
4227        super();
4228      }
4229
4230    /**
4231     * Constructor
4232     */
4233      public DetailAdjudicationComponent(Coding category) {
4234        super();
4235        this.category = category;
4236      }
4237
4238        /**
4239         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4240         */
4241        public Coding getCategory() { 
4242          if (this.category == null)
4243            if (Configuration.errorOnAutoCreate())
4244              throw new Error("Attempt to auto-create DetailAdjudicationComponent.category");
4245            else if (Configuration.doAutoCreate())
4246              this.category = new Coding(); // cc
4247          return this.category;
4248        }
4249
4250        public boolean hasCategory() { 
4251          return this.category != null && !this.category.isEmpty();
4252        }
4253
4254        /**
4255         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4256         */
4257        public DetailAdjudicationComponent setCategory(Coding value) { 
4258          this.category = value;
4259          return this;
4260        }
4261
4262        /**
4263         * @return {@link #reason} (Adjudication reason such as limit reached.)
4264         */
4265        public Coding getReason() { 
4266          if (this.reason == null)
4267            if (Configuration.errorOnAutoCreate())
4268              throw new Error("Attempt to auto-create DetailAdjudicationComponent.reason");
4269            else if (Configuration.doAutoCreate())
4270              this.reason = new Coding(); // cc
4271          return this.reason;
4272        }
4273
4274        public boolean hasReason() { 
4275          return this.reason != null && !this.reason.isEmpty();
4276        }
4277
4278        /**
4279         * @param value {@link #reason} (Adjudication reason such as limit reached.)
4280         */
4281        public DetailAdjudicationComponent setReason(Coding value) { 
4282          this.reason = value;
4283          return this;
4284        }
4285
4286        /**
4287         * @return {@link #amount} (Monitory amount associated with the code.)
4288         */
4289        public Money getAmount() { 
4290          if (this.amount == null)
4291            if (Configuration.errorOnAutoCreate())
4292              throw new Error("Attempt to auto-create DetailAdjudicationComponent.amount");
4293            else if (Configuration.doAutoCreate())
4294              this.amount = new Money(); // cc
4295          return this.amount;
4296        }
4297
4298        public boolean hasAmount() { 
4299          return this.amount != null && !this.amount.isEmpty();
4300        }
4301
4302        /**
4303         * @param value {@link #amount} (Monitory amount associated with the code.)
4304         */
4305        public DetailAdjudicationComponent setAmount(Money value) { 
4306          this.amount = value;
4307          return this;
4308        }
4309
4310        /**
4311         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
4312         */
4313        public DecimalType getValueElement() { 
4314          if (this.value == null)
4315            if (Configuration.errorOnAutoCreate())
4316              throw new Error("Attempt to auto-create DetailAdjudicationComponent.value");
4317            else if (Configuration.doAutoCreate())
4318              this.value = new DecimalType(); // bb
4319          return this.value;
4320        }
4321
4322        public boolean hasValueElement() { 
4323          return this.value != null && !this.value.isEmpty();
4324        }
4325
4326        public boolean hasValue() { 
4327          return this.value != null && !this.value.isEmpty();
4328        }
4329
4330        /**
4331         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
4332         */
4333        public DetailAdjudicationComponent setValueElement(DecimalType value) { 
4334          this.value = value;
4335          return this;
4336        }
4337
4338        /**
4339         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4340         */
4341        public BigDecimal getValue() { 
4342          return this.value == null ? null : this.value.getValue();
4343        }
4344
4345        /**
4346         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4347         */
4348        public DetailAdjudicationComponent setValue(BigDecimal value) { 
4349          if (value == null)
4350            this.value = null;
4351          else {
4352            if (this.value == null)
4353              this.value = new DecimalType();
4354            this.value.setValue(value);
4355          }
4356          return this;
4357        }
4358
4359        /**
4360         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4361         */
4362        public DetailAdjudicationComponent setValue(long value) { 
4363              this.value = new DecimalType();
4364            this.value.setValue(value);
4365          return this;
4366        }
4367
4368        /**
4369         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4370         */
4371        public DetailAdjudicationComponent setValue(double value) { 
4372              this.value = new DecimalType();
4373            this.value.setValue(value);
4374          return this;
4375        }
4376
4377        protected void listChildren(List<Property> childrenList) {
4378          super.listChildren(childrenList);
4379          childrenList.add(new Property("category", "Coding", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
4380          childrenList.add(new Property("reason", "Coding", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
4381          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
4382          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
4383        }
4384
4385      @Override
4386      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4387        switch (hash) {
4388        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
4389        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
4390        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
4391        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
4392        default: return super.getProperty(hash, name, checkValid);
4393        }
4394
4395      }
4396
4397      @Override
4398      public void setProperty(int hash, String name, Base value) throws FHIRException {
4399        switch (hash) {
4400        case 50511102: // category
4401          this.category = castToCoding(value); // Coding
4402          break;
4403        case -934964668: // reason
4404          this.reason = castToCoding(value); // Coding
4405          break;
4406        case -1413853096: // amount
4407          this.amount = castToMoney(value); // Money
4408          break;
4409        case 111972721: // value
4410          this.value = castToDecimal(value); // DecimalType
4411          break;
4412        default: super.setProperty(hash, name, value);
4413        }
4414
4415      }
4416
4417      @Override
4418      public void setProperty(String name, Base value) throws FHIRException {
4419        if (name.equals("category"))
4420          this.category = castToCoding(value); // Coding
4421        else if (name.equals("reason"))
4422          this.reason = castToCoding(value); // Coding
4423        else if (name.equals("amount"))
4424          this.amount = castToMoney(value); // Money
4425        else if (name.equals("value"))
4426          this.value = castToDecimal(value); // DecimalType
4427        else
4428          super.setProperty(name, value);
4429      }
4430
4431      @Override
4432      public Base makeProperty(int hash, String name) throws FHIRException {
4433        switch (hash) {
4434        case 50511102:  return getCategory(); // Coding
4435        case -934964668:  return getReason(); // Coding
4436        case -1413853096:  return getAmount(); // Money
4437        case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // DecimalType
4438        default: return super.makeProperty(hash, name);
4439        }
4440
4441      }
4442
4443      @Override
4444      public Base addChild(String name) throws FHIRException {
4445        if (name.equals("category")) {
4446          this.category = new Coding();
4447          return this.category;
4448        }
4449        else if (name.equals("reason")) {
4450          this.reason = new Coding();
4451          return this.reason;
4452        }
4453        else if (name.equals("amount")) {
4454          this.amount = new Money();
4455          return this.amount;
4456        }
4457        else if (name.equals("value")) {
4458          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
4459        }
4460        else
4461          return super.addChild(name);
4462      }
4463
4464      public DetailAdjudicationComponent copy() {
4465        DetailAdjudicationComponent dst = new DetailAdjudicationComponent();
4466        copyValues(dst);
4467        dst.category = category == null ? null : category.copy();
4468        dst.reason = reason == null ? null : reason.copy();
4469        dst.amount = amount == null ? null : amount.copy();
4470        dst.value = value == null ? null : value.copy();
4471        return dst;
4472      }
4473
4474      @Override
4475      public boolean equalsDeep(Base other) {
4476        if (!super.equalsDeep(other))
4477          return false;
4478        if (!(other instanceof DetailAdjudicationComponent))
4479          return false;
4480        DetailAdjudicationComponent o = (DetailAdjudicationComponent) other;
4481        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
4482           && compareDeep(value, o.value, true);
4483      }
4484
4485      @Override
4486      public boolean equalsShallow(Base other) {
4487        if (!super.equalsShallow(other))
4488          return false;
4489        if (!(other instanceof DetailAdjudicationComponent))
4490          return false;
4491        DetailAdjudicationComponent o = (DetailAdjudicationComponent) other;
4492        return compareValues(value, o.value, true);
4493      }
4494
4495      public boolean isEmpty() {
4496        return super.isEmpty() && (category == null || category.isEmpty()) && (reason == null || reason.isEmpty())
4497           && (amount == null || amount.isEmpty()) && (value == null || value.isEmpty());
4498      }
4499
4500  public String fhirType() {
4501    return "ExplanationOfBenefit.item.detail.adjudication";
4502
4503  }
4504
4505  }
4506
4507    @Block()
4508    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
4509        /**
4510         * A service line number.
4511         */
4512        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4513        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
4514        protected PositiveIntType sequence;
4515
4516        /**
4517         * The type of product or service.
4518         */
4519        @Child(name = "type", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
4520        @Description(shortDefinition="Type of product or service", formalDefinition="The type of product or service." )
4521        protected Coding type;
4522
4523        /**
4524         * The fee for an addittional service or product or charge.
4525         */
4526        @Child(name = "service", type = {Coding.class}, order=3, min=1, max=1, modifier=false, summary=true)
4527        @Description(shortDefinition="Additional item codes", formalDefinition="The fee for an addittional service or product or charge." )
4528        protected Coding service;
4529
4530        /**
4531         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
4532         */
4533        @Child(name = "programCode", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4534        @Description(shortDefinition="Program specific reason for item inclusion", formalDefinition="For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program." )
4535        protected List<Coding> programCode;
4536
4537        /**
4538         * The number of repetitions of a service or product.
4539         */
4540        @Child(name = "quantity", type = {SimpleQuantity.class}, order=5, min=0, max=1, modifier=false, summary=true)
4541        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
4542        protected SimpleQuantity quantity;
4543
4544        /**
4545         * The fee for an addittional service or product or charge.
4546         */
4547        @Child(name = "unitPrice", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=true)
4548        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="The fee for an addittional service or product or charge." )
4549        protected Money unitPrice;
4550
4551        /**
4552         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
4553         */
4554        @Child(name = "factor", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=true)
4555        @Description(shortDefinition="Price scaling factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
4556        protected DecimalType factor;
4557
4558        /**
4559         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
4560         */
4561        @Child(name = "points", type = {DecimalType.class}, order=8, min=0, max=1, modifier=false, summary=true)
4562        @Description(shortDefinition="Difficulty scaling factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point." )
4563        protected DecimalType points;
4564
4565        /**
4566         * The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
4567         */
4568        @Child(name = "net", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=true)
4569        @Description(shortDefinition="Net additional item cost", formalDefinition="The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
4570        protected Money net;
4571
4572        /**
4573         * List of Unique Device Identifiers associated with this line item.
4574         */
4575        @Child(name = "udi", type = {Device.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4576        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
4577        protected List<Reference> udi;
4578        /**
4579         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
4580         */
4581        protected List<Device> udiTarget;
4582
4583
4584        /**
4585         * The adjudications results.
4586         */
4587        @Child(name = "adjudication", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4588        @Description(shortDefinition="SubDetail adjudication", formalDefinition="The adjudications results." )
4589        protected List<SubDetailAdjudicationComponent> adjudication;
4590
4591        private static final long serialVersionUID = -1690477905L;
4592
4593    /**
4594     * Constructor
4595     */
4596      public SubDetailComponent() {
4597        super();
4598      }
4599
4600    /**
4601     * Constructor
4602     */
4603      public SubDetailComponent(PositiveIntType sequence, Coding type, Coding service) {
4604        super();
4605        this.sequence = sequence;
4606        this.type = type;
4607        this.service = service;
4608      }
4609
4610        /**
4611         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
4612         */
4613        public PositiveIntType getSequenceElement() { 
4614          if (this.sequence == null)
4615            if (Configuration.errorOnAutoCreate())
4616              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
4617            else if (Configuration.doAutoCreate())
4618              this.sequence = new PositiveIntType(); // bb
4619          return this.sequence;
4620        }
4621
4622        public boolean hasSequenceElement() { 
4623          return this.sequence != null && !this.sequence.isEmpty();
4624        }
4625
4626        public boolean hasSequence() { 
4627          return this.sequence != null && !this.sequence.isEmpty();
4628        }
4629
4630        /**
4631         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
4632         */
4633        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
4634          this.sequence = value;
4635          return this;
4636        }
4637
4638        /**
4639         * @return A service line number.
4640         */
4641        public int getSequence() { 
4642          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
4643        }
4644
4645        /**
4646         * @param value A service line number.
4647         */
4648        public SubDetailComponent setSequence(int value) { 
4649            if (this.sequence == null)
4650              this.sequence = new PositiveIntType();
4651            this.sequence.setValue(value);
4652          return this;
4653        }
4654
4655        /**
4656         * @return {@link #type} (The type of product or service.)
4657         */
4658        public Coding getType() { 
4659          if (this.type == null)
4660            if (Configuration.errorOnAutoCreate())
4661              throw new Error("Attempt to auto-create SubDetailComponent.type");
4662            else if (Configuration.doAutoCreate())
4663              this.type = new Coding(); // cc
4664          return this.type;
4665        }
4666
4667        public boolean hasType() { 
4668          return this.type != null && !this.type.isEmpty();
4669        }
4670
4671        /**
4672         * @param value {@link #type} (The type of product or service.)
4673         */
4674        public SubDetailComponent setType(Coding value) { 
4675          this.type = value;
4676          return this;
4677        }
4678
4679        /**
4680         * @return {@link #service} (The fee for an addittional service or product or charge.)
4681         */
4682        public Coding getService() { 
4683          if (this.service == null)
4684            if (Configuration.errorOnAutoCreate())
4685              throw new Error("Attempt to auto-create SubDetailComponent.service");
4686            else if (Configuration.doAutoCreate())
4687              this.service = new Coding(); // cc
4688          return this.service;
4689        }
4690
4691        public boolean hasService() { 
4692          return this.service != null && !this.service.isEmpty();
4693        }
4694
4695        /**
4696         * @param value {@link #service} (The fee for an addittional service or product or charge.)
4697         */
4698        public SubDetailComponent setService(Coding value) { 
4699          this.service = value;
4700          return this;
4701        }
4702
4703        /**
4704         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
4705         */
4706        public List<Coding> getProgramCode() { 
4707          if (this.programCode == null)
4708            this.programCode = new ArrayList<Coding>();
4709          return this.programCode;
4710        }
4711
4712        public boolean hasProgramCode() { 
4713          if (this.programCode == null)
4714            return false;
4715          for (Coding item : this.programCode)
4716            if (!item.isEmpty())
4717              return true;
4718          return false;
4719        }
4720
4721        /**
4722         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
4723         */
4724    // syntactic sugar
4725        public Coding addProgramCode() { //3
4726          Coding t = new Coding();
4727          if (this.programCode == null)
4728            this.programCode = new ArrayList<Coding>();
4729          this.programCode.add(t);
4730          return t;
4731        }
4732
4733    // syntactic sugar
4734        public SubDetailComponent addProgramCode(Coding t) { //3
4735          if (t == null)
4736            return this;
4737          if (this.programCode == null)
4738            this.programCode = new ArrayList<Coding>();
4739          this.programCode.add(t);
4740          return this;
4741        }
4742
4743        /**
4744         * @return {@link #quantity} (The number of repetitions of a service or product.)
4745         */
4746        public SimpleQuantity getQuantity() { 
4747          if (this.quantity == null)
4748            if (Configuration.errorOnAutoCreate())
4749              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
4750            else if (Configuration.doAutoCreate())
4751              this.quantity = new SimpleQuantity(); // cc
4752          return this.quantity;
4753        }
4754
4755        public boolean hasQuantity() { 
4756          return this.quantity != null && !this.quantity.isEmpty();
4757        }
4758
4759        /**
4760         * @param value {@link #quantity} (The number of repetitions of a service or product.)
4761         */
4762        public SubDetailComponent setQuantity(SimpleQuantity value) { 
4763          this.quantity = value;
4764          return this;
4765        }
4766
4767        /**
4768         * @return {@link #unitPrice} (The fee for an addittional service or product or charge.)
4769         */
4770        public Money getUnitPrice() { 
4771          if (this.unitPrice == null)
4772            if (Configuration.errorOnAutoCreate())
4773              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
4774            else if (Configuration.doAutoCreate())
4775              this.unitPrice = new Money(); // cc
4776          return this.unitPrice;
4777        }
4778
4779        public boolean hasUnitPrice() { 
4780          return this.unitPrice != null && !this.unitPrice.isEmpty();
4781        }
4782
4783        /**
4784         * @param value {@link #unitPrice} (The fee for an addittional service or product or charge.)
4785         */
4786        public SubDetailComponent setUnitPrice(Money value) { 
4787          this.unitPrice = value;
4788          return this;
4789        }
4790
4791        /**
4792         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
4793         */
4794        public DecimalType getFactorElement() { 
4795          if (this.factor == null)
4796            if (Configuration.errorOnAutoCreate())
4797              throw new Error("Attempt to auto-create SubDetailComponent.factor");
4798            else if (Configuration.doAutoCreate())
4799              this.factor = new DecimalType(); // bb
4800          return this.factor;
4801        }
4802
4803        public boolean hasFactorElement() { 
4804          return this.factor != null && !this.factor.isEmpty();
4805        }
4806
4807        public boolean hasFactor() { 
4808          return this.factor != null && !this.factor.isEmpty();
4809        }
4810
4811        /**
4812         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
4813         */
4814        public SubDetailComponent setFactorElement(DecimalType value) { 
4815          this.factor = value;
4816          return this;
4817        }
4818
4819        /**
4820         * @return A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
4821         */
4822        public BigDecimal getFactor() { 
4823          return this.factor == null ? null : this.factor.getValue();
4824        }
4825
4826        /**
4827         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
4828         */
4829        public SubDetailComponent setFactor(BigDecimal value) { 
4830          if (value == null)
4831            this.factor = null;
4832          else {
4833            if (this.factor == null)
4834              this.factor = new DecimalType();
4835            this.factor.setValue(value);
4836          }
4837          return this;
4838        }
4839
4840        /**
4841         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
4842         */
4843        public SubDetailComponent setFactor(long value) { 
4844              this.factor = new DecimalType();
4845            this.factor.setValue(value);
4846          return this;
4847        }
4848
4849        /**
4850         * @param value A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
4851         */
4852        public SubDetailComponent setFactor(double value) { 
4853              this.factor = new DecimalType();
4854            this.factor.setValue(value);
4855          return this;
4856        }
4857
4858        /**
4859         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
4860         */
4861        public DecimalType getPointsElement() { 
4862          if (this.points == null)
4863            if (Configuration.errorOnAutoCreate())
4864              throw new Error("Attempt to auto-create SubDetailComponent.points");
4865            else if (Configuration.doAutoCreate())
4866              this.points = new DecimalType(); // bb
4867          return this.points;
4868        }
4869
4870        public boolean hasPointsElement() { 
4871          return this.points != null && !this.points.isEmpty();
4872        }
4873
4874        public boolean hasPoints() { 
4875          return this.points != null && !this.points.isEmpty();
4876        }
4877
4878        /**
4879         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
4880         */
4881        public SubDetailComponent setPointsElement(DecimalType value) { 
4882          this.points = value;
4883          return this;
4884        }
4885
4886        /**
4887         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
4888         */
4889        public BigDecimal getPoints() { 
4890          return this.points == null ? null : this.points.getValue();
4891        }
4892
4893        /**
4894         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
4895         */
4896        public SubDetailComponent setPoints(BigDecimal value) { 
4897          if (value == null)
4898            this.points = null;
4899          else {
4900            if (this.points == null)
4901              this.points = new DecimalType();
4902            this.points.setValue(value);
4903          }
4904          return this;
4905        }
4906
4907        /**
4908         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
4909         */
4910        public SubDetailComponent setPoints(long value) { 
4911              this.points = new DecimalType();
4912            this.points.setValue(value);
4913          return this;
4914        }
4915
4916        /**
4917         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.
4918         */
4919        public SubDetailComponent setPoints(double value) { 
4920              this.points = new DecimalType();
4921            this.points.setValue(value);
4922          return this;
4923        }
4924
4925        /**
4926         * @return {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
4927         */
4928        public Money getNet() { 
4929          if (this.net == null)
4930            if (Configuration.errorOnAutoCreate())
4931              throw new Error("Attempt to auto-create SubDetailComponent.net");
4932            else if (Configuration.doAutoCreate())
4933              this.net = new Money(); // cc
4934          return this.net;
4935        }
4936
4937        public boolean hasNet() { 
4938          return this.net != null && !this.net.isEmpty();
4939        }
4940
4941        /**
4942         * @param value {@link #net} (The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
4943         */
4944        public SubDetailComponent setNet(Money value) { 
4945          this.net = value;
4946          return this;
4947        }
4948
4949        /**
4950         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
4951         */
4952        public List<Reference> getUdi() { 
4953          if (this.udi == null)
4954            this.udi = new ArrayList<Reference>();
4955          return this.udi;
4956        }
4957
4958        public boolean hasUdi() { 
4959          if (this.udi == null)
4960            return false;
4961          for (Reference item : this.udi)
4962            if (!item.isEmpty())
4963              return true;
4964          return false;
4965        }
4966
4967        /**
4968         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
4969         */
4970    // syntactic sugar
4971        public Reference addUdi() { //3
4972          Reference t = new Reference();
4973          if (this.udi == null)
4974            this.udi = new ArrayList<Reference>();
4975          this.udi.add(t);
4976          return t;
4977        }
4978
4979    // syntactic sugar
4980        public SubDetailComponent addUdi(Reference t) { //3
4981          if (t == null)
4982            return this;
4983          if (this.udi == null)
4984            this.udi = new ArrayList<Reference>();
4985          this.udi.add(t);
4986          return this;
4987        }
4988
4989        /**
4990         * @return {@link #udi} (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. List of Unique Device Identifiers associated with this line item.)
4991         */
4992        public List<Device> getUdiTarget() { 
4993          if (this.udiTarget == null)
4994            this.udiTarget = new ArrayList<Device>();
4995          return this.udiTarget;
4996        }
4997
4998    // syntactic sugar
4999        /**
5000         * @return {@link #udi} (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. List of Unique Device Identifiers associated with this line item.)
5001         */
5002        public Device addUdiTarget() { 
5003          Device r = new Device();
5004          if (this.udiTarget == null)
5005            this.udiTarget = new ArrayList<Device>();
5006          this.udiTarget.add(r);
5007          return r;
5008        }
5009
5010        /**
5011         * @return {@link #adjudication} (The adjudications results.)
5012         */
5013        public List<SubDetailAdjudicationComponent> getAdjudication() { 
5014          if (this.adjudication == null)
5015            this.adjudication = new ArrayList<SubDetailAdjudicationComponent>();
5016          return this.adjudication;
5017        }
5018
5019        public boolean hasAdjudication() { 
5020          if (this.adjudication == null)
5021            return false;
5022          for (SubDetailAdjudicationComponent item : this.adjudication)
5023            if (!item.isEmpty())
5024              return true;
5025          return false;
5026        }
5027
5028        /**
5029         * @return {@link #adjudication} (The adjudications results.)
5030         */
5031    // syntactic sugar
5032        public SubDetailAdjudicationComponent addAdjudication() { //3
5033          SubDetailAdjudicationComponent t = new SubDetailAdjudicationComponent();
5034          if (this.adjudication == null)
5035            this.adjudication = new ArrayList<SubDetailAdjudicationComponent>();
5036          this.adjudication.add(t);
5037          return t;
5038        }
5039
5040    // syntactic sugar
5041        public SubDetailComponent addAdjudication(SubDetailAdjudicationComponent t) { //3
5042          if (t == null)
5043            return this;
5044          if (this.adjudication == null)
5045            this.adjudication = new ArrayList<SubDetailAdjudicationComponent>();
5046          this.adjudication.add(t);
5047          return this;
5048        }
5049
5050        protected void listChildren(List<Property> childrenList) {
5051          super.listChildren(childrenList);
5052          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
5053          childrenList.add(new Property("type", "Coding", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
5054          childrenList.add(new Property("service", "Coding", "The fee for an addittional service or product or charge.", 0, java.lang.Integer.MAX_VALUE, service));
5055          childrenList.add(new Property("programCode", "Coding", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
5056          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
5057          childrenList.add(new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, java.lang.Integer.MAX_VALUE, unitPrice));
5058          childrenList.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, java.lang.Integer.MAX_VALUE, factor));
5059          childrenList.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the good or service delivered. The concept of Points allows for assignment of point values for services and/or goods, such that a monetary amount can be assigned to each point.", 0, java.lang.Integer.MAX_VALUE, points));
5060          childrenList.add(new Property("net", "Money", "The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, java.lang.Integer.MAX_VALUE, net));
5061          childrenList.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
5062          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
5063        }
5064
5065      @Override
5066      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5067        switch (hash) {
5068        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
5069        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
5070        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // Coding
5071        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // Coding
5072        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
5073        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
5074        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
5075        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
5076        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
5077        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5078        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // SubDetailAdjudicationComponent
5079        default: return super.getProperty(hash, name, checkValid);
5080        }
5081
5082      }
5083
5084      @Override
5085      public void setProperty(int hash, String name, Base value) throws FHIRException {
5086        switch (hash) {
5087        case 1349547969: // sequence
5088          this.sequence = castToPositiveInt(value); // PositiveIntType
5089          break;
5090        case 3575610: // type
5091          this.type = castToCoding(value); // Coding
5092          break;
5093        case 1984153269: // service
5094          this.service = castToCoding(value); // Coding
5095          break;
5096        case 1010065041: // programCode
5097          this.getProgramCode().add(castToCoding(value)); // Coding
5098          break;
5099        case -1285004149: // quantity
5100          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
5101          break;
5102        case -486196699: // unitPrice
5103          this.unitPrice = castToMoney(value); // Money
5104          break;
5105        case -1282148017: // factor
5106          this.factor = castToDecimal(value); // DecimalType
5107          break;
5108        case -982754077: // points
5109          this.points = castToDecimal(value); // DecimalType
5110          break;
5111        case 108957: // net
5112          this.net = castToMoney(value); // Money
5113          break;
5114        case 115642: // udi
5115          this.getUdi().add(castToReference(value)); // Reference
5116          break;
5117        case -231349275: // adjudication
5118          this.getAdjudication().add((SubDetailAdjudicationComponent) value); // SubDetailAdjudicationComponent
5119          break;
5120        default: super.setProperty(hash, name, value);
5121        }
5122
5123      }
5124
5125      @Override
5126      public void setProperty(String name, Base value) throws FHIRException {
5127        if (name.equals("sequence"))
5128          this.sequence = castToPositiveInt(value); // PositiveIntType
5129        else if (name.equals("type"))
5130          this.type = castToCoding(value); // Coding
5131        else if (name.equals("service"))
5132          this.service = castToCoding(value); // Coding
5133        else if (name.equals("programCode"))
5134          this.getProgramCode().add(castToCoding(value));
5135        else if (name.equals("quantity"))
5136          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
5137        else if (name.equals("unitPrice"))
5138          this.unitPrice = castToMoney(value); // Money
5139        else if (name.equals("factor"))
5140          this.factor = castToDecimal(value); // DecimalType
5141        else if (name.equals("points"))
5142          this.points = castToDecimal(value); // DecimalType
5143        else if (name.equals("net"))
5144          this.net = castToMoney(value); // Money
5145        else if (name.equals("udi"))
5146          this.getUdi().add(castToReference(value));
5147        else if (name.equals("adjudication"))
5148          this.getAdjudication().add((SubDetailAdjudicationComponent) value);
5149        else
5150          super.setProperty(name, value);
5151      }
5152
5153      @Override
5154      public Base makeProperty(int hash, String name) throws FHIRException {
5155        switch (hash) {
5156        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
5157        case 3575610:  return getType(); // Coding
5158        case 1984153269:  return getService(); // Coding
5159        case 1010065041:  return addProgramCode(); // Coding
5160        case -1285004149:  return getQuantity(); // SimpleQuantity
5161        case -486196699:  return getUnitPrice(); // Money
5162        case -1282148017: throw new FHIRException("Cannot make property factor as it is not a complex type"); // DecimalType
5163        case -982754077: throw new FHIRException("Cannot make property points as it is not a complex type"); // DecimalType
5164        case 108957:  return getNet(); // Money
5165        case 115642:  return addUdi(); // Reference
5166        case -231349275:  return addAdjudication(); // SubDetailAdjudicationComponent
5167        default: return super.makeProperty(hash, name);
5168        }
5169
5170      }
5171
5172      @Override
5173      public Base addChild(String name) throws FHIRException {
5174        if (name.equals("sequence")) {
5175          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
5176        }
5177        else if (name.equals("type")) {
5178          this.type = new Coding();
5179          return this.type;
5180        }
5181        else if (name.equals("service")) {
5182          this.service = new Coding();
5183          return this.service;
5184        }
5185        else if (name.equals("programCode")) {
5186          return addProgramCode();
5187        }
5188        else if (name.equals("quantity")) {
5189          this.quantity = new SimpleQuantity();
5190          return this.quantity;
5191        }
5192        else if (name.equals("unitPrice")) {
5193          this.unitPrice = new Money();
5194          return this.unitPrice;
5195        }
5196        else if (name.equals("factor")) {
5197          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
5198        }
5199        else if (name.equals("points")) {
5200          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.points");
5201        }
5202        else if (name.equals("net")) {
5203          this.net = new Money();
5204          return this.net;
5205        }
5206        else if (name.equals("udi")) {
5207          return addUdi();
5208        }
5209        else if (name.equals("adjudication")) {
5210          return addAdjudication();
5211        }
5212        else
5213          return super.addChild(name);
5214      }
5215
5216      public SubDetailComponent copy() {
5217        SubDetailComponent dst = new SubDetailComponent();
5218        copyValues(dst);
5219        dst.sequence = sequence == null ? null : sequence.copy();
5220        dst.type = type == null ? null : type.copy();
5221        dst.service = service == null ? null : service.copy();
5222        if (programCode != null) {
5223          dst.programCode = new ArrayList<Coding>();
5224          for (Coding i : programCode)
5225            dst.programCode.add(i.copy());
5226        };
5227        dst.quantity = quantity == null ? null : quantity.copy();
5228        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
5229        dst.factor = factor == null ? null : factor.copy();
5230        dst.points = points == null ? null : points.copy();
5231        dst.net = net == null ? null : net.copy();
5232        if (udi != null) {
5233          dst.udi = new ArrayList<Reference>();
5234          for (Reference i : udi)
5235            dst.udi.add(i.copy());
5236        };
5237        if (adjudication != null) {
5238          dst.adjudication = new ArrayList<SubDetailAdjudicationComponent>();
5239          for (SubDetailAdjudicationComponent i : adjudication)
5240            dst.adjudication.add(i.copy());
5241        };
5242        return dst;
5243      }
5244
5245      @Override
5246      public boolean equalsDeep(Base other) {
5247        if (!super.equalsDeep(other))
5248          return false;
5249        if (!(other instanceof SubDetailComponent))
5250          return false;
5251        SubDetailComponent o = (SubDetailComponent) other;
5252        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(service, o.service, true)
5253           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
5254           && compareDeep(factor, o.factor, true) && compareDeep(points, o.points, true) && compareDeep(net, o.net, true)
5255           && compareDeep(udi, o.udi, true) && compareDeep(adjudication, o.adjudication, true);
5256      }
5257
5258      @Override
5259      public boolean equalsShallow(Base other) {
5260        if (!super.equalsShallow(other))
5261          return false;
5262        if (!(other instanceof SubDetailComponent))
5263          return false;
5264        SubDetailComponent o = (SubDetailComponent) other;
5265        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(points, o.points, true)
5266          ;
5267      }
5268
5269      public boolean isEmpty() {
5270        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (type == null || type.isEmpty())
5271           && (service == null || service.isEmpty()) && (programCode == null || programCode.isEmpty())
5272           && (quantity == null || quantity.isEmpty()) && (unitPrice == null || unitPrice.isEmpty())
5273           && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty()) && (net == null || net.isEmpty())
5274           && (udi == null || udi.isEmpty()) && (adjudication == null || adjudication.isEmpty());
5275      }
5276
5277  public String fhirType() {
5278    return "ExplanationOfBenefit.item.detail.subDetail";
5279
5280  }
5281
5282  }
5283
5284    @Block()
5285    public static class SubDetailAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5286        /**
5287         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
5288         */
5289        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
5290        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
5291        protected Coding category;
5292
5293        /**
5294         * Adjudication reason such as limit reached.
5295         */
5296        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
5297        @Description(shortDefinition="Adjudication reason", formalDefinition="Adjudication reason such as limit reached." )
5298        protected Coding reason;
5299
5300        /**
5301         * Monitory amount associated with the code.
5302         */
5303        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
5304        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
5305        protected Money amount;
5306
5307        /**
5308         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5309         */
5310        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
5311        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
5312        protected DecimalType value;
5313
5314        private static final long serialVersionUID = -1926987562L;
5315
5316    /**
5317     * Constructor
5318     */
5319      public SubDetailAdjudicationComponent() {
5320        super();
5321      }
5322
5323    /**
5324     * Constructor
5325     */
5326      public SubDetailAdjudicationComponent(Coding category) {
5327        super();
5328        this.category = category;
5329      }
5330
5331        /**
5332         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
5333         */
5334        public Coding getCategory() { 
5335          if (this.category == null)
5336            if (Configuration.errorOnAutoCreate())
5337              throw new Error("Attempt to auto-create SubDetailAdjudicationComponent.category");
5338            else if (Configuration.doAutoCreate())
5339              this.category = new Coding(); // cc
5340          return this.category;
5341        }
5342
5343        public boolean hasCategory() { 
5344          return this.category != null && !this.category.isEmpty();
5345        }
5346
5347        /**
5348         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
5349         */
5350        public SubDetailAdjudicationComponent setCategory(Coding value) { 
5351          this.category = value;
5352          return this;
5353        }
5354
5355        /**
5356         * @return {@link #reason} (Adjudication reason such as limit reached.)
5357         */
5358        public Coding getReason() { 
5359          if (this.reason == null)
5360            if (Configuration.errorOnAutoCreate())
5361              throw new Error("Attempt to auto-create SubDetailAdjudicationComponent.reason");
5362            else if (Configuration.doAutoCreate())
5363              this.reason = new Coding(); // cc
5364          return this.reason;
5365        }
5366
5367        public boolean hasReason() { 
5368          return this.reason != null && !this.reason.isEmpty();
5369        }
5370
5371        /**
5372         * @param value {@link #reason} (Adjudication reason such as limit reached.)
5373         */
5374        public SubDetailAdjudicationComponent setReason(Coding value) { 
5375          this.reason = value;
5376          return this;
5377        }
5378
5379        /**
5380         * @return {@link #amount} (Monitory amount associated with the code.)
5381         */
5382        public Money getAmount() { 
5383          if (this.amount == null)
5384            if (Configuration.errorOnAutoCreate())
5385              throw new Error("Attempt to auto-create SubDetailAdjudicationComponent.amount");
5386            else if (Configuration.doAutoCreate())
5387              this.amount = new Money(); // cc
5388          return this.amount;
5389        }
5390
5391        public boolean hasAmount() { 
5392          return this.amount != null && !this.amount.isEmpty();
5393        }
5394
5395        /**
5396         * @param value {@link #amount} (Monitory amount associated with the code.)
5397         */
5398        public SubDetailAdjudicationComponent setAmount(Money value) { 
5399          this.amount = value;
5400          return this;
5401        }
5402
5403        /**
5404         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
5405         */
5406        public DecimalType getValueElement() { 
5407          if (this.value == null)
5408            if (Configuration.errorOnAutoCreate())
5409              throw new Error("Attempt to auto-create SubDetailAdjudicationComponent.value");
5410            else if (Configuration.doAutoCreate())
5411              this.value = new DecimalType(); // bb
5412          return this.value;
5413        }
5414
5415        public boolean hasValueElement() { 
5416          return this.value != null && !this.value.isEmpty();
5417        }
5418
5419        public boolean hasValue() { 
5420          return this.value != null && !this.value.isEmpty();
5421        }
5422
5423        /**
5424         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
5425         */
5426        public SubDetailAdjudicationComponent setValueElement(DecimalType value) { 
5427          this.value = value;
5428          return this;
5429        }
5430
5431        /**
5432         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5433         */
5434        public BigDecimal getValue() { 
5435          return this.value == null ? null : this.value.getValue();
5436        }
5437
5438        /**
5439         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5440         */
5441        public SubDetailAdjudicationComponent setValue(BigDecimal value) { 
5442          if (value == null)
5443            this.value = null;
5444          else {
5445            if (this.value == null)
5446              this.value = new DecimalType();
5447            this.value.setValue(value);
5448          }
5449          return this;
5450        }
5451
5452        /**
5453         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5454         */
5455        public SubDetailAdjudicationComponent setValue(long value) { 
5456              this.value = new DecimalType();
5457            this.value.setValue(value);
5458          return this;
5459        }
5460
5461        /**
5462         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5463         */
5464        public SubDetailAdjudicationComponent setValue(double value) { 
5465              this.value = new DecimalType();
5466            this.value.setValue(value);
5467          return this;
5468        }
5469
5470        protected void listChildren(List<Property> childrenList) {
5471          super.listChildren(childrenList);
5472          childrenList.add(new Property("category", "Coding", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
5473          childrenList.add(new Property("reason", "Coding", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
5474          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
5475          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
5476        }
5477
5478      @Override
5479      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5480        switch (hash) {
5481        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
5482        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
5483        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5484        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5485        default: return super.getProperty(hash, name, checkValid);
5486        }
5487
5488      }
5489
5490      @Override
5491      public void setProperty(int hash, String name, Base value) throws FHIRException {
5492        switch (hash) {
5493        case 50511102: // category
5494          this.category = castToCoding(value); // Coding
5495          break;
5496        case -934964668: // reason
5497          this.reason = castToCoding(value); // Coding
5498          break;
5499        case -1413853096: // amount
5500          this.amount = castToMoney(value); // Money
5501          break;
5502        case 111972721: // value
5503          this.value = castToDecimal(value); // DecimalType
5504          break;
5505        default: super.setProperty(hash, name, value);
5506        }
5507
5508      }
5509
5510      @Override
5511      public void setProperty(String name, Base value) throws FHIRException {
5512        if (name.equals("category"))
5513          this.category = castToCoding(value); // Coding
5514        else if (name.equals("reason"))
5515          this.reason = castToCoding(value); // Coding
5516        else if (name.equals("amount"))
5517          this.amount = castToMoney(value); // Money
5518        else if (name.equals("value"))
5519          this.value = castToDecimal(value); // DecimalType
5520        else
5521          super.setProperty(name, value);
5522      }
5523
5524      @Override
5525      public Base makeProperty(int hash, String name) throws FHIRException {
5526        switch (hash) {
5527        case 50511102:  return getCategory(); // Coding
5528        case -934964668:  return getReason(); // Coding
5529        case -1413853096:  return getAmount(); // Money
5530        case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // DecimalType
5531        default: return super.makeProperty(hash, name);
5532        }
5533
5534      }
5535
5536      @Override
5537      public Base addChild(String name) throws FHIRException {
5538        if (name.equals("category")) {
5539          this.category = new Coding();
5540          return this.category;
5541        }
5542        else if (name.equals("reason")) {
5543          this.reason = new Coding();
5544          return this.reason;
5545        }
5546        else if (name.equals("amount")) {
5547          this.amount = new Money();
5548          return this.amount;
5549        }
5550        else if (name.equals("value")) {
5551          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5552        }
5553        else
5554          return super.addChild(name);
5555      }
5556
5557      public SubDetailAdjudicationComponent copy() {
5558        SubDetailAdjudicationComponent dst = new SubDetailAdjudicationComponent();
5559        copyValues(dst);
5560        dst.category = category == null ? null : category.copy();
5561        dst.reason = reason == null ? null : reason.copy();
5562        dst.amount = amount == null ? null : amount.copy();
5563        dst.value = value == null ? null : value.copy();
5564        return dst;
5565      }
5566
5567      @Override
5568      public boolean equalsDeep(Base other) {
5569        if (!super.equalsDeep(other))
5570          return false;
5571        if (!(other instanceof SubDetailAdjudicationComponent))
5572          return false;
5573        SubDetailAdjudicationComponent o = (SubDetailAdjudicationComponent) other;
5574        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5575           && compareDeep(value, o.value, true);
5576      }
5577
5578      @Override
5579      public boolean equalsShallow(Base other) {
5580        if (!super.equalsShallow(other))
5581          return false;
5582        if (!(other instanceof SubDetailAdjudicationComponent))
5583          return false;
5584        SubDetailAdjudicationComponent o = (SubDetailAdjudicationComponent) other;
5585        return compareValues(value, o.value, true);
5586      }
5587
5588      public boolean isEmpty() {
5589        return super.isEmpty() && (category == null || category.isEmpty()) && (reason == null || reason.isEmpty())
5590           && (amount == null || amount.isEmpty()) && (value == null || value.isEmpty());
5591      }
5592
5593  public String fhirType() {
5594    return "ExplanationOfBenefit.item.detail.subDetail.adjudication";
5595
5596  }
5597
5598  }
5599
5600    @Block()
5601    public static class ProsthesisComponent extends BackboneElement implements IBaseBackboneElement {
5602        /**
5603         * Indicates whether this is the initial placement of a fixed prosthesis.
5604         */
5605        @Child(name = "initial", type = {BooleanType.class}, order=1, min=0, max=1, modifier=false, summary=true)
5606        @Description(shortDefinition="Is this the initial service", formalDefinition="Indicates whether this is the initial placement of a fixed prosthesis." )
5607        protected BooleanType initial;
5608
5609        /**
5610         * Date of the initial placement.
5611         */
5612        @Child(name = "priorDate", type = {DateType.class}, order=2, min=0, max=1, modifier=false, summary=true)
5613        @Description(shortDefinition="Initial service Date", formalDefinition="Date of the initial placement." )
5614        protected DateType priorDate;
5615
5616        /**
5617         * Material of the prior denture or bridge prosthesis. (Oral).
5618         */
5619        @Child(name = "priorMaterial", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
5620        @Description(shortDefinition="Prosthetic Material", formalDefinition="Material of the prior denture or bridge prosthesis. (Oral)." )
5621        protected Coding priorMaterial;
5622
5623        private static final long serialVersionUID = 1739349641L;
5624
5625    /**
5626     * Constructor
5627     */
5628      public ProsthesisComponent() {
5629        super();
5630      }
5631
5632        /**
5633         * @return {@link #initial} (Indicates whether this is the initial placement of a fixed prosthesis.). This is the underlying object with id, value and extensions. The accessor "getInitial" gives direct access to the value
5634         */
5635        public BooleanType getInitialElement() { 
5636          if (this.initial == null)
5637            if (Configuration.errorOnAutoCreate())
5638              throw new Error("Attempt to auto-create ProsthesisComponent.initial");
5639            else if (Configuration.doAutoCreate())
5640              this.initial = new BooleanType(); // bb
5641          return this.initial;
5642        }
5643
5644        public boolean hasInitialElement() { 
5645          return this.initial != null && !this.initial.isEmpty();
5646        }
5647
5648        public boolean hasInitial() { 
5649          return this.initial != null && !this.initial.isEmpty();
5650        }
5651
5652        /**
5653         * @param value {@link #initial} (Indicates whether this is the initial placement of a fixed prosthesis.). This is the underlying object with id, value and extensions. The accessor "getInitial" gives direct access to the value
5654         */
5655        public ProsthesisComponent setInitialElement(BooleanType value) { 
5656          this.initial = value;
5657          return this;
5658        }
5659
5660        /**
5661         * @return Indicates whether this is the initial placement of a fixed prosthesis.
5662         */
5663        public boolean getInitial() { 
5664          return this.initial == null || this.initial.isEmpty() ? false : this.initial.getValue();
5665        }
5666
5667        /**
5668         * @param value Indicates whether this is the initial placement of a fixed prosthesis.
5669         */
5670        public ProsthesisComponent setInitial(boolean value) { 
5671            if (this.initial == null)
5672              this.initial = new BooleanType();
5673            this.initial.setValue(value);
5674          return this;
5675        }
5676
5677        /**
5678         * @return {@link #priorDate} (Date of the initial placement.). This is the underlying object with id, value and extensions. The accessor "getPriorDate" gives direct access to the value
5679         */
5680        public DateType getPriorDateElement() { 
5681          if (this.priorDate == null)
5682            if (Configuration.errorOnAutoCreate())
5683              throw new Error("Attempt to auto-create ProsthesisComponent.priorDate");
5684            else if (Configuration.doAutoCreate())
5685              this.priorDate = new DateType(); // bb
5686          return this.priorDate;
5687        }
5688
5689        public boolean hasPriorDateElement() { 
5690          return this.priorDate != null && !this.priorDate.isEmpty();
5691        }
5692
5693        public boolean hasPriorDate() { 
5694          return this.priorDate != null && !this.priorDate.isEmpty();
5695        }
5696
5697        /**
5698         * @param value {@link #priorDate} (Date of the initial placement.). This is the underlying object with id, value and extensions. The accessor "getPriorDate" gives direct access to the value
5699         */
5700        public ProsthesisComponent setPriorDateElement(DateType value) { 
5701          this.priorDate = value;
5702          return this;
5703        }
5704
5705        /**
5706         * @return Date of the initial placement.
5707         */
5708        public Date getPriorDate() { 
5709          return this.priorDate == null ? null : this.priorDate.getValue();
5710        }
5711
5712        /**
5713         * @param value Date of the initial placement.
5714         */
5715        public ProsthesisComponent setPriorDate(Date value) { 
5716          if (value == null)
5717            this.priorDate = null;
5718          else {
5719            if (this.priorDate == null)
5720              this.priorDate = new DateType();
5721            this.priorDate.setValue(value);
5722          }
5723          return this;
5724        }
5725
5726        /**
5727         * @return {@link #priorMaterial} (Material of the prior denture or bridge prosthesis. (Oral).)
5728         */
5729        public Coding getPriorMaterial() { 
5730          if (this.priorMaterial == null)
5731            if (Configuration.errorOnAutoCreate())
5732              throw new Error("Attempt to auto-create ProsthesisComponent.priorMaterial");
5733            else if (Configuration.doAutoCreate())
5734              this.priorMaterial = new Coding(); // cc
5735          return this.priorMaterial;
5736        }
5737
5738        public boolean hasPriorMaterial() { 
5739          return this.priorMaterial != null && !this.priorMaterial.isEmpty();
5740        }
5741
5742        /**
5743         * @param value {@link #priorMaterial} (Material of the prior denture or bridge prosthesis. (Oral).)
5744         */
5745        public ProsthesisComponent setPriorMaterial(Coding value) { 
5746          this.priorMaterial = value;
5747          return this;
5748        }
5749
5750        protected void listChildren(List<Property> childrenList) {
5751          super.listChildren(childrenList);
5752          childrenList.add(new Property("initial", "boolean", "Indicates whether this is the initial placement of a fixed prosthesis.", 0, java.lang.Integer.MAX_VALUE, initial));
5753          childrenList.add(new Property("priorDate", "date", "Date of the initial placement.", 0, java.lang.Integer.MAX_VALUE, priorDate));
5754          childrenList.add(new Property("priorMaterial", "Coding", "Material of the prior denture or bridge prosthesis. (Oral).", 0, java.lang.Integer.MAX_VALUE, priorMaterial));
5755        }
5756
5757      @Override
5758      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5759        switch (hash) {
5760        case 1948342084: /*initial*/ return this.initial == null ? new Base[0] : new Base[] {this.initial}; // BooleanType
5761        case -1770675816: /*priorDate*/ return this.priorDate == null ? new Base[0] : new Base[] {this.priorDate}; // DateType
5762        case -532999663: /*priorMaterial*/ return this.priorMaterial == null ? new Base[0] : new Base[] {this.priorMaterial}; // Coding
5763        default: return super.getProperty(hash, name, checkValid);
5764        }
5765
5766      }
5767
5768      @Override
5769      public void setProperty(int hash, String name, Base value) throws FHIRException {
5770        switch (hash) {
5771        case 1948342084: // initial
5772          this.initial = castToBoolean(value); // BooleanType
5773          break;
5774        case -1770675816: // priorDate
5775          this.priorDate = castToDate(value); // DateType
5776          break;
5777        case -532999663: // priorMaterial
5778          this.priorMaterial = castToCoding(value); // Coding
5779          break;
5780        default: super.setProperty(hash, name, value);
5781        }
5782
5783      }
5784
5785      @Override
5786      public void setProperty(String name, Base value) throws FHIRException {
5787        if (name.equals("initial"))
5788          this.initial = castToBoolean(value); // BooleanType
5789        else if (name.equals("priorDate"))
5790          this.priorDate = castToDate(value); // DateType
5791        else if (name.equals("priorMaterial"))
5792          this.priorMaterial = castToCoding(value); // Coding
5793        else
5794          super.setProperty(name, value);
5795      }
5796
5797      @Override
5798      public Base makeProperty(int hash, String name) throws FHIRException {
5799        switch (hash) {
5800        case 1948342084: throw new FHIRException("Cannot make property initial as it is not a complex type"); // BooleanType
5801        case -1770675816: throw new FHIRException("Cannot make property priorDate as it is not a complex type"); // DateType
5802        case -532999663:  return getPriorMaterial(); // Coding
5803        default: return super.makeProperty(hash, name);
5804        }
5805
5806      }
5807
5808      @Override
5809      public Base addChild(String name) throws FHIRException {
5810        if (name.equals("initial")) {
5811          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.initial");
5812        }
5813        else if (name.equals("priorDate")) {
5814          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.priorDate");
5815        }
5816        else if (name.equals("priorMaterial")) {
5817          this.priorMaterial = new Coding();
5818          return this.priorMaterial;
5819        }
5820        else
5821          return super.addChild(name);
5822      }
5823
5824      public ProsthesisComponent copy() {
5825        ProsthesisComponent dst = new ProsthesisComponent();
5826        copyValues(dst);
5827        dst.initial = initial == null ? null : initial.copy();
5828        dst.priorDate = priorDate == null ? null : priorDate.copy();
5829        dst.priorMaterial = priorMaterial == null ? null : priorMaterial.copy();
5830        return dst;
5831      }
5832
5833      @Override
5834      public boolean equalsDeep(Base other) {
5835        if (!super.equalsDeep(other))
5836          return false;
5837        if (!(other instanceof ProsthesisComponent))
5838          return false;
5839        ProsthesisComponent o = (ProsthesisComponent) other;
5840        return compareDeep(initial, o.initial, true) && compareDeep(priorDate, o.priorDate, true) && compareDeep(priorMaterial, o.priorMaterial, true)
5841          ;
5842      }
5843
5844      @Override
5845      public boolean equalsShallow(Base other) {
5846        if (!super.equalsShallow(other))
5847          return false;
5848        if (!(other instanceof ProsthesisComponent))
5849          return false;
5850        ProsthesisComponent o = (ProsthesisComponent) other;
5851        return compareValues(initial, o.initial, true) && compareValues(priorDate, o.priorDate, true);
5852      }
5853
5854      public boolean isEmpty() {
5855        return super.isEmpty() && (initial == null || initial.isEmpty()) && (priorDate == null || priorDate.isEmpty())
5856           && (priorMaterial == null || priorMaterial.isEmpty());
5857      }
5858
5859  public String fhirType() {
5860    return "ExplanationOfBenefit.item.prosthesis";
5861
5862  }
5863
5864  }
5865
5866    @Block()
5867    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
5868        /**
5869         * List of input service items which this service line is intended to replace.
5870         */
5871        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5872        @Description(shortDefinition="Service instances", formalDefinition="List of input service items which this service line is intended to replace." )
5873        protected List<PositiveIntType> sequenceLinkId;
5874
5875        /**
5876         * A code to indicate the Professional Service or Product supplied.
5877         */
5878        @Child(name = "service", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
5879        @Description(shortDefinition="Group, Service or Product", formalDefinition="A code to indicate the Professional Service or Product supplied." )
5880        protected Coding service;
5881
5882        /**
5883         * The fee charged for the professional service or product..
5884         */
5885        @Child(name = "fee", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
5886        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product.." )
5887        protected Money fee;
5888
5889        /**
5890         * A list of note references to the notes provided below.
5891         */
5892        @Child(name = "noteNumberLinkId", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5893        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
5894        protected List<PositiveIntType> noteNumberLinkId;
5895
5896        /**
5897         * The adjudications results.
5898         */
5899        @Child(name = "adjudication", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5900        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudications results." )
5901        protected List<AddedItemAdjudicationComponent> adjudication;
5902
5903        /**
5904         * The second tier service adjudications for payor added services.
5905         */
5906        @Child(name = "detail", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5907        @Description(shortDefinition="Added items details", formalDefinition="The second tier service adjudications for payor added services." )
5908        protected List<AddedItemsDetailComponent> detail;
5909
5910        private static final long serialVersionUID = -1675935854L;
5911
5912    /**
5913     * Constructor
5914     */
5915      public AddedItemComponent() {
5916        super();
5917      }
5918
5919    /**
5920     * Constructor
5921     */
5922      public AddedItemComponent(Coding service) {
5923        super();
5924        this.service = service;
5925      }
5926
5927        /**
5928         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
5929         */
5930        public List<PositiveIntType> getSequenceLinkId() { 
5931          if (this.sequenceLinkId == null)
5932            this.sequenceLinkId = new ArrayList<PositiveIntType>();
5933          return this.sequenceLinkId;
5934        }
5935
5936        public boolean hasSequenceLinkId() { 
5937          if (this.sequenceLinkId == null)
5938            return false;
5939          for (PositiveIntType item : this.sequenceLinkId)
5940            if (!item.isEmpty())
5941              return true;
5942          return false;
5943        }
5944
5945        /**
5946         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
5947         */
5948    // syntactic sugar
5949        public PositiveIntType addSequenceLinkIdElement() {//2 
5950          PositiveIntType t = new PositiveIntType();
5951          if (this.sequenceLinkId == null)
5952            this.sequenceLinkId = new ArrayList<PositiveIntType>();
5953          this.sequenceLinkId.add(t);
5954          return t;
5955        }
5956
5957        /**
5958         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
5959         */
5960        public AddedItemComponent addSequenceLinkId(int value) { //1
5961          PositiveIntType t = new PositiveIntType();
5962          t.setValue(value);
5963          if (this.sequenceLinkId == null)
5964            this.sequenceLinkId = new ArrayList<PositiveIntType>();
5965          this.sequenceLinkId.add(t);
5966          return this;
5967        }
5968
5969        /**
5970         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
5971         */
5972        public boolean hasSequenceLinkId(int value) { 
5973          if (this.sequenceLinkId == null)
5974            return false;
5975          for (PositiveIntType v : this.sequenceLinkId)
5976            if (v.equals(value)) // positiveInt
5977              return true;
5978          return false;
5979        }
5980
5981        /**
5982         * @return {@link #service} (A code to indicate the Professional Service or Product supplied.)
5983         */
5984        public Coding getService() { 
5985          if (this.service == null)
5986            if (Configuration.errorOnAutoCreate())
5987              throw new Error("Attempt to auto-create AddedItemComponent.service");
5988            else if (Configuration.doAutoCreate())
5989              this.service = new Coding(); // cc
5990          return this.service;
5991        }
5992
5993        public boolean hasService() { 
5994          return this.service != null && !this.service.isEmpty();
5995        }
5996
5997        /**
5998         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied.)
5999         */
6000        public AddedItemComponent setService(Coding value) { 
6001          this.service = value;
6002          return this;
6003        }
6004
6005        /**
6006         * @return {@link #fee} (The fee charged for the professional service or product..)
6007         */
6008        public Money getFee() { 
6009          if (this.fee == null)
6010            if (Configuration.errorOnAutoCreate())
6011              throw new Error("Attempt to auto-create AddedItemComponent.fee");
6012            else if (Configuration.doAutoCreate())
6013              this.fee = new Money(); // cc
6014          return this.fee;
6015        }
6016
6017        public boolean hasFee() { 
6018          return this.fee != null && !this.fee.isEmpty();
6019        }
6020
6021        /**
6022         * @param value {@link #fee} (The fee charged for the professional service or product..)
6023         */
6024        public AddedItemComponent setFee(Money value) { 
6025          this.fee = value;
6026          return this;
6027        }
6028
6029        /**
6030         * @return {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
6031         */
6032        public List<PositiveIntType> getNoteNumberLinkId() { 
6033          if (this.noteNumberLinkId == null)
6034            this.noteNumberLinkId = new ArrayList<PositiveIntType>();
6035          return this.noteNumberLinkId;
6036        }
6037
6038        public boolean hasNoteNumberLinkId() { 
6039          if (this.noteNumberLinkId == null)
6040            return false;
6041          for (PositiveIntType item : this.noteNumberLinkId)
6042            if (!item.isEmpty())
6043              return true;
6044          return false;
6045        }
6046
6047        /**
6048         * @return {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
6049         */
6050    // syntactic sugar
6051        public PositiveIntType addNoteNumberLinkIdElement() {//2 
6052          PositiveIntType t = new PositiveIntType();
6053          if (this.noteNumberLinkId == null)
6054            this.noteNumberLinkId = new ArrayList<PositiveIntType>();
6055          this.noteNumberLinkId.add(t);
6056          return t;
6057        }
6058
6059        /**
6060         * @param value {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
6061         */
6062        public AddedItemComponent addNoteNumberLinkId(int value) { //1
6063          PositiveIntType t = new PositiveIntType();
6064          t.setValue(value);
6065          if (this.noteNumberLinkId == null)
6066            this.noteNumberLinkId = new ArrayList<PositiveIntType>();
6067          this.noteNumberLinkId.add(t);
6068          return this;
6069        }
6070
6071        /**
6072         * @param value {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
6073         */
6074        public boolean hasNoteNumberLinkId(int value) { 
6075          if (this.noteNumberLinkId == null)
6076            return false;
6077          for (PositiveIntType v : this.noteNumberLinkId)
6078            if (v.equals(value)) // positiveInt
6079              return true;
6080          return false;
6081        }
6082
6083        /**
6084         * @return {@link #adjudication} (The adjudications results.)
6085         */
6086        public List<AddedItemAdjudicationComponent> getAdjudication() { 
6087          if (this.adjudication == null)
6088            this.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
6089          return this.adjudication;
6090        }
6091
6092        public boolean hasAdjudication() { 
6093          if (this.adjudication == null)
6094            return false;
6095          for (AddedItemAdjudicationComponent item : this.adjudication)
6096            if (!item.isEmpty())
6097              return true;
6098          return false;
6099        }
6100
6101        /**
6102         * @return {@link #adjudication} (The adjudications results.)
6103         */
6104    // syntactic sugar
6105        public AddedItemAdjudicationComponent addAdjudication() { //3
6106          AddedItemAdjudicationComponent t = new AddedItemAdjudicationComponent();
6107          if (this.adjudication == null)
6108            this.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
6109          this.adjudication.add(t);
6110          return t;
6111        }
6112
6113    // syntactic sugar
6114        public AddedItemComponent addAdjudication(AddedItemAdjudicationComponent t) { //3
6115          if (t == null)
6116            return this;
6117          if (this.adjudication == null)
6118            this.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
6119          this.adjudication.add(t);
6120          return this;
6121        }
6122
6123        /**
6124         * @return {@link #detail} (The second tier service adjudications for payor added services.)
6125         */
6126        public List<AddedItemsDetailComponent> getDetail() { 
6127          if (this.detail == null)
6128            this.detail = new ArrayList<AddedItemsDetailComponent>();
6129          return this.detail;
6130        }
6131
6132        public boolean hasDetail() { 
6133          if (this.detail == null)
6134            return false;
6135          for (AddedItemsDetailComponent item : this.detail)
6136            if (!item.isEmpty())
6137              return true;
6138          return false;
6139        }
6140
6141        /**
6142         * @return {@link #detail} (The second tier service adjudications for payor added services.)
6143         */
6144    // syntactic sugar
6145        public AddedItemsDetailComponent addDetail() { //3
6146          AddedItemsDetailComponent t = new AddedItemsDetailComponent();
6147          if (this.detail == null)
6148            this.detail = new ArrayList<AddedItemsDetailComponent>();
6149          this.detail.add(t);
6150          return t;
6151        }
6152
6153    // syntactic sugar
6154        public AddedItemComponent addDetail(AddedItemsDetailComponent t) { //3
6155          if (t == null)
6156            return this;
6157          if (this.detail == null)
6158            this.detail = new ArrayList<AddedItemsDetailComponent>();
6159          this.detail.add(t);
6160          return this;
6161        }
6162
6163        protected void listChildren(List<Property> childrenList) {
6164          super.listChildren(childrenList);
6165          childrenList.add(new Property("sequenceLinkId", "positiveInt", "List of input service items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
6166          childrenList.add(new Property("service", "Coding", "A code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
6167          childrenList.add(new Property("fee", "Money", "The fee charged for the professional service or product..", 0, java.lang.Integer.MAX_VALUE, fee));
6168          childrenList.add(new Property("noteNumberLinkId", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumberLinkId));
6169          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6170          childrenList.add(new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
6171        }
6172
6173      @Override
6174      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6175        switch (hash) {
6176        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : this.sequenceLinkId.toArray(new Base[this.sequenceLinkId.size()]); // PositiveIntType
6177        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // Coding
6178        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
6179        case -1859667856: /*noteNumberLinkId*/ return this.noteNumberLinkId == null ? new Base[0] : this.noteNumberLinkId.toArray(new Base[this.noteNumberLinkId.size()]); // PositiveIntType
6180        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AddedItemAdjudicationComponent
6181        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemsDetailComponent
6182        default: return super.getProperty(hash, name, checkValid);
6183        }
6184
6185      }
6186
6187      @Override
6188      public void setProperty(int hash, String name, Base value) throws FHIRException {
6189        switch (hash) {
6190        case -1422298666: // sequenceLinkId
6191          this.getSequenceLinkId().add(castToPositiveInt(value)); // PositiveIntType
6192          break;
6193        case 1984153269: // service
6194          this.service = castToCoding(value); // Coding
6195          break;
6196        case 101254: // fee
6197          this.fee = castToMoney(value); // Money
6198          break;
6199        case -1859667856: // noteNumberLinkId
6200          this.getNoteNumberLinkId().add(castToPositiveInt(value)); // PositiveIntType
6201          break;
6202        case -231349275: // adjudication
6203          this.getAdjudication().add((AddedItemAdjudicationComponent) value); // AddedItemAdjudicationComponent
6204          break;
6205        case -1335224239: // detail
6206          this.getDetail().add((AddedItemsDetailComponent) value); // AddedItemsDetailComponent
6207          break;
6208        default: super.setProperty(hash, name, value);
6209        }
6210
6211      }
6212
6213      @Override
6214      public void setProperty(String name, Base value) throws FHIRException {
6215        if (name.equals("sequenceLinkId"))
6216          this.getSequenceLinkId().add(castToPositiveInt(value));
6217        else if (name.equals("service"))
6218          this.service = castToCoding(value); // Coding
6219        else if (name.equals("fee"))
6220          this.fee = castToMoney(value); // Money
6221        else if (name.equals("noteNumberLinkId"))
6222          this.getNoteNumberLinkId().add(castToPositiveInt(value));
6223        else if (name.equals("adjudication"))
6224          this.getAdjudication().add((AddedItemAdjudicationComponent) value);
6225        else if (name.equals("detail"))
6226          this.getDetail().add((AddedItemsDetailComponent) value);
6227        else
6228          super.setProperty(name, value);
6229      }
6230
6231      @Override
6232      public Base makeProperty(int hash, String name) throws FHIRException {
6233        switch (hash) {
6234        case -1422298666: throw new FHIRException("Cannot make property sequenceLinkId as it is not a complex type"); // PositiveIntType
6235        case 1984153269:  return getService(); // Coding
6236        case 101254:  return getFee(); // Money
6237        case -1859667856: throw new FHIRException("Cannot make property noteNumberLinkId as it is not a complex type"); // PositiveIntType
6238        case -231349275:  return addAdjudication(); // AddedItemAdjudicationComponent
6239        case -1335224239:  return addDetail(); // AddedItemsDetailComponent
6240        default: return super.makeProperty(hash, name);
6241        }
6242
6243      }
6244
6245      @Override
6246      public Base addChild(String name) throws FHIRException {
6247        if (name.equals("sequenceLinkId")) {
6248          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequenceLinkId");
6249        }
6250        else if (name.equals("service")) {
6251          this.service = new Coding();
6252          return this.service;
6253        }
6254        else if (name.equals("fee")) {
6255          this.fee = new Money();
6256          return this.fee;
6257        }
6258        else if (name.equals("noteNumberLinkId")) {
6259          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumberLinkId");
6260        }
6261        else if (name.equals("adjudication")) {
6262          return addAdjudication();
6263        }
6264        else if (name.equals("detail")) {
6265          return addDetail();
6266        }
6267        else
6268          return super.addChild(name);
6269      }
6270
6271      public AddedItemComponent copy() {
6272        AddedItemComponent dst = new AddedItemComponent();
6273        copyValues(dst);
6274        if (sequenceLinkId != null) {
6275          dst.sequenceLinkId = new ArrayList<PositiveIntType>();
6276          for (PositiveIntType i : sequenceLinkId)
6277            dst.sequenceLinkId.add(i.copy());
6278        };
6279        dst.service = service == null ? null : service.copy();
6280        dst.fee = fee == null ? null : fee.copy();
6281        if (noteNumberLinkId != null) {
6282          dst.noteNumberLinkId = new ArrayList<PositiveIntType>();
6283          for (PositiveIntType i : noteNumberLinkId)
6284            dst.noteNumberLinkId.add(i.copy());
6285        };
6286        if (adjudication != null) {
6287          dst.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
6288          for (AddedItemAdjudicationComponent i : adjudication)
6289            dst.adjudication.add(i.copy());
6290        };
6291        if (detail != null) {
6292          dst.detail = new ArrayList<AddedItemsDetailComponent>();
6293          for (AddedItemsDetailComponent i : detail)
6294            dst.detail.add(i.copy());
6295        };
6296        return dst;
6297      }
6298
6299      @Override
6300      public boolean equalsDeep(Base other) {
6301        if (!super.equalsDeep(other))
6302          return false;
6303        if (!(other instanceof AddedItemComponent))
6304          return false;
6305        AddedItemComponent o = (AddedItemComponent) other;
6306        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(service, o.service, true)
6307           && compareDeep(fee, o.fee, true) && compareDeep(noteNumberLinkId, o.noteNumberLinkId, true) && compareDeep(adjudication, o.adjudication, true)
6308           && compareDeep(detail, o.detail, true);
6309      }
6310
6311      @Override
6312      public boolean equalsShallow(Base other) {
6313        if (!super.equalsShallow(other))
6314          return false;
6315        if (!(other instanceof AddedItemComponent))
6316          return false;
6317        AddedItemComponent o = (AddedItemComponent) other;
6318        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumberLinkId, o.noteNumberLinkId, true)
6319          ;
6320      }
6321
6322      public boolean isEmpty() {
6323        return super.isEmpty() && (sequenceLinkId == null || sequenceLinkId.isEmpty()) && (service == null || service.isEmpty())
6324           && (fee == null || fee.isEmpty()) && (noteNumberLinkId == null || noteNumberLinkId.isEmpty())
6325           && (adjudication == null || adjudication.isEmpty()) && (detail == null || detail.isEmpty())
6326          ;
6327      }
6328
6329  public String fhirType() {
6330    return "ExplanationOfBenefit.addItem";
6331
6332  }
6333
6334  }
6335
6336    @Block()
6337    public static class AddedItemAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
6338        /**
6339         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
6340         */
6341        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
6342        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
6343        protected Coding category;
6344
6345        /**
6346         * Adjudication reason such as limit reached.
6347         */
6348        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
6349        @Description(shortDefinition="Adjudication reason", formalDefinition="Adjudication reason such as limit reached." )
6350        protected Coding reason;
6351
6352        /**
6353         * Monitory amount associated with the code.
6354         */
6355        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
6356        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
6357        protected Money amount;
6358
6359        /**
6360         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6361         */
6362        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
6363        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
6364        protected DecimalType value;
6365
6366        private static final long serialVersionUID = -1926987562L;
6367
6368    /**
6369     * Constructor
6370     */
6371      public AddedItemAdjudicationComponent() {
6372        super();
6373      }
6374
6375    /**
6376     * Constructor
6377     */
6378      public AddedItemAdjudicationComponent(Coding category) {
6379        super();
6380        this.category = category;
6381      }
6382
6383        /**
6384         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
6385         */
6386        public Coding getCategory() { 
6387          if (this.category == null)
6388            if (Configuration.errorOnAutoCreate())
6389              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.category");
6390            else if (Configuration.doAutoCreate())
6391              this.category = new Coding(); // cc
6392          return this.category;
6393        }
6394
6395        public boolean hasCategory() { 
6396          return this.category != null && !this.category.isEmpty();
6397        }
6398
6399        /**
6400         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
6401         */
6402        public AddedItemAdjudicationComponent setCategory(Coding value) { 
6403          this.category = value;
6404          return this;
6405        }
6406
6407        /**
6408         * @return {@link #reason} (Adjudication reason such as limit reached.)
6409         */
6410        public Coding getReason() { 
6411          if (this.reason == null)
6412            if (Configuration.errorOnAutoCreate())
6413              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.reason");
6414            else if (Configuration.doAutoCreate())
6415              this.reason = new Coding(); // cc
6416          return this.reason;
6417        }
6418
6419        public boolean hasReason() { 
6420          return this.reason != null && !this.reason.isEmpty();
6421        }
6422
6423        /**
6424         * @param value {@link #reason} (Adjudication reason such as limit reached.)
6425         */
6426        public AddedItemAdjudicationComponent setReason(Coding value) { 
6427          this.reason = value;
6428          return this;
6429        }
6430
6431        /**
6432         * @return {@link #amount} (Monitory amount associated with the code.)
6433         */
6434        public Money getAmount() { 
6435          if (this.amount == null)
6436            if (Configuration.errorOnAutoCreate())
6437              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.amount");
6438            else if (Configuration.doAutoCreate())
6439              this.amount = new Money(); // cc
6440          return this.amount;
6441        }
6442
6443        public boolean hasAmount() { 
6444          return this.amount != null && !this.amount.isEmpty();
6445        }
6446
6447        /**
6448         * @param value {@link #amount} (Monitory amount associated with the code.)
6449         */
6450        public AddedItemAdjudicationComponent setAmount(Money value) { 
6451          this.amount = value;
6452          return this;
6453        }
6454
6455        /**
6456         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
6457         */
6458        public DecimalType getValueElement() { 
6459          if (this.value == null)
6460            if (Configuration.errorOnAutoCreate())
6461              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.value");
6462            else if (Configuration.doAutoCreate())
6463              this.value = new DecimalType(); // bb
6464          return this.value;
6465        }
6466
6467        public boolean hasValueElement() { 
6468          return this.value != null && !this.value.isEmpty();
6469        }
6470
6471        public boolean hasValue() { 
6472          return this.value != null && !this.value.isEmpty();
6473        }
6474
6475        /**
6476         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
6477         */
6478        public AddedItemAdjudicationComponent setValueElement(DecimalType value) { 
6479          this.value = value;
6480          return this;
6481        }
6482
6483        /**
6484         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6485         */
6486        public BigDecimal getValue() { 
6487          return this.value == null ? null : this.value.getValue();
6488        }
6489
6490        /**
6491         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6492         */
6493        public AddedItemAdjudicationComponent setValue(BigDecimal value) { 
6494          if (value == null)
6495            this.value = null;
6496          else {
6497            if (this.value == null)
6498              this.value = new DecimalType();
6499            this.value.setValue(value);
6500          }
6501          return this;
6502        }
6503
6504        /**
6505         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6506         */
6507        public AddedItemAdjudicationComponent setValue(long value) { 
6508              this.value = new DecimalType();
6509            this.value.setValue(value);
6510          return this;
6511        }
6512
6513        /**
6514         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6515         */
6516        public AddedItemAdjudicationComponent setValue(double value) { 
6517              this.value = new DecimalType();
6518            this.value.setValue(value);
6519          return this;
6520        }
6521
6522        protected void listChildren(List<Property> childrenList) {
6523          super.listChildren(childrenList);
6524          childrenList.add(new Property("category", "Coding", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
6525          childrenList.add(new Property("reason", "Coding", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
6526          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
6527          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
6528        }
6529
6530      @Override
6531      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6532        switch (hash) {
6533        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
6534        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
6535        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
6536        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
6537        default: return super.getProperty(hash, name, checkValid);
6538        }
6539
6540      }
6541
6542      @Override
6543      public void setProperty(int hash, String name, Base value) throws FHIRException {
6544        switch (hash) {
6545        case 50511102: // category
6546          this.category = castToCoding(value); // Coding
6547          break;
6548        case -934964668: // reason
6549          this.reason = castToCoding(value); // Coding
6550          break;
6551        case -1413853096: // amount
6552          this.amount = castToMoney(value); // Money
6553          break;
6554        case 111972721: // value
6555          this.value = castToDecimal(value); // DecimalType
6556          break;
6557        default: super.setProperty(hash, name, value);
6558        }
6559
6560      }
6561
6562      @Override
6563      public void setProperty(String name, Base value) throws FHIRException {
6564        if (name.equals("category"))
6565          this.category = castToCoding(value); // Coding
6566        else if (name.equals("reason"))
6567          this.reason = castToCoding(value); // Coding
6568        else if (name.equals("amount"))
6569          this.amount = castToMoney(value); // Money
6570        else if (name.equals("value"))
6571          this.value = castToDecimal(value); // DecimalType
6572        else
6573          super.setProperty(name, value);
6574      }
6575
6576      @Override
6577      public Base makeProperty(int hash, String name) throws FHIRException {
6578        switch (hash) {
6579        case 50511102:  return getCategory(); // Coding
6580        case -934964668:  return getReason(); // Coding
6581        case -1413853096:  return getAmount(); // Money
6582        case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // DecimalType
6583        default: return super.makeProperty(hash, name);
6584        }
6585
6586      }
6587
6588      @Override
6589      public Base addChild(String name) throws FHIRException {
6590        if (name.equals("category")) {
6591          this.category = new Coding();
6592          return this.category;
6593        }
6594        else if (name.equals("reason")) {
6595          this.reason = new Coding();
6596          return this.reason;
6597        }
6598        else if (name.equals("amount")) {
6599          this.amount = new Money();
6600          return this.amount;
6601        }
6602        else if (name.equals("value")) {
6603          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
6604        }
6605        else
6606          return super.addChild(name);
6607      }
6608
6609      public AddedItemAdjudicationComponent copy() {
6610        AddedItemAdjudicationComponent dst = new AddedItemAdjudicationComponent();
6611        copyValues(dst);
6612        dst.category = category == null ? null : category.copy();
6613        dst.reason = reason == null ? null : reason.copy();
6614        dst.amount = amount == null ? null : amount.copy();
6615        dst.value = value == null ? null : value.copy();
6616        return dst;
6617      }
6618
6619      @Override
6620      public boolean equalsDeep(Base other) {
6621        if (!super.equalsDeep(other))
6622          return false;
6623        if (!(other instanceof AddedItemAdjudicationComponent))
6624          return false;
6625        AddedItemAdjudicationComponent o = (AddedItemAdjudicationComponent) other;
6626        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
6627           && compareDeep(value, o.value, true);
6628      }
6629
6630      @Override
6631      public boolean equalsShallow(Base other) {
6632        if (!super.equalsShallow(other))
6633          return false;
6634        if (!(other instanceof AddedItemAdjudicationComponent))
6635          return false;
6636        AddedItemAdjudicationComponent o = (AddedItemAdjudicationComponent) other;
6637        return compareValues(value, o.value, true);
6638      }
6639
6640      public boolean isEmpty() {
6641        return super.isEmpty() && (category == null || category.isEmpty()) && (reason == null || reason.isEmpty())
6642           && (amount == null || amount.isEmpty()) && (value == null || value.isEmpty());
6643      }
6644
6645  public String fhirType() {
6646    return "ExplanationOfBenefit.addItem.adjudication";
6647
6648  }
6649
6650  }
6651
6652    @Block()
6653    public static class AddedItemsDetailComponent extends BackboneElement implements IBaseBackboneElement {
6654        /**
6655         * A code to indicate the Professional Service or Product supplied.
6656         */
6657        @Child(name = "service", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
6658        @Description(shortDefinition="Service or Product", formalDefinition="A code to indicate the Professional Service or Product supplied." )
6659        protected Coding service;
6660
6661        /**
6662         * The fee charged for the professional service or product..
6663         */
6664        @Child(name = "fee", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=true)
6665        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product.." )
6666        protected Money fee;
6667
6668        /**
6669         * The adjudications results.
6670         */
6671        @Child(name = "adjudication", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6672        @Description(shortDefinition="Added items detail adjudication", formalDefinition="The adjudications results." )
6673        protected List<AddedItemDetailAdjudicationComponent> adjudication;
6674
6675        private static final long serialVersionUID = -2104242020L;
6676
6677    /**
6678     * Constructor
6679     */
6680      public AddedItemsDetailComponent() {
6681        super();
6682      }
6683
6684    /**
6685     * Constructor
6686     */
6687      public AddedItemsDetailComponent(Coding service) {
6688        super();
6689        this.service = service;
6690      }
6691
6692        /**
6693         * @return {@link #service} (A code to indicate the Professional Service or Product supplied.)
6694         */
6695        public Coding getService() { 
6696          if (this.service == null)
6697            if (Configuration.errorOnAutoCreate())
6698              throw new Error("Attempt to auto-create AddedItemsDetailComponent.service");
6699            else if (Configuration.doAutoCreate())
6700              this.service = new Coding(); // cc
6701          return this.service;
6702        }
6703
6704        public boolean hasService() { 
6705          return this.service != null && !this.service.isEmpty();
6706        }
6707
6708        /**
6709         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied.)
6710         */
6711        public AddedItemsDetailComponent setService(Coding value) { 
6712          this.service = value;
6713          return this;
6714        }
6715
6716        /**
6717         * @return {@link #fee} (The fee charged for the professional service or product..)
6718         */
6719        public Money getFee() { 
6720          if (this.fee == null)
6721            if (Configuration.errorOnAutoCreate())
6722              throw new Error("Attempt to auto-create AddedItemsDetailComponent.fee");
6723            else if (Configuration.doAutoCreate())
6724              this.fee = new Money(); // cc
6725          return this.fee;
6726        }
6727
6728        public boolean hasFee() { 
6729          return this.fee != null && !this.fee.isEmpty();
6730        }
6731
6732        /**
6733         * @param value {@link #fee} (The fee charged for the professional service or product..)
6734         */
6735        public AddedItemsDetailComponent setFee(Money value) { 
6736          this.fee = value;
6737          return this;
6738        }
6739
6740        /**
6741         * @return {@link #adjudication} (The adjudications results.)
6742         */
6743        public List<AddedItemDetailAdjudicationComponent> getAdjudication() { 
6744          if (this.adjudication == null)
6745            this.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
6746          return this.adjudication;
6747        }
6748
6749        public boolean hasAdjudication() { 
6750          if (this.adjudication == null)
6751            return false;
6752          for (AddedItemDetailAdjudicationComponent item : this.adjudication)
6753            if (!item.isEmpty())
6754              return true;
6755          return false;
6756        }
6757
6758        /**
6759         * @return {@link #adjudication} (The adjudications results.)
6760         */
6761    // syntactic sugar
6762        public AddedItemDetailAdjudicationComponent addAdjudication() { //3
6763          AddedItemDetailAdjudicationComponent t = new AddedItemDetailAdjudicationComponent();
6764          if (this.adjudication == null)
6765            this.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
6766          this.adjudication.add(t);
6767          return t;
6768        }
6769
6770    // syntactic sugar
6771        public AddedItemsDetailComponent addAdjudication(AddedItemDetailAdjudicationComponent t) { //3
6772          if (t == null)
6773            return this;
6774          if (this.adjudication == null)
6775            this.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
6776          this.adjudication.add(t);
6777          return this;
6778        }
6779
6780        protected void listChildren(List<Property> childrenList) {
6781          super.listChildren(childrenList);
6782          childrenList.add(new Property("service", "Coding", "A code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
6783          childrenList.add(new Property("fee", "Money", "The fee charged for the professional service or product..", 0, java.lang.Integer.MAX_VALUE, fee));
6784          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6785        }
6786
6787      @Override
6788      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6789        switch (hash) {
6790        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // Coding
6791        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
6792        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AddedItemDetailAdjudicationComponent
6793        default: return super.getProperty(hash, name, checkValid);
6794        }
6795
6796      }
6797
6798      @Override
6799      public void setProperty(int hash, String name, Base value) throws FHIRException {
6800        switch (hash) {
6801        case 1984153269: // service
6802          this.service = castToCoding(value); // Coding
6803          break;
6804        case 101254: // fee
6805          this.fee = castToMoney(value); // Money
6806          break;
6807        case -231349275: // adjudication
6808          this.getAdjudication().add((AddedItemDetailAdjudicationComponent) value); // AddedItemDetailAdjudicationComponent
6809          break;
6810        default: super.setProperty(hash, name, value);
6811        }
6812
6813      }
6814
6815      @Override
6816      public void setProperty(String name, Base value) throws FHIRException {
6817        if (name.equals("service"))
6818          this.service = castToCoding(value); // Coding
6819        else if (name.equals("fee"))
6820          this.fee = castToMoney(value); // Money
6821        else if (name.equals("adjudication"))
6822          this.getAdjudication().add((AddedItemDetailAdjudicationComponent) value);
6823        else
6824          super.setProperty(name, value);
6825      }
6826
6827      @Override
6828      public Base makeProperty(int hash, String name) throws FHIRException {
6829        switch (hash) {
6830        case 1984153269:  return getService(); // Coding
6831        case 101254:  return getFee(); // Money
6832        case -231349275:  return addAdjudication(); // AddedItemDetailAdjudicationComponent
6833        default: return super.makeProperty(hash, name);
6834        }
6835
6836      }
6837
6838      @Override
6839      public Base addChild(String name) throws FHIRException {
6840        if (name.equals("service")) {
6841          this.service = new Coding();
6842          return this.service;
6843        }
6844        else if (name.equals("fee")) {
6845          this.fee = new Money();
6846          return this.fee;
6847        }
6848        else if (name.equals("adjudication")) {
6849          return addAdjudication();
6850        }
6851        else
6852          return super.addChild(name);
6853      }
6854
6855      public AddedItemsDetailComponent copy() {
6856        AddedItemsDetailComponent dst = new AddedItemsDetailComponent();
6857        copyValues(dst);
6858        dst.service = service == null ? null : service.copy();
6859        dst.fee = fee == null ? null : fee.copy();
6860        if (adjudication != null) {
6861          dst.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
6862          for (AddedItemDetailAdjudicationComponent i : adjudication)
6863            dst.adjudication.add(i.copy());
6864        };
6865        return dst;
6866      }
6867
6868      @Override
6869      public boolean equalsDeep(Base other) {
6870        if (!super.equalsDeep(other))
6871          return false;
6872        if (!(other instanceof AddedItemsDetailComponent))
6873          return false;
6874        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other;
6875        return compareDeep(service, o.service, true) && compareDeep(fee, o.fee, true) && compareDeep(adjudication, o.adjudication, true)
6876          ;
6877      }
6878
6879      @Override
6880      public boolean equalsShallow(Base other) {
6881        if (!super.equalsShallow(other))
6882          return false;
6883        if (!(other instanceof AddedItemsDetailComponent))
6884          return false;
6885        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other;
6886        return true;
6887      }
6888
6889      public boolean isEmpty() {
6890        return super.isEmpty() && (service == null || service.isEmpty()) && (fee == null || fee.isEmpty())
6891           && (adjudication == null || adjudication.isEmpty());
6892      }
6893
6894  public String fhirType() {
6895    return "ExplanationOfBenefit.addItem.detail";
6896
6897  }
6898
6899  }
6900
6901    @Block()
6902    public static class AddedItemDetailAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
6903        /**
6904         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
6905         */
6906        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
6907        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
6908        protected Coding category;
6909
6910        /**
6911         * Adjudication reason such as limit reached.
6912         */
6913        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
6914        @Description(shortDefinition="Adjudication reason", formalDefinition="Adjudication reason such as limit reached." )
6915        protected Coding reason;
6916
6917        /**
6918         * Monitory amount associated with the code.
6919         */
6920        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
6921        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
6922        protected Money amount;
6923
6924        /**
6925         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6926         */
6927        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
6928        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
6929        protected DecimalType value;
6930
6931        private static final long serialVersionUID = -1926987562L;
6932
6933    /**
6934     * Constructor
6935     */
6936      public AddedItemDetailAdjudicationComponent() {
6937        super();
6938      }
6939
6940    /**
6941     * Constructor
6942     */
6943      public AddedItemDetailAdjudicationComponent(Coding category) {
6944        super();
6945        this.category = category;
6946      }
6947
6948        /**
6949         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
6950         */
6951        public Coding getCategory() { 
6952          if (this.category == null)
6953            if (Configuration.errorOnAutoCreate())
6954              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.category");
6955            else if (Configuration.doAutoCreate())
6956              this.category = new Coding(); // cc
6957          return this.category;
6958        }
6959
6960        public boolean hasCategory() { 
6961          return this.category != null && !this.category.isEmpty();
6962        }
6963
6964        /**
6965         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
6966         */
6967        public AddedItemDetailAdjudicationComponent setCategory(Coding value) { 
6968          this.category = value;
6969          return this;
6970        }
6971
6972        /**
6973         * @return {@link #reason} (Adjudication reason such as limit reached.)
6974         */
6975        public Coding getReason() { 
6976          if (this.reason == null)
6977            if (Configuration.errorOnAutoCreate())
6978              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.reason");
6979            else if (Configuration.doAutoCreate())
6980              this.reason = new Coding(); // cc
6981          return this.reason;
6982        }
6983
6984        public boolean hasReason() { 
6985          return this.reason != null && !this.reason.isEmpty();
6986        }
6987
6988        /**
6989         * @param value {@link #reason} (Adjudication reason such as limit reached.)
6990         */
6991        public AddedItemDetailAdjudicationComponent setReason(Coding value) { 
6992          this.reason = value;
6993          return this;
6994        }
6995
6996        /**
6997         * @return {@link #amount} (Monitory amount associated with the code.)
6998         */
6999        public Money getAmount() { 
7000          if (this.amount == null)
7001            if (Configuration.errorOnAutoCreate())
7002              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.amount");
7003            else if (Configuration.doAutoCreate())
7004              this.amount = new Money(); // cc
7005          return this.amount;
7006        }
7007
7008        public boolean hasAmount() { 
7009          return this.amount != null && !this.amount.isEmpty();
7010        }
7011
7012        /**
7013         * @param value {@link #amount} (Monitory amount associated with the code.)
7014         */
7015        public AddedItemDetailAdjudicationComponent setAmount(Money value) { 
7016          this.amount = value;
7017          return this;
7018        }
7019
7020        /**
7021         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
7022         */
7023        public DecimalType getValueElement() { 
7024          if (this.value == null)
7025            if (Configuration.errorOnAutoCreate())
7026              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.value");
7027            else if (Configuration.doAutoCreate())
7028              this.value = new DecimalType(); // bb
7029          return this.value;
7030        }
7031
7032        public boolean hasValueElement() { 
7033          return this.value != null && !this.value.isEmpty();
7034        }
7035
7036        public boolean hasValue() { 
7037          return this.value != null && !this.value.isEmpty();
7038        }
7039
7040        /**
7041         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
7042         */
7043        public AddedItemDetailAdjudicationComponent setValueElement(DecimalType value) { 
7044          this.value = value;
7045          return this;
7046        }
7047
7048        /**
7049         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
7050         */
7051        public BigDecimal getValue() { 
7052          return this.value == null ? null : this.value.getValue();
7053        }
7054
7055        /**
7056         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
7057         */
7058        public AddedItemDetailAdjudicationComponent setValue(BigDecimal value) { 
7059          if (value == null)
7060            this.value = null;
7061          else {
7062            if (this.value == null)
7063              this.value = new DecimalType();
7064            this.value.setValue(value);
7065          }
7066          return this;
7067        }
7068
7069        /**
7070         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
7071         */
7072        public AddedItemDetailAdjudicationComponent setValue(long value) { 
7073              this.value = new DecimalType();
7074            this.value.setValue(value);
7075          return this;
7076        }
7077
7078        /**
7079         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
7080         */
7081        public AddedItemDetailAdjudicationComponent setValue(double value) { 
7082              this.value = new DecimalType();
7083            this.value.setValue(value);
7084          return this;
7085        }
7086
7087        protected void listChildren(List<Property> childrenList) {
7088          super.listChildren(childrenList);
7089          childrenList.add(new Property("category", "Coding", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
7090          childrenList.add(new Property("reason", "Coding", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
7091          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
7092          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
7093        }
7094
7095      @Override
7096      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7097        switch (hash) {
7098        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
7099        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
7100        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
7101        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
7102        default: return super.getProperty(hash, name, checkValid);
7103        }
7104
7105      }
7106
7107      @Override
7108      public void setProperty(int hash, String name, Base value) throws FHIRException {
7109        switch (hash) {
7110        case 50511102: // category
7111          this.category = castToCoding(value); // Coding
7112          break;
7113        case -934964668: // reason
7114          this.reason = castToCoding(value); // Coding
7115          break;
7116        case -1413853096: // amount
7117          this.amount = castToMoney(value); // Money
7118          break;
7119        case 111972721: // value
7120          this.value = castToDecimal(value); // DecimalType
7121          break;
7122        default: super.setProperty(hash, name, value);
7123        }
7124
7125      }
7126
7127      @Override
7128      public void setProperty(String name, Base value) throws FHIRException {
7129        if (name.equals("category"))
7130          this.category = castToCoding(value); // Coding
7131        else if (name.equals("reason"))
7132          this.reason = castToCoding(value); // Coding
7133        else if (name.equals("amount"))
7134          this.amount = castToMoney(value); // Money
7135        else if (name.equals("value"))
7136          this.value = castToDecimal(value); // DecimalType
7137        else
7138          super.setProperty(name, value);
7139      }
7140
7141      @Override
7142      public Base makeProperty(int hash, String name) throws FHIRException {
7143        switch (hash) {
7144        case 50511102:  return getCategory(); // Coding
7145        case -934964668:  return getReason(); // Coding
7146        case -1413853096:  return getAmount(); // Money
7147        case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // DecimalType
7148        default: return super.makeProperty(hash, name);
7149        }
7150
7151      }
7152
7153      @Override
7154      public Base addChild(String name) throws FHIRException {
7155        if (name.equals("category")) {
7156          this.category = new Coding();
7157          return this.category;
7158        }
7159        else if (name.equals("reason")) {
7160          this.reason = new Coding();
7161          return this.reason;
7162        }
7163        else if (name.equals("amount")) {
7164          this.amount = new Money();
7165          return this.amount;
7166        }
7167        else if (name.equals("value")) {
7168          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
7169        }
7170        else
7171          return super.addChild(name);
7172      }
7173
7174      public AddedItemDetailAdjudicationComponent copy() {
7175        AddedItemDetailAdjudicationComponent dst = new AddedItemDetailAdjudicationComponent();
7176        copyValues(dst);
7177        dst.category = category == null ? null : category.copy();
7178        dst.reason = reason == null ? null : reason.copy();
7179        dst.amount = amount == null ? null : amount.copy();
7180        dst.value = value == null ? null : value.copy();
7181        return dst;
7182      }
7183
7184      @Override
7185      public boolean equalsDeep(Base other) {
7186        if (!super.equalsDeep(other))
7187          return false;
7188        if (!(other instanceof AddedItemDetailAdjudicationComponent))
7189          return false;
7190        AddedItemDetailAdjudicationComponent o = (AddedItemDetailAdjudicationComponent) other;
7191        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
7192           && compareDeep(value, o.value, true);
7193      }
7194
7195      @Override
7196      public boolean equalsShallow(Base other) {
7197        if (!super.equalsShallow(other))
7198          return false;
7199        if (!(other instanceof AddedItemDetailAdjudicationComponent))
7200          return false;
7201        AddedItemDetailAdjudicationComponent o = (AddedItemDetailAdjudicationComponent) other;
7202        return compareValues(value, o.value, true);
7203      }
7204
7205      public boolean isEmpty() {
7206        return super.isEmpty() && (category == null || category.isEmpty()) && (reason == null || reason.isEmpty())
7207           && (amount == null || amount.isEmpty()) && (value == null || value.isEmpty());
7208      }
7209
7210  public String fhirType() {
7211    return "ExplanationOfBenefit.addItem.detail.adjudication";
7212
7213  }
7214
7215  }
7216
7217    @Block()
7218    public static class MissingTeethComponent extends BackboneElement implements IBaseBackboneElement {
7219        /**
7220         * The code identifying which tooth is missing.
7221         */
7222        @Child(name = "tooth", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
7223        @Description(shortDefinition="Tooth Code", formalDefinition="The code identifying which tooth is missing." )
7224        protected Coding tooth;
7225
7226        /**
7227         * Missing reason may be: E-extraction, O-other.
7228         */
7229        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
7230        @Description(shortDefinition="Reason for missing", formalDefinition="Missing reason may be: E-extraction, O-other." )
7231        protected Coding reason;
7232
7233        /**
7234         * The date of the extraction either known from records or patient reported estimate.
7235         */
7236        @Child(name = "extractionDate", type = {DateType.class}, order=3, min=0, max=1, modifier=false, summary=true)
7237        @Description(shortDefinition="Date of Extraction", formalDefinition="The date of the extraction either known from records or patient reported estimate." )
7238        protected DateType extractionDate;
7239
7240        private static final long serialVersionUID = 352913313L;
7241
7242    /**
7243     * Constructor
7244     */
7245      public MissingTeethComponent() {
7246        super();
7247      }
7248
7249    /**
7250     * Constructor
7251     */
7252      public MissingTeethComponent(Coding tooth) {
7253        super();
7254        this.tooth = tooth;
7255      }
7256
7257        /**
7258         * @return {@link #tooth} (The code identifying which tooth is missing.)
7259         */
7260        public Coding getTooth() { 
7261          if (this.tooth == null)
7262            if (Configuration.errorOnAutoCreate())
7263              throw new Error("Attempt to auto-create MissingTeethComponent.tooth");
7264            else if (Configuration.doAutoCreate())
7265              this.tooth = new Coding(); // cc
7266          return this.tooth;
7267        }
7268
7269        public boolean hasTooth() { 
7270          return this.tooth != null && !this.tooth.isEmpty();
7271        }
7272
7273        /**
7274         * @param value {@link #tooth} (The code identifying which tooth is missing.)
7275         */
7276        public MissingTeethComponent setTooth(Coding value) { 
7277          this.tooth = value;
7278          return this;
7279        }
7280
7281        /**
7282         * @return {@link #reason} (Missing reason may be: E-extraction, O-other.)
7283         */
7284        public Coding getReason() { 
7285          if (this.reason == null)
7286            if (Configuration.errorOnAutoCreate())
7287              throw new Error("Attempt to auto-create MissingTeethComponent.reason");
7288            else if (Configuration.doAutoCreate())
7289              this.reason = new Coding(); // cc
7290          return this.reason;
7291        }
7292
7293        public boolean hasReason() { 
7294          return this.reason != null && !this.reason.isEmpty();
7295        }
7296
7297        /**
7298         * @param value {@link #reason} (Missing reason may be: E-extraction, O-other.)
7299         */
7300        public MissingTeethComponent setReason(Coding value) { 
7301          this.reason = value;
7302          return this;
7303        }
7304
7305        /**
7306         * @return {@link #extractionDate} (The date of the extraction either known from records or patient reported estimate.). This is the underlying object with id, value and extensions. The accessor "getExtractionDate" gives direct access to the value
7307         */
7308        public DateType getExtractionDateElement() { 
7309          if (this.extractionDate == null)
7310            if (Configuration.errorOnAutoCreate())
7311              throw new Error("Attempt to auto-create MissingTeethComponent.extractionDate");
7312            else if (Configuration.doAutoCreate())
7313              this.extractionDate = new DateType(); // bb
7314          return this.extractionDate;
7315        }
7316
7317        public boolean hasExtractionDateElement() { 
7318          return this.extractionDate != null && !this.extractionDate.isEmpty();
7319        }
7320
7321        public boolean hasExtractionDate() { 
7322          return this.extractionDate != null && !this.extractionDate.isEmpty();
7323        }
7324
7325        /**
7326         * @param value {@link #extractionDate} (The date of the extraction either known from records or patient reported estimate.). This is the underlying object with id, value and extensions. The accessor "getExtractionDate" gives direct access to the value
7327         */
7328        public MissingTeethComponent setExtractionDateElement(DateType value) { 
7329          this.extractionDate = value;
7330          return this;
7331        }
7332
7333        /**
7334         * @return The date of the extraction either known from records or patient reported estimate.
7335         */
7336        public Date getExtractionDate() { 
7337          return this.extractionDate == null ? null : this.extractionDate.getValue();
7338        }
7339
7340        /**
7341         * @param value The date of the extraction either known from records or patient reported estimate.
7342         */
7343        public MissingTeethComponent setExtractionDate(Date value) { 
7344          if (value == null)
7345            this.extractionDate = null;
7346          else {
7347            if (this.extractionDate == null)
7348              this.extractionDate = new DateType();
7349            this.extractionDate.setValue(value);
7350          }
7351          return this;
7352        }
7353
7354        protected void listChildren(List<Property> childrenList) {
7355          super.listChildren(childrenList);
7356          childrenList.add(new Property("tooth", "Coding", "The code identifying which tooth is missing.", 0, java.lang.Integer.MAX_VALUE, tooth));
7357          childrenList.add(new Property("reason", "Coding", "Missing reason may be: E-extraction, O-other.", 0, java.lang.Integer.MAX_VALUE, reason));
7358          childrenList.add(new Property("extractionDate", "date", "The date of the extraction either known from records or patient reported estimate.", 0, java.lang.Integer.MAX_VALUE, extractionDate));
7359        }
7360
7361      @Override
7362      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7363        switch (hash) {
7364        case 110545608: /*tooth*/ return this.tooth == null ? new Base[0] : new Base[] {this.tooth}; // Coding
7365        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
7366        case 580646965: /*extractionDate*/ return this.extractionDate == null ? new Base[0] : new Base[] {this.extractionDate}; // DateType
7367        default: return super.getProperty(hash, name, checkValid);
7368        }
7369
7370      }
7371
7372      @Override
7373      public void setProperty(int hash, String name, Base value) throws FHIRException {
7374        switch (hash) {
7375        case 110545608: // tooth
7376          this.tooth = castToCoding(value); // Coding
7377          break;
7378        case -934964668: // reason
7379          this.reason = castToCoding(value); // Coding
7380          break;
7381        case 580646965: // extractionDate
7382          this.extractionDate = castToDate(value); // DateType
7383          break;
7384        default: super.setProperty(hash, name, value);
7385        }
7386
7387      }
7388
7389      @Override
7390      public void setProperty(String name, Base value) throws FHIRException {
7391        if (name.equals("tooth"))
7392          this.tooth = castToCoding(value); // Coding
7393        else if (name.equals("reason"))
7394          this.reason = castToCoding(value); // Coding
7395        else if (name.equals("extractionDate"))
7396          this.extractionDate = castToDate(value); // DateType
7397        else
7398          super.setProperty(name, value);
7399      }
7400
7401      @Override
7402      public Base makeProperty(int hash, String name) throws FHIRException {
7403        switch (hash) {
7404        case 110545608:  return getTooth(); // Coding
7405        case -934964668:  return getReason(); // Coding
7406        case 580646965: throw new FHIRException("Cannot make property extractionDate as it is not a complex type"); // DateType
7407        default: return super.makeProperty(hash, name);
7408        }
7409
7410      }
7411
7412      @Override
7413      public Base addChild(String name) throws FHIRException {
7414        if (name.equals("tooth")) {
7415          this.tooth = new Coding();
7416          return this.tooth;
7417        }
7418        else if (name.equals("reason")) {
7419          this.reason = new Coding();
7420          return this.reason;
7421        }
7422        else if (name.equals("extractionDate")) {
7423          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.extractionDate");
7424        }
7425        else
7426          return super.addChild(name);
7427      }
7428
7429      public MissingTeethComponent copy() {
7430        MissingTeethComponent dst = new MissingTeethComponent();
7431        copyValues(dst);
7432        dst.tooth = tooth == null ? null : tooth.copy();
7433        dst.reason = reason == null ? null : reason.copy();
7434        dst.extractionDate = extractionDate == null ? null : extractionDate.copy();
7435        return dst;
7436      }
7437
7438      @Override
7439      public boolean equalsDeep(Base other) {
7440        if (!super.equalsDeep(other))
7441          return false;
7442        if (!(other instanceof MissingTeethComponent))
7443          return false;
7444        MissingTeethComponent o = (MissingTeethComponent) other;
7445        return compareDeep(tooth, o.tooth, true) && compareDeep(reason, o.reason, true) && compareDeep(extractionDate, o.extractionDate, true)
7446          ;
7447      }
7448
7449      @Override
7450      public boolean equalsShallow(Base other) {
7451        if (!super.equalsShallow(other))
7452          return false;
7453        if (!(other instanceof MissingTeethComponent))
7454          return false;
7455        MissingTeethComponent o = (MissingTeethComponent) other;
7456        return compareValues(extractionDate, o.extractionDate, true);
7457      }
7458
7459      public boolean isEmpty() {
7460        return super.isEmpty() && (tooth == null || tooth.isEmpty()) && (reason == null || reason.isEmpty())
7461           && (extractionDate == null || extractionDate.isEmpty());
7462      }
7463
7464  public String fhirType() {
7465    return "ExplanationOfBenefit.missingTeeth";
7466
7467  }
7468
7469  }
7470
7471    @Block()
7472    public static class NotesComponent extends BackboneElement implements IBaseBackboneElement {
7473        /**
7474         * An integer associated with each note which may be referred to from each service line item.
7475         */
7476        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=true)
7477        @Description(shortDefinition="Note Number for this note", formalDefinition="An integer associated with each note which may be referred to from each service line item." )
7478        protected PositiveIntType number;
7479
7480        /**
7481         * The note purpose: Print/Display.
7482         */
7483        @Child(name = "type", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
7484        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
7485        protected Coding type;
7486
7487        /**
7488         * The note text.
7489         */
7490        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
7491        @Description(shortDefinition="Note explanitory text", formalDefinition="The note text." )
7492        protected StringType text;
7493
7494        private static final long serialVersionUID = 1768923951L;
7495
7496    /**
7497     * Constructor
7498     */
7499      public NotesComponent() {
7500        super();
7501      }
7502
7503        /**
7504         * @return {@link #number} (An integer associated with each note which may be referred to from each service line item.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
7505         */
7506        public PositiveIntType getNumberElement() { 
7507          if (this.number == null)
7508            if (Configuration.errorOnAutoCreate())
7509              throw new Error("Attempt to auto-create NotesComponent.number");
7510            else if (Configuration.doAutoCreate())
7511              this.number = new PositiveIntType(); // bb
7512          return this.number;
7513        }
7514
7515        public boolean hasNumberElement() { 
7516          return this.number != null && !this.number.isEmpty();
7517        }
7518
7519        public boolean hasNumber() { 
7520          return this.number != null && !this.number.isEmpty();
7521        }
7522
7523        /**
7524         * @param value {@link #number} (An integer associated with each note which may be referred to from each service line item.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
7525         */
7526        public NotesComponent setNumberElement(PositiveIntType value) { 
7527          this.number = value;
7528          return this;
7529        }
7530
7531        /**
7532         * @return An integer associated with each note which may be referred to from each service line item.
7533         */
7534        public int getNumber() { 
7535          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
7536        }
7537
7538        /**
7539         * @param value An integer associated with each note which may be referred to from each service line item.
7540         */
7541        public NotesComponent setNumber(int value) { 
7542            if (this.number == null)
7543              this.number = new PositiveIntType();
7544            this.number.setValue(value);
7545          return this;
7546        }
7547
7548        /**
7549         * @return {@link #type} (The note purpose: Print/Display.)
7550         */
7551        public Coding getType() { 
7552          if (this.type == null)
7553            if (Configuration.errorOnAutoCreate())
7554              throw new Error("Attempt to auto-create NotesComponent.type");
7555            else if (Configuration.doAutoCreate())
7556              this.type = new Coding(); // cc
7557          return this.type;
7558        }
7559
7560        public boolean hasType() { 
7561          return this.type != null && !this.type.isEmpty();
7562        }
7563
7564        /**
7565         * @param value {@link #type} (The note purpose: Print/Display.)
7566         */
7567        public NotesComponent setType(Coding value) { 
7568          this.type = value;
7569          return this;
7570        }
7571
7572        /**
7573         * @return {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
7574         */
7575        public StringType getTextElement() { 
7576          if (this.text == null)
7577            if (Configuration.errorOnAutoCreate())
7578              throw new Error("Attempt to auto-create NotesComponent.text");
7579            else if (Configuration.doAutoCreate())
7580              this.text = new StringType(); // bb
7581          return this.text;
7582        }
7583
7584        public boolean hasTextElement() { 
7585          return this.text != null && !this.text.isEmpty();
7586        }
7587
7588        public boolean hasText() { 
7589          return this.text != null && !this.text.isEmpty();
7590        }
7591
7592        /**
7593         * @param value {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
7594         */
7595        public NotesComponent setTextElement(StringType value) { 
7596          this.text = value;
7597          return this;
7598        }
7599
7600        /**
7601         * @return The note text.
7602         */
7603        public String getText() { 
7604          return this.text == null ? null : this.text.getValue();
7605        }
7606
7607        /**
7608         * @param value The note text.
7609         */
7610        public NotesComponent setText(String value) { 
7611          if (Utilities.noString(value))
7612            this.text = null;
7613          else {
7614            if (this.text == null)
7615              this.text = new StringType();
7616            this.text.setValue(value);
7617          }
7618          return this;
7619        }
7620
7621        protected void listChildren(List<Property> childrenList) {
7622          super.listChildren(childrenList);
7623          childrenList.add(new Property("number", "positiveInt", "An integer associated with each note which may be referred to from each service line item.", 0, java.lang.Integer.MAX_VALUE, number));
7624          childrenList.add(new Property("type", "Coding", "The note purpose: Print/Display.", 0, java.lang.Integer.MAX_VALUE, type));
7625          childrenList.add(new Property("text", "string", "The note text.", 0, java.lang.Integer.MAX_VALUE, text));
7626        }
7627
7628      @Override
7629      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7630        switch (hash) {
7631        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
7632        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
7633        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
7634        default: return super.getProperty(hash, name, checkValid);
7635        }
7636
7637      }
7638
7639      @Override
7640      public void setProperty(int hash, String name, Base value) throws FHIRException {
7641        switch (hash) {
7642        case -1034364087: // number
7643          this.number = castToPositiveInt(value); // PositiveIntType
7644          break;
7645        case 3575610: // type
7646          this.type = castToCoding(value); // Coding
7647          break;
7648        case 3556653: // text
7649          this.text = castToString(value); // StringType
7650          break;
7651        default: super.setProperty(hash, name, value);
7652        }
7653
7654      }
7655
7656      @Override
7657      public void setProperty(String name, Base value) throws FHIRException {
7658        if (name.equals("number"))
7659          this.number = castToPositiveInt(value); // PositiveIntType
7660        else if (name.equals("type"))
7661          this.type = castToCoding(value); // Coding
7662        else if (name.equals("text"))
7663          this.text = castToString(value); // StringType
7664        else
7665          super.setProperty(name, value);
7666      }
7667
7668      @Override
7669      public Base makeProperty(int hash, String name) throws FHIRException {
7670        switch (hash) {
7671        case -1034364087: throw new FHIRException("Cannot make property number as it is not a complex type"); // PositiveIntType
7672        case 3575610:  return getType(); // Coding
7673        case 3556653: throw new FHIRException("Cannot make property text as it is not a complex type"); // StringType
7674        default: return super.makeProperty(hash, name);
7675        }
7676
7677      }
7678
7679      @Override
7680      public Base addChild(String name) throws FHIRException {
7681        if (name.equals("number")) {
7682          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
7683        }
7684        else if (name.equals("type")) {
7685          this.type = new Coding();
7686          return this.type;
7687        }
7688        else if (name.equals("text")) {
7689          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
7690        }
7691        else
7692          return super.addChild(name);
7693      }
7694
7695      public NotesComponent copy() {
7696        NotesComponent dst = new NotesComponent();
7697        copyValues(dst);
7698        dst.number = number == null ? null : number.copy();
7699        dst.type = type == null ? null : type.copy();
7700        dst.text = text == null ? null : text.copy();
7701        return dst;
7702      }
7703
7704      @Override
7705      public boolean equalsDeep(Base other) {
7706        if (!super.equalsDeep(other))
7707          return false;
7708        if (!(other instanceof NotesComponent))
7709          return false;
7710        NotesComponent o = (NotesComponent) other;
7711        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
7712          ;
7713      }
7714
7715      @Override
7716      public boolean equalsShallow(Base other) {
7717        if (!super.equalsShallow(other))
7718          return false;
7719        if (!(other instanceof NotesComponent))
7720          return false;
7721        NotesComponent o = (NotesComponent) other;
7722        return compareValues(number, o.number, true) && compareValues(text, o.text, true);
7723      }
7724
7725      public boolean isEmpty() {
7726        return super.isEmpty() && (number == null || number.isEmpty()) && (type == null || type.isEmpty())
7727           && (text == null || text.isEmpty());
7728      }
7729
7730  public String fhirType() {
7731    return "ExplanationOfBenefit.note";
7732
7733  }
7734
7735  }
7736
7737    @Block()
7738    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
7739        /**
7740         * Dental, Vision, Medical, Pharmacy, Rehab etc.
7741         */
7742        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
7743        @Description(shortDefinition="Benefit Category", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
7744        protected Coding category;
7745
7746        /**
7747         * Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.
7748         */
7749        @Child(name = "subCategory", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
7750        @Description(shortDefinition="Benefit SubCategory", formalDefinition="Dental: basic, major, ortho; Vision exam, glasses, contacts; etc." )
7751        protected Coding subCategory;
7752
7753        /**
7754         * Network designation.
7755         */
7756        @Child(name = "network", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
7757        @Description(shortDefinition="In or out of network", formalDefinition="Network designation." )
7758        protected Coding network;
7759
7760        /**
7761         * Unit designation: individual or family.
7762         */
7763        @Child(name = "unit", type = {Coding.class}, order=4, min=0, max=1, modifier=false, summary=true)
7764        @Description(shortDefinition="Individual or family", formalDefinition="Unit designation: individual or family." )
7765        protected Coding unit;
7766
7767        /**
7768         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.
7769         */
7770        @Child(name = "term", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
7771        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'." )
7772        protected Coding term;
7773
7774        /**
7775         * Benefits Used to date.
7776         */
7777        @Child(name = "financial", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
7778        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
7779        protected List<BenefitComponent> financial;
7780
7781        private static final long serialVersionUID = 1708176773L;
7782
7783    /**
7784     * Constructor
7785     */
7786      public BenefitBalanceComponent() {
7787        super();
7788      }
7789
7790    /**
7791     * Constructor
7792     */
7793      public BenefitBalanceComponent(Coding category) {
7794        super();
7795        this.category = category;
7796      }
7797
7798        /**
7799         * @return {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
7800         */
7801        public Coding getCategory() { 
7802          if (this.category == null)
7803            if (Configuration.errorOnAutoCreate())
7804              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
7805            else if (Configuration.doAutoCreate())
7806              this.category = new Coding(); // cc
7807          return this.category;
7808        }
7809
7810        public boolean hasCategory() { 
7811          return this.category != null && !this.category.isEmpty();
7812        }
7813
7814        /**
7815         * @param value {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
7816         */
7817        public BenefitBalanceComponent setCategory(Coding value) { 
7818          this.category = value;
7819          return this;
7820        }
7821
7822        /**
7823         * @return {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
7824         */
7825        public Coding getSubCategory() { 
7826          if (this.subCategory == null)
7827            if (Configuration.errorOnAutoCreate())
7828              throw new Error("Attempt to auto-create BenefitBalanceComponent.subCategory");
7829            else if (Configuration.doAutoCreate())
7830              this.subCategory = new Coding(); // cc
7831          return this.subCategory;
7832        }
7833
7834        public boolean hasSubCategory() { 
7835          return this.subCategory != null && !this.subCategory.isEmpty();
7836        }
7837
7838        /**
7839         * @param value {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
7840         */
7841        public BenefitBalanceComponent setSubCategory(Coding value) { 
7842          this.subCategory = value;
7843          return this;
7844        }
7845
7846        /**
7847         * @return {@link #network} (Network designation.)
7848         */
7849        public Coding getNetwork() { 
7850          if (this.network == null)
7851            if (Configuration.errorOnAutoCreate())
7852              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
7853            else if (Configuration.doAutoCreate())
7854              this.network = new Coding(); // cc
7855          return this.network;
7856        }
7857
7858        public boolean hasNetwork() { 
7859          return this.network != null && !this.network.isEmpty();
7860        }
7861
7862        /**
7863         * @param value {@link #network} (Network designation.)
7864         */
7865        public BenefitBalanceComponent setNetwork(Coding value) { 
7866          this.network = value;
7867          return this;
7868        }
7869
7870        /**
7871         * @return {@link #unit} (Unit designation: individual or family.)
7872         */
7873        public Coding getUnit() { 
7874          if (this.unit == null)
7875            if (Configuration.errorOnAutoCreate())
7876              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
7877            else if (Configuration.doAutoCreate())
7878              this.unit = new Coding(); // cc
7879          return this.unit;
7880        }
7881
7882        public boolean hasUnit() { 
7883          return this.unit != null && !this.unit.isEmpty();
7884        }
7885
7886        /**
7887         * @param value {@link #unit} (Unit designation: individual or family.)
7888         */
7889        public BenefitBalanceComponent setUnit(Coding value) { 
7890          this.unit = value;
7891          return this;
7892        }
7893
7894        /**
7895         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
7896         */
7897        public Coding getTerm() { 
7898          if (this.term == null)
7899            if (Configuration.errorOnAutoCreate())
7900              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
7901            else if (Configuration.doAutoCreate())
7902              this.term = new Coding(); // cc
7903          return this.term;
7904        }
7905
7906        public boolean hasTerm() { 
7907          return this.term != null && !this.term.isEmpty();
7908        }
7909
7910        /**
7911         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
7912         */
7913        public BenefitBalanceComponent setTerm(Coding value) { 
7914          this.term = value;
7915          return this;
7916        }
7917
7918        /**
7919         * @return {@link #financial} (Benefits Used to date.)
7920         */
7921        public List<BenefitComponent> getFinancial() { 
7922          if (this.financial == null)
7923            this.financial = new ArrayList<BenefitComponent>();
7924          return this.financial;
7925        }
7926
7927        public boolean hasFinancial() { 
7928          if (this.financial == null)
7929            return false;
7930          for (BenefitComponent item : this.financial)
7931            if (!item.isEmpty())
7932              return true;
7933          return false;
7934        }
7935
7936        /**
7937         * @return {@link #financial} (Benefits Used to date.)
7938         */
7939    // syntactic sugar
7940        public BenefitComponent addFinancial() { //3
7941          BenefitComponent t = new BenefitComponent();
7942          if (this.financial == null)
7943            this.financial = new ArrayList<BenefitComponent>();
7944          this.financial.add(t);
7945          return t;
7946        }
7947
7948    // syntactic sugar
7949        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
7950          if (t == null)
7951            return this;
7952          if (this.financial == null)
7953            this.financial = new ArrayList<BenefitComponent>();
7954          this.financial.add(t);
7955          return this;
7956        }
7957
7958        protected void listChildren(List<Property> childrenList) {
7959          super.listChildren(childrenList);
7960          childrenList.add(new Property("category", "Coding", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, java.lang.Integer.MAX_VALUE, category));
7961          childrenList.add(new Property("subCategory", "Coding", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, java.lang.Integer.MAX_VALUE, subCategory));
7962          childrenList.add(new Property("network", "Coding", "Network designation.", 0, java.lang.Integer.MAX_VALUE, network));
7963          childrenList.add(new Property("unit", "Coding", "Unit designation: individual or family.", 0, java.lang.Integer.MAX_VALUE, unit));
7964          childrenList.add(new Property("term", "Coding", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.", 0, java.lang.Integer.MAX_VALUE, term));
7965          childrenList.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
7966        }
7967
7968      @Override
7969      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7970        switch (hash) {
7971        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
7972        case 1365024606: /*subCategory*/ return this.subCategory == null ? new Base[0] : new Base[] {this.subCategory}; // Coding
7973        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // Coding
7974        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // Coding
7975        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // Coding
7976        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
7977        default: return super.getProperty(hash, name, checkValid);
7978        }
7979
7980      }
7981
7982      @Override
7983      public void setProperty(int hash, String name, Base value) throws FHIRException {
7984        switch (hash) {
7985        case 50511102: // category
7986          this.category = castToCoding(value); // Coding
7987          break;
7988        case 1365024606: // subCategory
7989          this.subCategory = castToCoding(value); // Coding
7990          break;
7991        case 1843485230: // network
7992          this.network = castToCoding(value); // Coding
7993          break;
7994        case 3594628: // unit
7995          this.unit = castToCoding(value); // Coding
7996          break;
7997        case 3556460: // term
7998          this.term = castToCoding(value); // Coding
7999          break;
8000        case 357555337: // financial
8001          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
8002          break;
8003        default: super.setProperty(hash, name, value);
8004        }
8005
8006      }
8007
8008      @Override
8009      public void setProperty(String name, Base value) throws FHIRException {
8010        if (name.equals("category"))
8011          this.category = castToCoding(value); // Coding
8012        else if (name.equals("subCategory"))
8013          this.subCategory = castToCoding(value); // Coding
8014        else if (name.equals("network"))
8015          this.network = castToCoding(value); // Coding
8016        else if (name.equals("unit"))
8017          this.unit = castToCoding(value); // Coding
8018        else if (name.equals("term"))
8019          this.term = castToCoding(value); // Coding
8020        else if (name.equals("financial"))
8021          this.getFinancial().add((BenefitComponent) value);
8022        else
8023          super.setProperty(name, value);
8024      }
8025
8026      @Override
8027      public Base makeProperty(int hash, String name) throws FHIRException {
8028        switch (hash) {
8029        case 50511102:  return getCategory(); // Coding
8030        case 1365024606:  return getSubCategory(); // Coding
8031        case 1843485230:  return getNetwork(); // Coding
8032        case 3594628:  return getUnit(); // Coding
8033        case 3556460:  return getTerm(); // Coding
8034        case 357555337:  return addFinancial(); // BenefitComponent
8035        default: return super.makeProperty(hash, name);
8036        }
8037
8038      }
8039
8040      @Override
8041      public Base addChild(String name) throws FHIRException {
8042        if (name.equals("category")) {
8043          this.category = new Coding();
8044          return this.category;
8045        }
8046        else if (name.equals("subCategory")) {
8047          this.subCategory = new Coding();
8048          return this.subCategory;
8049        }
8050        else if (name.equals("network")) {
8051          this.network = new Coding();
8052          return this.network;
8053        }
8054        else if (name.equals("unit")) {
8055          this.unit = new Coding();
8056          return this.unit;
8057        }
8058        else if (name.equals("term")) {
8059          this.term = new Coding();
8060          return this.term;
8061        }
8062        else if (name.equals("financial")) {
8063          return addFinancial();
8064        }
8065        else
8066          return super.addChild(name);
8067      }
8068
8069      public BenefitBalanceComponent copy() {
8070        BenefitBalanceComponent dst = new BenefitBalanceComponent();
8071        copyValues(dst);
8072        dst.category = category == null ? null : category.copy();
8073        dst.subCategory = subCategory == null ? null : subCategory.copy();
8074        dst.network = network == null ? null : network.copy();
8075        dst.unit = unit == null ? null : unit.copy();
8076        dst.term = term == null ? null : term.copy();
8077        if (financial != null) {
8078          dst.financial = new ArrayList<BenefitComponent>();
8079          for (BenefitComponent i : financial)
8080            dst.financial.add(i.copy());
8081        };
8082        return dst;
8083      }
8084
8085      @Override
8086      public boolean equalsDeep(Base other) {
8087        if (!super.equalsDeep(other))
8088          return false;
8089        if (!(other instanceof BenefitBalanceComponent))
8090          return false;
8091        BenefitBalanceComponent o = (BenefitBalanceComponent) other;
8092        return compareDeep(category, o.category, true) && compareDeep(subCategory, o.subCategory, true)
8093           && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
8094           && compareDeep(financial, o.financial, true);
8095      }
8096
8097      @Override
8098      public boolean equalsShallow(Base other) {
8099        if (!super.equalsShallow(other))
8100          return false;
8101        if (!(other instanceof BenefitBalanceComponent))
8102          return false;
8103        BenefitBalanceComponent o = (BenefitBalanceComponent) other;
8104        return true;
8105      }
8106
8107      public boolean isEmpty() {
8108        return super.isEmpty() && (category == null || category.isEmpty()) && (subCategory == null || subCategory.isEmpty())
8109           && (network == null || network.isEmpty()) && (unit == null || unit.isEmpty()) && (term == null || term.isEmpty())
8110           && (financial == null || financial.isEmpty());
8111      }
8112
8113  public String fhirType() {
8114    return "ExplanationOfBenefit.benefitBalance";
8115
8116  }
8117
8118  }
8119
8120    @Block()
8121    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
8122        /**
8123         * Deductable, visits, benefit amount.
8124         */
8125        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
8126        @Description(shortDefinition="Deductable, visits, benefit amount", formalDefinition="Deductable, visits, benefit amount." )
8127        protected Coding type;
8128
8129        /**
8130         * Benefits allowed.
8131         */
8132        @Child(name = "benefit", type = {UnsignedIntType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=true)
8133        @Description(shortDefinition="Benefits allowed", formalDefinition="Benefits allowed." )
8134        protected Type benefit;
8135
8136        /**
8137         * Benefits used.
8138         */
8139        @Child(name = "benefitUsed", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
8140        @Description(shortDefinition="Benefits used", formalDefinition="Benefits used." )
8141        protected Type benefitUsed;
8142
8143        private static final long serialVersionUID = 1742418909L;
8144
8145    /**
8146     * Constructor
8147     */
8148      public BenefitComponent() {
8149        super();
8150      }
8151
8152    /**
8153     * Constructor
8154     */
8155      public BenefitComponent(Coding type) {
8156        super();
8157        this.type = type;
8158      }
8159
8160        /**
8161         * @return {@link #type} (Deductable, visits, benefit amount.)
8162         */
8163        public Coding getType() { 
8164          if (this.type == null)
8165            if (Configuration.errorOnAutoCreate())
8166              throw new Error("Attempt to auto-create BenefitComponent.type");
8167            else if (Configuration.doAutoCreate())
8168              this.type = new Coding(); // cc
8169          return this.type;
8170        }
8171
8172        public boolean hasType() { 
8173          return this.type != null && !this.type.isEmpty();
8174        }
8175
8176        /**
8177         * @param value {@link #type} (Deductable, visits, benefit amount.)
8178         */
8179        public BenefitComponent setType(Coding value) { 
8180          this.type = value;
8181          return this;
8182        }
8183
8184        /**
8185         * @return {@link #benefit} (Benefits allowed.)
8186         */
8187        public Type getBenefit() { 
8188          return this.benefit;
8189        }
8190
8191        /**
8192         * @return {@link #benefit} (Benefits allowed.)
8193         */
8194        public UnsignedIntType getBenefitUnsignedIntType() throws FHIRException { 
8195          if (!(this.benefit instanceof UnsignedIntType))
8196            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.benefit.getClass().getName()+" was encountered");
8197          return (UnsignedIntType) this.benefit;
8198        }
8199
8200        public boolean hasBenefitUnsignedIntType() { 
8201          return this.benefit instanceof UnsignedIntType;
8202        }
8203
8204        /**
8205         * @return {@link #benefit} (Benefits allowed.)
8206         */
8207        public Money getBenefitMoney() throws FHIRException { 
8208          if (!(this.benefit instanceof Money))
8209            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.benefit.getClass().getName()+" was encountered");
8210          return (Money) this.benefit;
8211        }
8212
8213        public boolean hasBenefitMoney() { 
8214          return this.benefit instanceof Money;
8215        }
8216
8217        public boolean hasBenefit() { 
8218          return this.benefit != null && !this.benefit.isEmpty();
8219        }
8220
8221        /**
8222         * @param value {@link #benefit} (Benefits allowed.)
8223         */
8224        public BenefitComponent setBenefit(Type value) { 
8225          this.benefit = value;
8226          return this;
8227        }
8228
8229        /**
8230         * @return {@link #benefitUsed} (Benefits used.)
8231         */
8232        public Type getBenefitUsed() { 
8233          return this.benefitUsed;
8234        }
8235
8236        /**
8237         * @return {@link #benefitUsed} (Benefits used.)
8238         */
8239        public UnsignedIntType getBenefitUsedUnsignedIntType() throws FHIRException { 
8240          if (!(this.benefitUsed instanceof UnsignedIntType))
8241            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.benefitUsed.getClass().getName()+" was encountered");
8242          return (UnsignedIntType) this.benefitUsed;
8243        }
8244
8245        public boolean hasBenefitUsedUnsignedIntType() { 
8246          return this.benefitUsed instanceof UnsignedIntType;
8247        }
8248
8249        /**
8250         * @return {@link #benefitUsed} (Benefits used.)
8251         */
8252        public Money getBenefitUsedMoney() throws FHIRException { 
8253          if (!(this.benefitUsed instanceof Money))
8254            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.benefitUsed.getClass().getName()+" was encountered");
8255          return (Money) this.benefitUsed;
8256        }
8257
8258        public boolean hasBenefitUsedMoney() { 
8259          return this.benefitUsed instanceof Money;
8260        }
8261
8262        public boolean hasBenefitUsed() { 
8263          return this.benefitUsed != null && !this.benefitUsed.isEmpty();
8264        }
8265
8266        /**
8267         * @param value {@link #benefitUsed} (Benefits used.)
8268         */
8269        public BenefitComponent setBenefitUsed(Type value) { 
8270          this.benefitUsed = value;
8271          return this;
8272        }
8273
8274        protected void listChildren(List<Property> childrenList) {
8275          super.listChildren(childrenList);
8276          childrenList.add(new Property("type", "Coding", "Deductable, visits, benefit amount.", 0, java.lang.Integer.MAX_VALUE, type));
8277          childrenList.add(new Property("benefit[x]", "unsignedInt|Money", "Benefits allowed.", 0, java.lang.Integer.MAX_VALUE, benefit));
8278          childrenList.add(new Property("benefitUsed[x]", "unsignedInt|Money", "Benefits used.", 0, java.lang.Integer.MAX_VALUE, benefitUsed));
8279        }
8280
8281      @Override
8282      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8283        switch (hash) {
8284        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
8285        case -222710633: /*benefit*/ return this.benefit == null ? new Base[0] : new Base[] {this.benefit}; // Type
8286        case -549981964: /*benefitUsed*/ return this.benefitUsed == null ? new Base[0] : new Base[] {this.benefitUsed}; // Type
8287        default: return super.getProperty(hash, name, checkValid);
8288        }
8289
8290      }
8291
8292      @Override
8293      public void setProperty(int hash, String name, Base value) throws FHIRException {
8294        switch (hash) {
8295        case 3575610: // type
8296          this.type = castToCoding(value); // Coding
8297          break;
8298        case -222710633: // benefit
8299          this.benefit = (Type) value; // Type
8300          break;
8301        case -549981964: // benefitUsed
8302          this.benefitUsed = (Type) value; // Type
8303          break;
8304        default: super.setProperty(hash, name, value);
8305        }
8306
8307      }
8308
8309      @Override
8310      public void setProperty(String name, Base value) throws FHIRException {
8311        if (name.equals("type"))
8312          this.type = castToCoding(value); // Coding
8313        else if (name.equals("benefit[x]"))
8314          this.benefit = (Type) value; // Type
8315        else if (name.equals("benefitUsed[x]"))
8316          this.benefitUsed = (Type) value; // Type
8317        else
8318          super.setProperty(name, value);
8319      }
8320
8321      @Override
8322      public Base makeProperty(int hash, String name) throws FHIRException {
8323        switch (hash) {
8324        case 3575610:  return getType(); // Coding
8325        case 952095881:  return getBenefit(); // Type
8326        case 787635980:  return getBenefitUsed(); // Type
8327        default: return super.makeProperty(hash, name);
8328        }
8329
8330      }
8331
8332      @Override
8333      public Base addChild(String name) throws FHIRException {
8334        if (name.equals("type")) {
8335          this.type = new Coding();
8336          return this.type;
8337        }
8338        else if (name.equals("benefitUnsignedInt")) {
8339          this.benefit = new UnsignedIntType();
8340          return this.benefit;
8341        }
8342        else if (name.equals("benefitMoney")) {
8343          this.benefit = new Money();
8344          return this.benefit;
8345        }
8346        else if (name.equals("benefitUsedUnsignedInt")) {
8347          this.benefitUsed = new UnsignedIntType();
8348          return this.benefitUsed;
8349        }
8350        else if (name.equals("benefitUsedMoney")) {
8351          this.benefitUsed = new Money();
8352          return this.benefitUsed;
8353        }
8354        else
8355          return super.addChild(name);
8356      }
8357
8358      public BenefitComponent copy() {
8359        BenefitComponent dst = new BenefitComponent();
8360        copyValues(dst);
8361        dst.type = type == null ? null : type.copy();
8362        dst.benefit = benefit == null ? null : benefit.copy();
8363        dst.benefitUsed = benefitUsed == null ? null : benefitUsed.copy();
8364        return dst;
8365      }
8366
8367      @Override
8368      public boolean equalsDeep(Base other) {
8369        if (!super.equalsDeep(other))
8370          return false;
8371        if (!(other instanceof BenefitComponent))
8372          return false;
8373        BenefitComponent o = (BenefitComponent) other;
8374        return compareDeep(type, o.type, true) && compareDeep(benefit, o.benefit, true) && compareDeep(benefitUsed, o.benefitUsed, true)
8375          ;
8376      }
8377
8378      @Override
8379      public boolean equalsShallow(Base other) {
8380        if (!super.equalsShallow(other))
8381          return false;
8382        if (!(other instanceof BenefitComponent))
8383          return false;
8384        BenefitComponent o = (BenefitComponent) other;
8385        return true;
8386      }
8387
8388      public boolean isEmpty() {
8389        return super.isEmpty() && (type == null || type.isEmpty()) && (benefit == null || benefit.isEmpty())
8390           && (benefitUsed == null || benefitUsed.isEmpty());
8391      }
8392
8393  public String fhirType() {
8394    return "ExplanationOfBenefit.benefitBalance.financial";
8395
8396  }
8397
8398  }
8399
8400    /**
8401     * The Response Business Identifier.
8402     */
8403    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8404    @Description(shortDefinition="Business Identifier", formalDefinition="The Response Business Identifier." )
8405    protected List<Identifier> identifier;
8406
8407    /**
8408     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
8409     */
8410    @Child(name = "claim", type = {Identifier.class, Claim.class}, order=1, min=0, max=1, modifier=false, summary=true)
8411    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
8412    protected Type claim;
8413
8414    /**
8415     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
8416     */
8417    @Child(name = "claimResponse", type = {Identifier.class, ClaimResponse.class}, order=2, min=0, max=1, modifier=false, summary=true)
8418    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
8419    protected Type claimResponse;
8420
8421    /**
8422     * A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.
8423     */
8424    @Child(name = "subType", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8425    @Description(shortDefinition="Finer grained claim type information", formalDefinition="A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType." )
8426    protected List<Coding> subType;
8427
8428    /**
8429     * The version of the specification on which this instance relies.
8430     */
8431    @Child(name = "ruleset", type = {Coding.class}, order=4, min=0, max=1, modifier=false, summary=true)
8432    @Description(shortDefinition="Current specification followed", formalDefinition="The version of the specification on which this instance relies." )
8433    protected Coding ruleset;
8434
8435    /**
8436     * The version of the specification from which the original instance was created.
8437     */
8438    @Child(name = "originalRuleset", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
8439    @Description(shortDefinition="Original specification followed", formalDefinition="The version of the specification from which the original instance was created." )
8440    protected Coding originalRuleset;
8441
8442    /**
8443     * The date when the EOB was created.
8444     */
8445    @Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
8446    @Description(shortDefinition="Creation date", formalDefinition="The date when the EOB was created." )
8447    protected DateTimeType created;
8448
8449    /**
8450     * The billable period for which charges are being submitted.
8451     */
8452    @Child(name = "billablePeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
8453    @Description(shortDefinition="Period for charge submission", formalDefinition="The billable period for which charges are being submitted." )
8454    protected Period billablePeriod;
8455
8456    /**
8457     * A description of the status of the adjudication.
8458     */
8459    @Child(name = "disposition", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
8460    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
8461    protected StringType disposition;
8462
8463    /**
8464     * The provider which is responsible for the claim.
8465     */
8466    @Child(name = "provider", type = {Identifier.class, Practitioner.class}, order=9, min=0, max=1, modifier=false, summary=true)
8467    @Description(shortDefinition="Responsible provider for the claim", formalDefinition="The provider which is responsible for the claim." )
8468    protected Type provider;
8469
8470    /**
8471     * The provider which is responsible for the claim.
8472     */
8473    @Child(name = "organization", type = {Identifier.class, Organization.class}, order=10, min=0, max=1, modifier=false, summary=true)
8474    @Description(shortDefinition="Responsible organization for the claim", formalDefinition="The provider which is responsible for the claim." )
8475    protected Type organization;
8476
8477    /**
8478     * Facility where the services were provided.
8479     */
8480    @Child(name = "facility", type = {Identifier.class, Location.class}, order=11, min=0, max=1, modifier=false, summary=true)
8481    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
8482    protected Type facility;
8483
8484    /**
8485     * Other claims which are related to this claim such as prior claim versions or for related services.
8486     */
8487    @Child(name = "related", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8488    @Description(shortDefinition="Related Claims which may be revelant to processing this claimn", formalDefinition="Other claims which are related to this claim such as prior claim versions or for related services." )
8489    protected List<RelatedClaimsComponent> related;
8490
8491    /**
8492     * Prescription to support the dispensing of Pharmacy or Vision products.
8493     */
8494    @Child(name = "prescription", type = {Identifier.class, MedicationOrder.class, VisionPrescription.class}, order=13, min=0, max=1, modifier=false, summary=true)
8495    @Description(shortDefinition="Prescription", formalDefinition="Prescription to support the dispensing of Pharmacy or Vision products." )
8496    protected Type prescription;
8497
8498    /**
8499     * Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.
8500     */
8501    @Child(name = "originalPrescription", type = {Identifier.class, MedicationOrder.class}, order=14, min=0, max=1, modifier=false, summary=true)
8502    @Description(shortDefinition="Original Prescription", formalDefinition="Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products." )
8503    protected Type originalPrescription;
8504
8505    /**
8506     * The party to be reimbursed for the services.
8507     */
8508    @Child(name = "payee", type = {}, order=15, min=0, max=1, modifier=false, summary=true)
8509    @Description(shortDefinition="Payee", formalDefinition="The party to be reimbursed for the services." )
8510    protected PayeeComponent payee;
8511
8512    /**
8513     * The referral resource which lists the date, practitioner, reason and other supporting information.
8514     */
8515    @Child(name = "referral", type = {Identifier.class, ReferralRequest.class}, order=16, min=0, max=1, modifier=false, summary=true)
8516    @Description(shortDefinition="Treatment Referral", formalDefinition="The referral resource which lists the date, practitioner, reason and other supporting information." )
8517    protected Type referral;
8518
8519    /**
8520     * **Insert definition of Occurrence codes.
8521     */
8522    @Child(name = "occurrenceCode", type = {Coding.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8523    @Description(shortDefinition="Occurrence Codes", formalDefinition="**Insert definition of Occurrence codes." )
8524    protected List<Coding> occurrenceCode;
8525
8526    /**
8527     * **Insert definition of Occurrence Span codes.
8528     */
8529    @Child(name = "occurenceSpanCode", type = {Coding.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8530    @Description(shortDefinition="Occurrence Span Codes", formalDefinition="**Insert definition of Occurrence Span codes." )
8531    protected List<Coding> occurenceSpanCode;
8532
8533    /**
8534     * **Insert definition of Value codes.
8535     */
8536    @Child(name = "valueCode", type = {Coding.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8537    @Description(shortDefinition="Value Codes", formalDefinition="**Insert definition of Value codes." )
8538    protected List<Coding> valueCode;
8539
8540    /**
8541     * Ordered list of patient diagnosis for which care is sought.
8542     */
8543    @Child(name = "diagnosis", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8544    @Description(shortDefinition="Diagnosis", formalDefinition="Ordered list of patient diagnosis for which care is sought." )
8545    protected List<DiagnosisComponent> diagnosis;
8546
8547    /**
8548     * Ordered list of patient procedures performed to support the adjudication.
8549     */
8550    @Child(name = "procedure", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8551    @Description(shortDefinition="Procedures performed", formalDefinition="Ordered list of patient procedures performed to support the adjudication." )
8552    protected List<ProcedureComponent> procedure;
8553
8554    /**
8555     * List of special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.
8556     */
8557    @Child(name = "specialCondition", type = {Coding.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8558    @Description(shortDefinition="List of special Conditions", formalDefinition="List of special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication." )
8559    protected List<Coding> specialCondition;
8560
8561    /**
8562     * Patient Resource.
8563     */
8564    @Child(name = "patient", type = {Identifier.class, Patient.class}, order=23, min=1, max=1, modifier=false, summary=true)
8565    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
8566    protected Type patient;
8567
8568    /**
8569     * Precedence (primary, secondary, etc.).
8570     */
8571    @Child(name = "precedence", type = {PositiveIntType.class}, order=24, min=0, max=1, modifier=false, summary=true)
8572    @Description(shortDefinition="Precedence (primary, secondary, etc.)", formalDefinition="Precedence (primary, secondary, etc.)." )
8573    protected PositiveIntType precedence;
8574
8575    /**
8576     * Financial instrument by which payment information for health care.
8577     */
8578    @Child(name = "coverage", type = {}, order=25, min=1, max=1, modifier=false, summary=true)
8579    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
8580    protected CoverageComponent coverage;
8581
8582    /**
8583     * Date of an accident which these services are addressing.
8584     */
8585    @Child(name = "accidentDate", type = {DateType.class}, order=26, min=0, max=1, modifier=false, summary=true)
8586    @Description(shortDefinition="When the accident occurred", formalDefinition="Date of an accident which these services are addressing." )
8587    protected DateType accidentDate;
8588
8589    /**
8590     * Type of accident: work, auto, etc.
8591     */
8592    @Child(name = "accidentType", type = {Coding.class}, order=27, min=0, max=1, modifier=false, summary=true)
8593    @Description(shortDefinition="The nature of the accident", formalDefinition="Type of accident: work, auto, etc." )
8594    protected Coding accidentType;
8595
8596    /**
8597     * Accident Place.
8598     */
8599    @Child(name = "accidentLocation", type = {Address.class, Location.class}, order=28, min=0, max=1, modifier=false, summary=true)
8600    @Description(shortDefinition="Accident Place", formalDefinition="Accident Place." )
8601    protected Type accidentLocation;
8602
8603    /**
8604     * A list of intervention and exception codes which may influence the adjudication of the claim.
8605     */
8606    @Child(name = "interventionException", type = {Coding.class}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8607    @Description(shortDefinition="Intervention and exception code (Pharma)", formalDefinition="A list of intervention and exception codes which may influence the adjudication of the claim." )
8608    protected List<Coding> interventionException;
8609
8610    /**
8611     * Period, start and last dates of aspects of the Condition or related services.
8612     */
8613    @Child(name = "onset", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8614    @Description(shortDefinition="Condition related Onset related dates and codes", formalDefinition="Period, start and last dates of aspects of the Condition or related services." )
8615    protected List<OnsetComponent> onset;
8616
8617    /**
8618     * The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).
8619     */
8620    @Child(name = "employmentImpacted", type = {Period.class}, order=31, min=0, max=1, modifier=false, summary=true)
8621    @Description(shortDefinition="Period unable to work", formalDefinition="The start and optional end dates of when the patient was precluded from working due to the treatable condition(s)." )
8622    protected Period employmentImpacted;
8623
8624    /**
8625     * The start and optional end dates of when the patient was confined to a treatment center.
8626     */
8627    @Child(name = "hospitalization", type = {Period.class}, order=32, min=0, max=1, modifier=false, summary=true)
8628    @Description(shortDefinition="Period in hospital", formalDefinition="The start and optional end dates of when the patient was confined to a treatment center." )
8629    protected Period hospitalization;
8630
8631    /**
8632     * First tier of goods and services.
8633     */
8634    @Child(name = "item", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8635    @Description(shortDefinition="Goods and Services", formalDefinition="First tier of goods and services." )
8636    protected List<ItemsComponent> item;
8637
8638    /**
8639     * The first tier service adjudications for payor added services.
8640     */
8641    @Child(name = "addItem", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8642    @Description(shortDefinition="Insurer added line items", formalDefinition="The first tier service adjudications for payor added services." )
8643    protected List<AddedItemComponent> addItem;
8644
8645    /**
8646     * A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons.
8647     */
8648    @Child(name = "missingTeeth", type = {}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8649    @Description(shortDefinition="Only if type = oral", formalDefinition="A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons." )
8650    protected List<MissingTeethComponent> missingTeeth;
8651
8652    /**
8653     * The total cost of the services reported.
8654     */
8655    @Child(name = "totalCost", type = {Money.class}, order=36, min=0, max=1, modifier=false, summary=true)
8656    @Description(shortDefinition="Total Cost of service from the Claim", formalDefinition="The total cost of the services reported." )
8657    protected Money totalCost;
8658
8659    /**
8660     * The amount of deductable applied which was not allocated to any particular service line.
8661     */
8662    @Child(name = "unallocDeductable", type = {Money.class}, order=37, min=0, max=1, modifier=false, summary=true)
8663    @Description(shortDefinition="Unallocated deductable", formalDefinition="The amount of deductable applied which was not allocated to any particular service line." )
8664    protected Money unallocDeductable;
8665
8666    /**
8667     * Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).
8668     */
8669    @Child(name = "totalBenefit", type = {Money.class}, order=38, min=0, max=1, modifier=false, summary=true)
8670    @Description(shortDefinition="Total benefit payable for the Claim", formalDefinition="Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable)." )
8671    protected Money totalBenefit;
8672
8673    /**
8674     * Adjustment to the payment of this transaction which is not related to adjudication of this transaction.
8675     */
8676    @Child(name = "paymentAdjustment", type = {Money.class}, order=39, min=0, max=1, modifier=false, summary=true)
8677    @Description(shortDefinition="Payment adjustment for non-Claim issues", formalDefinition="Adjustment to the payment of this transaction which is not related to adjudication of this transaction." )
8678    protected Money paymentAdjustment;
8679
8680    /**
8681     * Reason for the payment adjustment.
8682     */
8683    @Child(name = "paymentAdjustmentReason", type = {Coding.class}, order=40, min=0, max=1, modifier=false, summary=true)
8684    @Description(shortDefinition="Reason for Payment adjustment", formalDefinition="Reason for the payment adjustment." )
8685    protected Coding paymentAdjustmentReason;
8686
8687    /**
8688     * Estimated payment data.
8689     */
8690    @Child(name = "paymentDate", type = {DateType.class}, order=41, min=0, max=1, modifier=false, summary=true)
8691    @Description(shortDefinition="Expected data of Payment", formalDefinition="Estimated payment data." )
8692    protected DateType paymentDate;
8693
8694    /**
8695     * Payable less any payment adjustment.
8696     */
8697    @Child(name = "paymentAmount", type = {Money.class}, order=42, min=0, max=1, modifier=false, summary=true)
8698    @Description(shortDefinition="Payment amount", formalDefinition="Payable less any payment adjustment." )
8699    protected Money paymentAmount;
8700
8701    /**
8702     * Payment identifer.
8703     */
8704    @Child(name = "paymentRef", type = {Identifier.class}, order=43, min=0, max=1, modifier=false, summary=true)
8705    @Description(shortDefinition="Payment identifier", formalDefinition="Payment identifer." )
8706    protected Identifier paymentRef;
8707
8708    /**
8709     * Status of funds reservation (For provider, for Patient, None).
8710     */
8711    @Child(name = "reserved", type = {Coding.class}, order=44, min=0, max=1, modifier=false, summary=true)
8712    @Description(shortDefinition="Funds reserved status", formalDefinition="Status of funds reservation (For provider, for Patient, None)." )
8713    protected Coding reserved;
8714
8715    /**
8716     * The form to be used for printing the content.
8717     */
8718    @Child(name = "form", type = {Coding.class}, order=45, min=0, max=1, modifier=false, summary=true)
8719    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
8720    protected Coding form;
8721
8722    /**
8723     * Note text.
8724     */
8725    @Child(name = "note", type = {}, order=46, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8726    @Description(shortDefinition="Processing notes", formalDefinition="Note text." )
8727    protected List<NotesComponent> note;
8728
8729    /**
8730     * Balance by Benefit Category.
8731     */
8732    @Child(name = "benefitBalance", type = {}, order=47, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8733    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
8734    protected List<BenefitBalanceComponent> benefitBalance;
8735
8736    private static final long serialVersionUID = 1781852561L;
8737
8738  /**
8739   * Constructor
8740   */
8741    public ExplanationOfBenefit() {
8742      super();
8743    }
8744
8745  /**
8746   * Constructor
8747   */
8748    public ExplanationOfBenefit(Type patient, CoverageComponent coverage) {
8749      super();
8750      this.patient = patient;
8751      this.coverage = coverage;
8752    }
8753
8754    /**
8755     * @return {@link #identifier} (The Response Business Identifier.)
8756     */
8757    public List<Identifier> getIdentifier() { 
8758      if (this.identifier == null)
8759        this.identifier = new ArrayList<Identifier>();
8760      return this.identifier;
8761    }
8762
8763    public boolean hasIdentifier() { 
8764      if (this.identifier == null)
8765        return false;
8766      for (Identifier item : this.identifier)
8767        if (!item.isEmpty())
8768          return true;
8769      return false;
8770    }
8771
8772    /**
8773     * @return {@link #identifier} (The Response Business Identifier.)
8774     */
8775    // syntactic sugar
8776    public Identifier addIdentifier() { //3
8777      Identifier t = new Identifier();
8778      if (this.identifier == null)
8779        this.identifier = new ArrayList<Identifier>();
8780      this.identifier.add(t);
8781      return t;
8782    }
8783
8784    // syntactic sugar
8785    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
8786      if (t == null)
8787        return this;
8788      if (this.identifier == null)
8789        this.identifier = new ArrayList<Identifier>();
8790      this.identifier.add(t);
8791      return this;
8792    }
8793
8794    /**
8795     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8796     */
8797    public Type getClaim() { 
8798      return this.claim;
8799    }
8800
8801    /**
8802     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8803     */
8804    public Identifier getClaimIdentifier() throws FHIRException { 
8805      if (!(this.claim instanceof Identifier))
8806        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.claim.getClass().getName()+" was encountered");
8807      return (Identifier) this.claim;
8808    }
8809
8810    public boolean hasClaimIdentifier() { 
8811      return this.claim instanceof Identifier;
8812    }
8813
8814    /**
8815     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8816     */
8817    public Reference getClaimReference() throws FHIRException { 
8818      if (!(this.claim instanceof Reference))
8819        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.claim.getClass().getName()+" was encountered");
8820      return (Reference) this.claim;
8821    }
8822
8823    public boolean hasClaimReference() { 
8824      return this.claim instanceof Reference;
8825    }
8826
8827    public boolean hasClaim() { 
8828      return this.claim != null && !this.claim.isEmpty();
8829    }
8830
8831    /**
8832     * @param value {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8833     */
8834    public ExplanationOfBenefit setClaim(Type value) { 
8835      this.claim = value;
8836      return this;
8837    }
8838
8839    /**
8840     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8841     */
8842    public Type getClaimResponse() { 
8843      return this.claimResponse;
8844    }
8845
8846    /**
8847     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8848     */
8849    public Identifier getClaimResponseIdentifier() throws FHIRException { 
8850      if (!(this.claimResponse instanceof Identifier))
8851        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.claimResponse.getClass().getName()+" was encountered");
8852      return (Identifier) this.claimResponse;
8853    }
8854
8855    public boolean hasClaimResponseIdentifier() { 
8856      return this.claimResponse instanceof Identifier;
8857    }
8858
8859    /**
8860     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8861     */
8862    public Reference getClaimResponseReference() throws FHIRException { 
8863      if (!(this.claimResponse instanceof Reference))
8864        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.claimResponse.getClass().getName()+" was encountered");
8865      return (Reference) this.claimResponse;
8866    }
8867
8868    public boolean hasClaimResponseReference() { 
8869      return this.claimResponse instanceof Reference;
8870    }
8871
8872    public boolean hasClaimResponse() { 
8873      return this.claimResponse != null && !this.claimResponse.isEmpty();
8874    }
8875
8876    /**
8877     * @param value {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8878     */
8879    public ExplanationOfBenefit setClaimResponse(Type value) { 
8880      this.claimResponse = value;
8881      return this;
8882    }
8883
8884    /**
8885     * @return {@link #subType} (A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.)
8886     */
8887    public List<Coding> getSubType() { 
8888      if (this.subType == null)
8889        this.subType = new ArrayList<Coding>();
8890      return this.subType;
8891    }
8892
8893    public boolean hasSubType() { 
8894      if (this.subType == null)
8895        return false;
8896      for (Coding item : this.subType)
8897        if (!item.isEmpty())
8898          return true;
8899      return false;
8900    }
8901
8902    /**
8903     * @return {@link #subType} (A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.)
8904     */
8905    // syntactic sugar
8906    public Coding addSubType() { //3
8907      Coding t = new Coding();
8908      if (this.subType == null)
8909        this.subType = new ArrayList<Coding>();
8910      this.subType.add(t);
8911      return t;
8912    }
8913
8914    // syntactic sugar
8915    public ExplanationOfBenefit addSubType(Coding t) { //3
8916      if (t == null)
8917        return this;
8918      if (this.subType == null)
8919        this.subType = new ArrayList<Coding>();
8920      this.subType.add(t);
8921      return this;
8922    }
8923
8924    /**
8925     * @return {@link #ruleset} (The version of the specification on which this instance relies.)
8926     */
8927    public Coding getRuleset() { 
8928      if (this.ruleset == null)
8929        if (Configuration.errorOnAutoCreate())
8930          throw new Error("Attempt to auto-create ExplanationOfBenefit.ruleset");
8931        else if (Configuration.doAutoCreate())
8932          this.ruleset = new Coding(); // cc
8933      return this.ruleset;
8934    }
8935
8936    public boolean hasRuleset() { 
8937      return this.ruleset != null && !this.ruleset.isEmpty();
8938    }
8939
8940    /**
8941     * @param value {@link #ruleset} (The version of the specification on which this instance relies.)
8942     */
8943    public ExplanationOfBenefit setRuleset(Coding value) { 
8944      this.ruleset = value;
8945      return this;
8946    }
8947
8948    /**
8949     * @return {@link #originalRuleset} (The version of the specification from which the original instance was created.)
8950     */
8951    public Coding getOriginalRuleset() { 
8952      if (this.originalRuleset == null)
8953        if (Configuration.errorOnAutoCreate())
8954          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalRuleset");
8955        else if (Configuration.doAutoCreate())
8956          this.originalRuleset = new Coding(); // cc
8957      return this.originalRuleset;
8958    }
8959
8960    public boolean hasOriginalRuleset() { 
8961      return this.originalRuleset != null && !this.originalRuleset.isEmpty();
8962    }
8963
8964    /**
8965     * @param value {@link #originalRuleset} (The version of the specification from which the original instance was created.)
8966     */
8967    public ExplanationOfBenefit setOriginalRuleset(Coding value) { 
8968      this.originalRuleset = value;
8969      return this;
8970    }
8971
8972    /**
8973     * @return {@link #created} (The date when the EOB was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
8974     */
8975    public DateTimeType getCreatedElement() { 
8976      if (this.created == null)
8977        if (Configuration.errorOnAutoCreate())
8978          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
8979        else if (Configuration.doAutoCreate())
8980          this.created = new DateTimeType(); // bb
8981      return this.created;
8982    }
8983
8984    public boolean hasCreatedElement() { 
8985      return this.created != null && !this.created.isEmpty();
8986    }
8987
8988    public boolean hasCreated() { 
8989      return this.created != null && !this.created.isEmpty();
8990    }
8991
8992    /**
8993     * @param value {@link #created} (The date when the EOB was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
8994     */
8995    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
8996      this.created = value;
8997      return this;
8998    }
8999
9000    /**
9001     * @return The date when the EOB was created.
9002     */
9003    public Date getCreated() { 
9004      return this.created == null ? null : this.created.getValue();
9005    }
9006
9007    /**
9008     * @param value The date when the EOB was created.
9009     */
9010    public ExplanationOfBenefit setCreated(Date value) { 
9011      if (value == null)
9012        this.created = null;
9013      else {
9014        if (this.created == null)
9015          this.created = new DateTimeType();
9016        this.created.setValue(value);
9017      }
9018      return this;
9019    }
9020
9021    /**
9022     * @return {@link #billablePeriod} (The billable period for which charges are being submitted.)
9023     */
9024    public Period getBillablePeriod() { 
9025      if (this.billablePeriod == null)
9026        if (Configuration.errorOnAutoCreate())
9027          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
9028        else if (Configuration.doAutoCreate())
9029          this.billablePeriod = new Period(); // cc
9030      return this.billablePeriod;
9031    }
9032
9033    public boolean hasBillablePeriod() { 
9034      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
9035    }
9036
9037    /**
9038     * @param value {@link #billablePeriod} (The billable period for which charges are being submitted.)
9039     */
9040    public ExplanationOfBenefit setBillablePeriod(Period value) { 
9041      this.billablePeriod = value;
9042      return this;
9043    }
9044
9045    /**
9046     * @return {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
9047     */
9048    public StringType getDispositionElement() { 
9049      if (this.disposition == null)
9050        if (Configuration.errorOnAutoCreate())
9051          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
9052        else if (Configuration.doAutoCreate())
9053          this.disposition = new StringType(); // bb
9054      return this.disposition;
9055    }
9056
9057    public boolean hasDispositionElement() { 
9058      return this.disposition != null && !this.disposition.isEmpty();
9059    }
9060
9061    public boolean hasDisposition() { 
9062      return this.disposition != null && !this.disposition.isEmpty();
9063    }
9064
9065    /**
9066     * @param value {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
9067     */
9068    public ExplanationOfBenefit setDispositionElement(StringType value) { 
9069      this.disposition = value;
9070      return this;
9071    }
9072
9073    /**
9074     * @return A description of the status of the adjudication.
9075     */
9076    public String getDisposition() { 
9077      return this.disposition == null ? null : this.disposition.getValue();
9078    }
9079
9080    /**
9081     * @param value A description of the status of the adjudication.
9082     */
9083    public ExplanationOfBenefit setDisposition(String value) { 
9084      if (Utilities.noString(value))
9085        this.disposition = null;
9086      else {
9087        if (this.disposition == null)
9088          this.disposition = new StringType();
9089        this.disposition.setValue(value);
9090      }
9091      return this;
9092    }
9093
9094    /**
9095     * @return {@link #provider} (The provider which is responsible for the claim.)
9096     */
9097    public Type getProvider() { 
9098      return this.provider;
9099    }
9100
9101    /**
9102     * @return {@link #provider} (The provider which is responsible for the claim.)
9103     */
9104    public Identifier getProviderIdentifier() throws FHIRException { 
9105      if (!(this.provider instanceof Identifier))
9106        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.provider.getClass().getName()+" was encountered");
9107      return (Identifier) this.provider;
9108    }
9109
9110    public boolean hasProviderIdentifier() { 
9111      return this.provider instanceof Identifier;
9112    }
9113
9114    /**
9115     * @return {@link #provider} (The provider which is responsible for the claim.)
9116     */
9117    public Reference getProviderReference() throws FHIRException { 
9118      if (!(this.provider instanceof Reference))
9119        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.provider.getClass().getName()+" was encountered");
9120      return (Reference) this.provider;
9121    }
9122
9123    public boolean hasProviderReference() { 
9124      return this.provider instanceof Reference;
9125    }
9126
9127    public boolean hasProvider() { 
9128      return this.provider != null && !this.provider.isEmpty();
9129    }
9130
9131    /**
9132     * @param value {@link #provider} (The provider which is responsible for the claim.)
9133     */
9134    public ExplanationOfBenefit setProvider(Type value) { 
9135      this.provider = value;
9136      return this;
9137    }
9138
9139    /**
9140     * @return {@link #organization} (The provider which is responsible for the claim.)
9141     */
9142    public Type getOrganization() { 
9143      return this.organization;
9144    }
9145
9146    /**
9147     * @return {@link #organization} (The provider which is responsible for the claim.)
9148     */
9149    public Identifier getOrganizationIdentifier() throws FHIRException { 
9150      if (!(this.organization instanceof Identifier))
9151        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.organization.getClass().getName()+" was encountered");
9152      return (Identifier) this.organization;
9153    }
9154
9155    public boolean hasOrganizationIdentifier() { 
9156      return this.organization instanceof Identifier;
9157    }
9158
9159    /**
9160     * @return {@link #organization} (The provider which is responsible for the claim.)
9161     */
9162    public Reference getOrganizationReference() throws FHIRException { 
9163      if (!(this.organization instanceof Reference))
9164        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.organization.getClass().getName()+" was encountered");
9165      return (Reference) this.organization;
9166    }
9167
9168    public boolean hasOrganizationReference() { 
9169      return this.organization instanceof Reference;
9170    }
9171
9172    public boolean hasOrganization() { 
9173      return this.organization != null && !this.organization.isEmpty();
9174    }
9175
9176    /**
9177     * @param value {@link #organization} (The provider which is responsible for the claim.)
9178     */
9179    public ExplanationOfBenefit setOrganization(Type value) { 
9180      this.organization = value;
9181      return this;
9182    }
9183
9184    /**
9185     * @return {@link #facility} (Facility where the services were provided.)
9186     */
9187    public Type getFacility() { 
9188      return this.facility;
9189    }
9190
9191    /**
9192     * @return {@link #facility} (Facility where the services were provided.)
9193     */
9194    public Identifier getFacilityIdentifier() throws FHIRException { 
9195      if (!(this.facility instanceof Identifier))
9196        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.facility.getClass().getName()+" was encountered");
9197      return (Identifier) this.facility;
9198    }
9199
9200    public boolean hasFacilityIdentifier() { 
9201      return this.facility instanceof Identifier;
9202    }
9203
9204    /**
9205     * @return {@link #facility} (Facility where the services were provided.)
9206     */
9207    public Reference getFacilityReference() throws FHIRException { 
9208      if (!(this.facility instanceof Reference))
9209        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.facility.getClass().getName()+" was encountered");
9210      return (Reference) this.facility;
9211    }
9212
9213    public boolean hasFacilityReference() { 
9214      return this.facility instanceof Reference;
9215    }
9216
9217    public boolean hasFacility() { 
9218      return this.facility != null && !this.facility.isEmpty();
9219    }
9220
9221    /**
9222     * @param value {@link #facility} (Facility where the services were provided.)
9223     */
9224    public ExplanationOfBenefit setFacility(Type value) { 
9225      this.facility = value;
9226      return this;
9227    }
9228
9229    /**
9230     * @return {@link #related} (Other claims which are related to this claim such as prior claim versions or for related services.)
9231     */
9232    public List<RelatedClaimsComponent> getRelated() { 
9233      if (this.related == null)
9234        this.related = new ArrayList<RelatedClaimsComponent>();
9235      return this.related;
9236    }
9237
9238    public boolean hasRelated() { 
9239      if (this.related == null)
9240        return false;
9241      for (RelatedClaimsComponent item : this.related)
9242        if (!item.isEmpty())
9243          return true;
9244      return false;
9245    }
9246
9247    /**
9248     * @return {@link #related} (Other claims which are related to this claim such as prior claim versions or for related services.)
9249     */
9250    // syntactic sugar
9251    public RelatedClaimsComponent addRelated() { //3
9252      RelatedClaimsComponent t = new RelatedClaimsComponent();
9253      if (this.related == null)
9254        this.related = new ArrayList<RelatedClaimsComponent>();
9255      this.related.add(t);
9256      return t;
9257    }
9258
9259    // syntactic sugar
9260    public ExplanationOfBenefit addRelated(RelatedClaimsComponent t) { //3
9261      if (t == null)
9262        return this;
9263      if (this.related == null)
9264        this.related = new ArrayList<RelatedClaimsComponent>();
9265      this.related.add(t);
9266      return this;
9267    }
9268
9269    /**
9270     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
9271     */
9272    public Type getPrescription() { 
9273      return this.prescription;
9274    }
9275
9276    /**
9277     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
9278     */
9279    public Identifier getPrescriptionIdentifier() throws FHIRException { 
9280      if (!(this.prescription instanceof Identifier))
9281        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.prescription.getClass().getName()+" was encountered");
9282      return (Identifier) this.prescription;
9283    }
9284
9285    public boolean hasPrescriptionIdentifier() { 
9286      return this.prescription instanceof Identifier;
9287    }
9288
9289    /**
9290     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
9291     */
9292    public Reference getPrescriptionReference() throws FHIRException { 
9293      if (!(this.prescription instanceof Reference))
9294        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.prescription.getClass().getName()+" was encountered");
9295      return (Reference) this.prescription;
9296    }
9297
9298    public boolean hasPrescriptionReference() { 
9299      return this.prescription instanceof Reference;
9300    }
9301
9302    public boolean hasPrescription() { 
9303      return this.prescription != null && !this.prescription.isEmpty();
9304    }
9305
9306    /**
9307     * @param value {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
9308     */
9309    public ExplanationOfBenefit setPrescription(Type value) { 
9310      this.prescription = value;
9311      return this;
9312    }
9313
9314    /**
9315     * @return {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.)
9316     */
9317    public Type getOriginalPrescription() { 
9318      return this.originalPrescription;
9319    }
9320
9321    /**
9322     * @return {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.)
9323     */
9324    public Identifier getOriginalPrescriptionIdentifier() throws FHIRException { 
9325      if (!(this.originalPrescription instanceof Identifier))
9326        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.originalPrescription.getClass().getName()+" was encountered");
9327      return (Identifier) this.originalPrescription;
9328    }
9329
9330    public boolean hasOriginalPrescriptionIdentifier() { 
9331      return this.originalPrescription instanceof Identifier;
9332    }
9333
9334    /**
9335     * @return {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.)
9336     */
9337    public Reference getOriginalPrescriptionReference() throws FHIRException { 
9338      if (!(this.originalPrescription instanceof Reference))
9339        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.originalPrescription.getClass().getName()+" was encountered");
9340      return (Reference) this.originalPrescription;
9341    }
9342
9343    public boolean hasOriginalPrescriptionReference() { 
9344      return this.originalPrescription instanceof Reference;
9345    }
9346
9347    public boolean hasOriginalPrescription() { 
9348      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
9349    }
9350
9351    /**
9352     * @param value {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.)
9353     */
9354    public ExplanationOfBenefit setOriginalPrescription(Type value) { 
9355      this.originalPrescription = value;
9356      return this;
9357    }
9358
9359    /**
9360     * @return {@link #payee} (The party to be reimbursed for the services.)
9361     */
9362    public PayeeComponent getPayee() { 
9363      if (this.payee == null)
9364        if (Configuration.errorOnAutoCreate())
9365          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
9366        else if (Configuration.doAutoCreate())
9367          this.payee = new PayeeComponent(); // cc
9368      return this.payee;
9369    }
9370
9371    public boolean hasPayee() { 
9372      return this.payee != null && !this.payee.isEmpty();
9373    }
9374
9375    /**
9376     * @param value {@link #payee} (The party to be reimbursed for the services.)
9377     */
9378    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
9379      this.payee = value;
9380      return this;
9381    }
9382
9383    /**
9384     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
9385     */
9386    public Type getReferral() { 
9387      return this.referral;
9388    }
9389
9390    /**
9391     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
9392     */
9393    public Identifier getReferralIdentifier() throws FHIRException { 
9394      if (!(this.referral instanceof Identifier))
9395        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.referral.getClass().getName()+" was encountered");
9396      return (Identifier) this.referral;
9397    }
9398
9399    public boolean hasReferralIdentifier() { 
9400      return this.referral instanceof Identifier;
9401    }
9402
9403    /**
9404     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
9405     */
9406    public Reference getReferralReference() throws FHIRException { 
9407      if (!(this.referral instanceof Reference))
9408        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.referral.getClass().getName()+" was encountered");
9409      return (Reference) this.referral;
9410    }
9411
9412    public boolean hasReferralReference() { 
9413      return this.referral instanceof Reference;
9414    }
9415
9416    public boolean hasReferral() { 
9417      return this.referral != null && !this.referral.isEmpty();
9418    }
9419
9420    /**
9421     * @param value {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
9422     */
9423    public ExplanationOfBenefit setReferral(Type value) { 
9424      this.referral = value;
9425      return this;
9426    }
9427
9428    /**
9429     * @return {@link #occurrenceCode} (**Insert definition of Occurrence codes.)
9430     */
9431    public List<Coding> getOccurrenceCode() { 
9432      if (this.occurrenceCode == null)
9433        this.occurrenceCode = new ArrayList<Coding>();
9434      return this.occurrenceCode;
9435    }
9436
9437    public boolean hasOccurrenceCode() { 
9438      if (this.occurrenceCode == null)
9439        return false;
9440      for (Coding item : this.occurrenceCode)
9441        if (!item.isEmpty())
9442          return true;
9443      return false;
9444    }
9445
9446    /**
9447     * @return {@link #occurrenceCode} (**Insert definition of Occurrence codes.)
9448     */
9449    // syntactic sugar
9450    public Coding addOccurrenceCode() { //3
9451      Coding t = new Coding();
9452      if (this.occurrenceCode == null)
9453        this.occurrenceCode = new ArrayList<Coding>();
9454      this.occurrenceCode.add(t);
9455      return t;
9456    }
9457
9458    // syntactic sugar
9459    public ExplanationOfBenefit addOccurrenceCode(Coding t) { //3
9460      if (t == null)
9461        return this;
9462      if (this.occurrenceCode == null)
9463        this.occurrenceCode = new ArrayList<Coding>();
9464      this.occurrenceCode.add(t);
9465      return this;
9466    }
9467
9468    /**
9469     * @return {@link #occurenceSpanCode} (**Insert definition of Occurrence Span codes.)
9470     */
9471    public List<Coding> getOccurenceSpanCode() { 
9472      if (this.occurenceSpanCode == null)
9473        this.occurenceSpanCode = new ArrayList<Coding>();
9474      return this.occurenceSpanCode;
9475    }
9476
9477    public boolean hasOccurenceSpanCode() { 
9478      if (this.occurenceSpanCode == null)
9479        return false;
9480      for (Coding item : this.occurenceSpanCode)
9481        if (!item.isEmpty())
9482          return true;
9483      return false;
9484    }
9485
9486    /**
9487     * @return {@link #occurenceSpanCode} (**Insert definition of Occurrence Span codes.)
9488     */
9489    // syntactic sugar
9490    public Coding addOccurenceSpanCode() { //3
9491      Coding t = new Coding();
9492      if (this.occurenceSpanCode == null)
9493        this.occurenceSpanCode = new ArrayList<Coding>();
9494      this.occurenceSpanCode.add(t);
9495      return t;
9496    }
9497
9498    // syntactic sugar
9499    public ExplanationOfBenefit addOccurenceSpanCode(Coding t) { //3
9500      if (t == null)
9501        return this;
9502      if (this.occurenceSpanCode == null)
9503        this.occurenceSpanCode = new ArrayList<Coding>();
9504      this.occurenceSpanCode.add(t);
9505      return this;
9506    }
9507
9508    /**
9509     * @return {@link #valueCode} (**Insert definition of Value codes.)
9510     */
9511    public List<Coding> getValueCode() { 
9512      if (this.valueCode == null)
9513        this.valueCode = new ArrayList<Coding>();
9514      return this.valueCode;
9515    }
9516
9517    public boolean hasValueCode() { 
9518      if (this.valueCode == null)
9519        return false;
9520      for (Coding item : this.valueCode)
9521        if (!item.isEmpty())
9522          return true;
9523      return false;
9524    }
9525
9526    /**
9527     * @return {@link #valueCode} (**Insert definition of Value codes.)
9528     */
9529    // syntactic sugar
9530    public Coding addValueCode() { //3
9531      Coding t = new Coding();
9532      if (this.valueCode == null)
9533        this.valueCode = new ArrayList<Coding>();
9534      this.valueCode.add(t);
9535      return t;
9536    }
9537
9538    // syntactic sugar
9539    public ExplanationOfBenefit addValueCode(Coding t) { //3
9540      if (t == null)
9541        return this;
9542      if (this.valueCode == null)
9543        this.valueCode = new ArrayList<Coding>();
9544      this.valueCode.add(t);
9545      return this;
9546    }
9547
9548    /**
9549     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
9550     */
9551    public List<DiagnosisComponent> getDiagnosis() { 
9552      if (this.diagnosis == null)
9553        this.diagnosis = new ArrayList<DiagnosisComponent>();
9554      return this.diagnosis;
9555    }
9556
9557    public boolean hasDiagnosis() { 
9558      if (this.diagnosis == null)
9559        return false;
9560      for (DiagnosisComponent item : this.diagnosis)
9561        if (!item.isEmpty())
9562          return true;
9563      return false;
9564    }
9565
9566    /**
9567     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
9568     */
9569    // syntactic sugar
9570    public DiagnosisComponent addDiagnosis() { //3
9571      DiagnosisComponent t = new DiagnosisComponent();
9572      if (this.diagnosis == null)
9573        this.diagnosis = new ArrayList<DiagnosisComponent>();
9574      this.diagnosis.add(t);
9575      return t;
9576    }
9577
9578    // syntactic sugar
9579    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
9580      if (t == null)
9581        return this;
9582      if (this.diagnosis == null)
9583        this.diagnosis = new ArrayList<DiagnosisComponent>();
9584      this.diagnosis.add(t);
9585      return this;
9586    }
9587
9588    /**
9589     * @return {@link #procedure} (Ordered list of patient procedures performed to support the adjudication.)
9590     */
9591    public List<ProcedureComponent> getProcedure() { 
9592      if (this.procedure == null)
9593        this.procedure = new ArrayList<ProcedureComponent>();
9594      return this.procedure;
9595    }
9596
9597    public boolean hasProcedure() { 
9598      if (this.procedure == null)
9599        return false;
9600      for (ProcedureComponent item : this.procedure)
9601        if (!item.isEmpty())
9602          return true;
9603      return false;
9604    }
9605
9606    /**
9607     * @return {@link #procedure} (Ordered list of patient procedures performed to support the adjudication.)
9608     */
9609    // syntactic sugar
9610    public ProcedureComponent addProcedure() { //3
9611      ProcedureComponent t = new ProcedureComponent();
9612      if (this.procedure == null)
9613        this.procedure = new ArrayList<ProcedureComponent>();
9614      this.procedure.add(t);
9615      return t;
9616    }
9617
9618    // syntactic sugar
9619    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
9620      if (t == null)
9621        return this;
9622      if (this.procedure == null)
9623        this.procedure = new ArrayList<ProcedureComponent>();
9624      this.procedure.add(t);
9625      return this;
9626    }
9627
9628    /**
9629     * @return {@link #specialCondition} (List of special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.)
9630     */
9631    public List<Coding> getSpecialCondition() { 
9632      if (this.specialCondition == null)
9633        this.specialCondition = new ArrayList<Coding>();
9634      return this.specialCondition;
9635    }
9636
9637    public boolean hasSpecialCondition() { 
9638      if (this.specialCondition == null)
9639        return false;
9640      for (Coding item : this.specialCondition)
9641        if (!item.isEmpty())
9642          return true;
9643      return false;
9644    }
9645
9646    /**
9647     * @return {@link #specialCondition} (List of special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.)
9648     */
9649    // syntactic sugar
9650    public Coding addSpecialCondition() { //3
9651      Coding t = new Coding();
9652      if (this.specialCondition == null)
9653        this.specialCondition = new ArrayList<Coding>();
9654      this.specialCondition.add(t);
9655      return t;
9656    }
9657
9658    // syntactic sugar
9659    public ExplanationOfBenefit addSpecialCondition(Coding t) { //3
9660      if (t == null)
9661        return this;
9662      if (this.specialCondition == null)
9663        this.specialCondition = new ArrayList<Coding>();
9664      this.specialCondition.add(t);
9665      return this;
9666    }
9667
9668    /**
9669     * @return {@link #patient} (Patient Resource.)
9670     */
9671    public Type getPatient() { 
9672      return this.patient;
9673    }
9674
9675    /**
9676     * @return {@link #patient} (Patient Resource.)
9677     */
9678    public Identifier getPatientIdentifier() throws FHIRException { 
9679      if (!(this.patient instanceof Identifier))
9680        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.patient.getClass().getName()+" was encountered");
9681      return (Identifier) this.patient;
9682    }
9683
9684    public boolean hasPatientIdentifier() { 
9685      return this.patient instanceof Identifier;
9686    }
9687
9688    /**
9689     * @return {@link #patient} (Patient Resource.)
9690     */
9691    public Reference getPatientReference() throws FHIRException { 
9692      if (!(this.patient instanceof Reference))
9693        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.patient.getClass().getName()+" was encountered");
9694      return (Reference) this.patient;
9695    }
9696
9697    public boolean hasPatientReference() { 
9698      return this.patient instanceof Reference;
9699    }
9700
9701    public boolean hasPatient() { 
9702      return this.patient != null && !this.patient.isEmpty();
9703    }
9704
9705    /**
9706     * @param value {@link #patient} (Patient Resource.)
9707     */
9708    public ExplanationOfBenefit setPatient(Type value) { 
9709      this.patient = value;
9710      return this;
9711    }
9712
9713    /**
9714     * @return {@link #precedence} (Precedence (primary, secondary, etc.).). This is the underlying object with id, value and extensions. The accessor "getPrecedence" gives direct access to the value
9715     */
9716    public PositiveIntType getPrecedenceElement() { 
9717      if (this.precedence == null)
9718        if (Configuration.errorOnAutoCreate())
9719          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
9720        else if (Configuration.doAutoCreate())
9721          this.precedence = new PositiveIntType(); // bb
9722      return this.precedence;
9723    }
9724
9725    public boolean hasPrecedenceElement() { 
9726      return this.precedence != null && !this.precedence.isEmpty();
9727    }
9728
9729    public boolean hasPrecedence() { 
9730      return this.precedence != null && !this.precedence.isEmpty();
9731    }
9732
9733    /**
9734     * @param value {@link #precedence} (Precedence (primary, secondary, etc.).). This is the underlying object with id, value and extensions. The accessor "getPrecedence" gives direct access to the value
9735     */
9736    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
9737      this.precedence = value;
9738      return this;
9739    }
9740
9741    /**
9742     * @return Precedence (primary, secondary, etc.).
9743     */
9744    public int getPrecedence() { 
9745      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
9746    }
9747
9748    /**
9749     * @param value Precedence (primary, secondary, etc.).
9750     */
9751    public ExplanationOfBenefit setPrecedence(int value) { 
9752        if (this.precedence == null)
9753          this.precedence = new PositiveIntType();
9754        this.precedence.setValue(value);
9755      return this;
9756    }
9757
9758    /**
9759     * @return {@link #coverage} (Financial instrument by which payment information for health care.)
9760     */
9761    public CoverageComponent getCoverage() { 
9762      if (this.coverage == null)
9763        if (Configuration.errorOnAutoCreate())
9764          throw new Error("Attempt to auto-create ExplanationOfBenefit.coverage");
9765        else if (Configuration.doAutoCreate())
9766          this.coverage = new CoverageComponent(); // cc
9767      return this.coverage;
9768    }
9769
9770    public boolean hasCoverage() { 
9771      return this.coverage != null && !this.coverage.isEmpty();
9772    }
9773
9774    /**
9775     * @param value {@link #coverage} (Financial instrument by which payment information for health care.)
9776     */
9777    public ExplanationOfBenefit setCoverage(CoverageComponent value) { 
9778      this.coverage = value;
9779      return this;
9780    }
9781
9782    /**
9783     * @return {@link #accidentDate} (Date of an accident which these services are addressing.). This is the underlying object with id, value and extensions. The accessor "getAccidentDate" gives direct access to the value
9784     */
9785    public DateType getAccidentDateElement() { 
9786      if (this.accidentDate == null)
9787        if (Configuration.errorOnAutoCreate())
9788          throw new Error("Attempt to auto-create ExplanationOfBenefit.accidentDate");
9789        else if (Configuration.doAutoCreate())
9790          this.accidentDate = new DateType(); // bb
9791      return this.accidentDate;
9792    }
9793
9794    public boolean hasAccidentDateElement() { 
9795      return this.accidentDate != null && !this.accidentDate.isEmpty();
9796    }
9797
9798    public boolean hasAccidentDate() { 
9799      return this.accidentDate != null && !this.accidentDate.isEmpty();
9800    }
9801
9802    /**
9803     * @param value {@link #accidentDate} (Date of an accident which these services are addressing.). This is the underlying object with id, value and extensions. The accessor "getAccidentDate" gives direct access to the value
9804     */
9805    public ExplanationOfBenefit setAccidentDateElement(DateType value) { 
9806      this.accidentDate = value;
9807      return this;
9808    }
9809
9810    /**
9811     * @return Date of an accident which these services are addressing.
9812     */
9813    public Date getAccidentDate() { 
9814      return this.accidentDate == null ? null : this.accidentDate.getValue();
9815    }
9816
9817    /**
9818     * @param value Date of an accident which these services are addressing.
9819     */
9820    public ExplanationOfBenefit setAccidentDate(Date value) { 
9821      if (value == null)
9822        this.accidentDate = null;
9823      else {
9824        if (this.accidentDate == null)
9825          this.accidentDate = new DateType();
9826        this.accidentDate.setValue(value);
9827      }
9828      return this;
9829    }
9830
9831    /**
9832     * @return {@link #accidentType} (Type of accident: work, auto, etc.)
9833     */
9834    public Coding getAccidentType() { 
9835      if (this.accidentType == null)
9836        if (Configuration.errorOnAutoCreate())
9837          throw new Error("Attempt to auto-create ExplanationOfBenefit.accidentType");
9838        else if (Configuration.doAutoCreate())
9839          this.accidentType = new Coding(); // cc
9840      return this.accidentType;
9841    }
9842
9843    public boolean hasAccidentType() { 
9844      return this.accidentType != null && !this.accidentType.isEmpty();
9845    }
9846
9847    /**
9848     * @param value {@link #accidentType} (Type of accident: work, auto, etc.)
9849     */
9850    public ExplanationOfBenefit setAccidentType(Coding value) { 
9851      this.accidentType = value;
9852      return this;
9853    }
9854
9855    /**
9856     * @return {@link #accidentLocation} (Accident Place.)
9857     */
9858    public Type getAccidentLocation() { 
9859      return this.accidentLocation;
9860    }
9861
9862    /**
9863     * @return {@link #accidentLocation} (Accident Place.)
9864     */
9865    public Address getAccidentLocationAddress() throws FHIRException { 
9866      if (!(this.accidentLocation instanceof Address))
9867        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.accidentLocation.getClass().getName()+" was encountered");
9868      return (Address) this.accidentLocation;
9869    }
9870
9871    public boolean hasAccidentLocationAddress() { 
9872      return this.accidentLocation instanceof Address;
9873    }
9874
9875    /**
9876     * @return {@link #accidentLocation} (Accident Place.)
9877     */
9878    public Reference getAccidentLocationReference() throws FHIRException { 
9879      if (!(this.accidentLocation instanceof Reference))
9880        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.accidentLocation.getClass().getName()+" was encountered");
9881      return (Reference) this.accidentLocation;
9882    }
9883
9884    public boolean hasAccidentLocationReference() { 
9885      return this.accidentLocation instanceof Reference;
9886    }
9887
9888    public boolean hasAccidentLocation() { 
9889      return this.accidentLocation != null && !this.accidentLocation.isEmpty();
9890    }
9891
9892    /**
9893     * @param value {@link #accidentLocation} (Accident Place.)
9894     */
9895    public ExplanationOfBenefit setAccidentLocation(Type value) { 
9896      this.accidentLocation = value;
9897      return this;
9898    }
9899
9900    /**
9901     * @return {@link #interventionException} (A list of intervention and exception codes which may influence the adjudication of the claim.)
9902     */
9903    public List<Coding> getInterventionException() { 
9904      if (this.interventionException == null)
9905        this.interventionException = new ArrayList<Coding>();
9906      return this.interventionException;
9907    }
9908
9909    public boolean hasInterventionException() { 
9910      if (this.interventionException == null)
9911        return false;
9912      for (Coding item : this.interventionException)
9913        if (!item.isEmpty())
9914          return true;
9915      return false;
9916    }
9917
9918    /**
9919     * @return {@link #interventionException} (A list of intervention and exception codes which may influence the adjudication of the claim.)
9920     */
9921    // syntactic sugar
9922    public Coding addInterventionException() { //3
9923      Coding t = new Coding();
9924      if (this.interventionException == null)
9925        this.interventionException = new ArrayList<Coding>();
9926      this.interventionException.add(t);
9927      return t;
9928    }
9929
9930    // syntactic sugar
9931    public ExplanationOfBenefit addInterventionException(Coding t) { //3
9932      if (t == null)
9933        return this;
9934      if (this.interventionException == null)
9935        this.interventionException = new ArrayList<Coding>();
9936      this.interventionException.add(t);
9937      return this;
9938    }
9939
9940    /**
9941     * @return {@link #onset} (Period, start and last dates of aspects of the Condition or related services.)
9942     */
9943    public List<OnsetComponent> getOnset() { 
9944      if (this.onset == null)
9945        this.onset = new ArrayList<OnsetComponent>();
9946      return this.onset;
9947    }
9948
9949    public boolean hasOnset() { 
9950      if (this.onset == null)
9951        return false;
9952      for (OnsetComponent item : this.onset)
9953        if (!item.isEmpty())
9954          return true;
9955      return false;
9956    }
9957
9958    /**
9959     * @return {@link #onset} (Period, start and last dates of aspects of the Condition or related services.)
9960     */
9961    // syntactic sugar
9962    public OnsetComponent addOnset() { //3
9963      OnsetComponent t = new OnsetComponent();
9964      if (this.onset == null)
9965        this.onset = new ArrayList<OnsetComponent>();
9966      this.onset.add(t);
9967      return t;
9968    }
9969
9970    // syntactic sugar
9971    public ExplanationOfBenefit addOnset(OnsetComponent t) { //3
9972      if (t == null)
9973        return this;
9974      if (this.onset == null)
9975        this.onset = new ArrayList<OnsetComponent>();
9976      this.onset.add(t);
9977      return this;
9978    }
9979
9980    /**
9981     * @return {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
9982     */
9983    public Period getEmploymentImpacted() { 
9984      if (this.employmentImpacted == null)
9985        if (Configuration.errorOnAutoCreate())
9986          throw new Error("Attempt to auto-create ExplanationOfBenefit.employmentImpacted");
9987        else if (Configuration.doAutoCreate())
9988          this.employmentImpacted = new Period(); // cc
9989      return this.employmentImpacted;
9990    }
9991
9992    public boolean hasEmploymentImpacted() { 
9993      return this.employmentImpacted != null && !this.employmentImpacted.isEmpty();
9994    }
9995
9996    /**
9997     * @param value {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
9998     */
9999    public ExplanationOfBenefit setEmploymentImpacted(Period value) { 
10000      this.employmentImpacted = value;
10001      return this;
10002    }
10003
10004    /**
10005     * @return {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
10006     */
10007    public Period getHospitalization() { 
10008      if (this.hospitalization == null)
10009        if (Configuration.errorOnAutoCreate())
10010          throw new Error("Attempt to auto-create ExplanationOfBenefit.hospitalization");
10011        else if (Configuration.doAutoCreate())
10012          this.hospitalization = new Period(); // cc
10013      return this.hospitalization;
10014    }
10015
10016    public boolean hasHospitalization() { 
10017      return this.hospitalization != null && !this.hospitalization.isEmpty();
10018    }
10019
10020    /**
10021     * @param value {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
10022     */
10023    public ExplanationOfBenefit setHospitalization(Period value) { 
10024      this.hospitalization = value;
10025      return this;
10026    }
10027
10028    /**
10029     * @return {@link #item} (First tier of goods and services.)
10030     */
10031    public List<ItemsComponent> getItem() { 
10032      if (this.item == null)
10033        this.item = new ArrayList<ItemsComponent>();
10034      return this.item;
10035    }
10036
10037    public boolean hasItem() { 
10038      if (this.item == null)
10039        return false;
10040      for (ItemsComponent item : this.item)
10041        if (!item.isEmpty())
10042          return true;
10043      return false;
10044    }
10045
10046    /**
10047     * @return {@link #item} (First tier of goods and services.)
10048     */
10049    // syntactic sugar
10050    public ItemsComponent addItem() { //3
10051      ItemsComponent t = new ItemsComponent();
10052      if (this.item == null)
10053        this.item = new ArrayList<ItemsComponent>();
10054      this.item.add(t);
10055      return t;
10056    }
10057
10058    // syntactic sugar
10059    public ExplanationOfBenefit addItem(ItemsComponent t) { //3
10060      if (t == null)
10061        return this;
10062      if (this.item == null)
10063        this.item = new ArrayList<ItemsComponent>();
10064      this.item.add(t);
10065      return this;
10066    }
10067
10068    /**
10069     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
10070     */
10071    public List<AddedItemComponent> getAddItem() { 
10072      if (this.addItem == null)
10073        this.addItem = new ArrayList<AddedItemComponent>();
10074      return this.addItem;
10075    }
10076
10077    public boolean hasAddItem() { 
10078      if (this.addItem == null)
10079        return false;
10080      for (AddedItemComponent item : this.addItem)
10081        if (!item.isEmpty())
10082          return true;
10083      return false;
10084    }
10085
10086    /**
10087     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
10088     */
10089    // syntactic sugar
10090    public AddedItemComponent addAddItem() { //3
10091      AddedItemComponent t = new AddedItemComponent();
10092      if (this.addItem == null)
10093        this.addItem = new ArrayList<AddedItemComponent>();
10094      this.addItem.add(t);
10095      return t;
10096    }
10097
10098    // syntactic sugar
10099    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
10100      if (t == null)
10101        return this;
10102      if (this.addItem == null)
10103        this.addItem = new ArrayList<AddedItemComponent>();
10104      this.addItem.add(t);
10105      return this;
10106    }
10107
10108    /**
10109     * @return {@link #missingTeeth} (A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons.)
10110     */
10111    public List<MissingTeethComponent> getMissingTeeth() { 
10112      if (this.missingTeeth == null)
10113        this.missingTeeth = new ArrayList<MissingTeethComponent>();
10114      return this.missingTeeth;
10115    }
10116
10117    public boolean hasMissingTeeth() { 
10118      if (this.missingTeeth == null)
10119        return false;
10120      for (MissingTeethComponent item : this.missingTeeth)
10121        if (!item.isEmpty())
10122          return true;
10123      return false;
10124    }
10125
10126    /**
10127     * @return {@link #missingTeeth} (A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons.)
10128     */
10129    // syntactic sugar
10130    public MissingTeethComponent addMissingTeeth() { //3
10131      MissingTeethComponent t = new MissingTeethComponent();
10132      if (this.missingTeeth == null)
10133        this.missingTeeth = new ArrayList<MissingTeethComponent>();
10134      this.missingTeeth.add(t);
10135      return t;
10136    }
10137
10138    // syntactic sugar
10139    public ExplanationOfBenefit addMissingTeeth(MissingTeethComponent t) { //3
10140      if (t == null)
10141        return this;
10142      if (this.missingTeeth == null)
10143        this.missingTeeth = new ArrayList<MissingTeethComponent>();
10144      this.missingTeeth.add(t);
10145      return this;
10146    }
10147
10148    /**
10149     * @return {@link #totalCost} (The total cost of the services reported.)
10150     */
10151    public Money getTotalCost() { 
10152      if (this.totalCost == null)
10153        if (Configuration.errorOnAutoCreate())
10154          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalCost");
10155        else if (Configuration.doAutoCreate())
10156          this.totalCost = new Money(); // cc
10157      return this.totalCost;
10158    }
10159
10160    public boolean hasTotalCost() { 
10161      return this.totalCost != null && !this.totalCost.isEmpty();
10162    }
10163
10164    /**
10165     * @param value {@link #totalCost} (The total cost of the services reported.)
10166     */
10167    public ExplanationOfBenefit setTotalCost(Money value) { 
10168      this.totalCost = value;
10169      return this;
10170    }
10171
10172    /**
10173     * @return {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
10174     */
10175    public Money getUnallocDeductable() { 
10176      if (this.unallocDeductable == null)
10177        if (Configuration.errorOnAutoCreate())
10178          throw new Error("Attempt to auto-create ExplanationOfBenefit.unallocDeductable");
10179        else if (Configuration.doAutoCreate())
10180          this.unallocDeductable = new Money(); // cc
10181      return this.unallocDeductable;
10182    }
10183
10184    public boolean hasUnallocDeductable() { 
10185      return this.unallocDeductable != null && !this.unallocDeductable.isEmpty();
10186    }
10187
10188    /**
10189     * @param value {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
10190     */
10191    public ExplanationOfBenefit setUnallocDeductable(Money value) { 
10192      this.unallocDeductable = value;
10193      return this;
10194    }
10195
10196    /**
10197     * @return {@link #totalBenefit} (Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).)
10198     */
10199    public Money getTotalBenefit() { 
10200      if (this.totalBenefit == null)
10201        if (Configuration.errorOnAutoCreate())
10202          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalBenefit");
10203        else if (Configuration.doAutoCreate())
10204          this.totalBenefit = new Money(); // cc
10205      return this.totalBenefit;
10206    }
10207
10208    public boolean hasTotalBenefit() { 
10209      return this.totalBenefit != null && !this.totalBenefit.isEmpty();
10210    }
10211
10212    /**
10213     * @param value {@link #totalBenefit} (Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).)
10214     */
10215    public ExplanationOfBenefit setTotalBenefit(Money value) { 
10216      this.totalBenefit = value;
10217      return this;
10218    }
10219
10220    /**
10221     * @return {@link #paymentAdjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
10222     */
10223    public Money getPaymentAdjustment() { 
10224      if (this.paymentAdjustment == null)
10225        if (Configuration.errorOnAutoCreate())
10226          throw new Error("Attempt to auto-create ExplanationOfBenefit.paymentAdjustment");
10227        else if (Configuration.doAutoCreate())
10228          this.paymentAdjustment = new Money(); // cc
10229      return this.paymentAdjustment;
10230    }
10231
10232    public boolean hasPaymentAdjustment() { 
10233      return this.paymentAdjustment != null && !this.paymentAdjustment.isEmpty();
10234    }
10235
10236    /**
10237     * @param value {@link #paymentAdjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
10238     */
10239    public ExplanationOfBenefit setPaymentAdjustment(Money value) { 
10240      this.paymentAdjustment = value;
10241      return this;
10242    }
10243
10244    /**
10245     * @return {@link #paymentAdjustmentReason} (Reason for the payment adjustment.)
10246     */
10247    public Coding getPaymentAdjustmentReason() { 
10248      if (this.paymentAdjustmentReason == null)
10249        if (Configuration.errorOnAutoCreate())
10250          throw new Error("Attempt to auto-create ExplanationOfBenefit.paymentAdjustmentReason");
10251        else if (Configuration.doAutoCreate())
10252          this.paymentAdjustmentReason = new Coding(); // cc
10253      return this.paymentAdjustmentReason;
10254    }
10255
10256    public boolean hasPaymentAdjustmentReason() { 
10257      return this.paymentAdjustmentReason != null && !this.paymentAdjustmentReason.isEmpty();
10258    }
10259
10260    /**
10261     * @param value {@link #paymentAdjustmentReason} (Reason for the payment adjustment.)
10262     */
10263    public ExplanationOfBenefit setPaymentAdjustmentReason(Coding value) { 
10264      this.paymentAdjustmentReason = value;
10265      return this;
10266    }
10267
10268    /**
10269     * @return {@link #paymentDate} (Estimated payment data.). This is the underlying object with id, value and extensions. The accessor "getPaymentDate" gives direct access to the value
10270     */
10271    public DateType getPaymentDateElement() { 
10272      if (this.paymentDate == null)
10273        if (Configuration.errorOnAutoCreate())
10274          throw new Error("Attempt to auto-create ExplanationOfBenefit.paymentDate");
10275        else if (Configuration.doAutoCreate())
10276          this.paymentDate = new DateType(); // bb
10277      return this.paymentDate;
10278    }
10279
10280    public boolean hasPaymentDateElement() { 
10281      return this.paymentDate != null && !this.paymentDate.isEmpty();
10282    }
10283
10284    public boolean hasPaymentDate() { 
10285      return this.paymentDate != null && !this.paymentDate.isEmpty();
10286    }
10287
10288    /**
10289     * @param value {@link #paymentDate} (Estimated payment data.). This is the underlying object with id, value and extensions. The accessor "getPaymentDate" gives direct access to the value
10290     */
10291    public ExplanationOfBenefit setPaymentDateElement(DateType value) { 
10292      this.paymentDate = value;
10293      return this;
10294    }
10295
10296    /**
10297     * @return Estimated payment data.
10298     */
10299    public Date getPaymentDate() { 
10300      return this.paymentDate == null ? null : this.paymentDate.getValue();
10301    }
10302
10303    /**
10304     * @param value Estimated payment data.
10305     */
10306    public ExplanationOfBenefit setPaymentDate(Date value) { 
10307      if (value == null)
10308        this.paymentDate = null;
10309      else {
10310        if (this.paymentDate == null)
10311          this.paymentDate = new DateType();
10312        this.paymentDate.setValue(value);
10313      }
10314      return this;
10315    }
10316
10317    /**
10318     * @return {@link #paymentAmount} (Payable less any payment adjustment.)
10319     */
10320    public Money getPaymentAmount() { 
10321      if (this.paymentAmount == null)
10322        if (Configuration.errorOnAutoCreate())
10323          throw new Error("Attempt to auto-create ExplanationOfBenefit.paymentAmount");
10324        else if (Configuration.doAutoCreate())
10325          this.paymentAmount = new Money(); // cc
10326      return this.paymentAmount;
10327    }
10328
10329    public boolean hasPaymentAmount() { 
10330      return this.paymentAmount != null && !this.paymentAmount.isEmpty();
10331    }
10332
10333    /**
10334     * @param value {@link #paymentAmount} (Payable less any payment adjustment.)
10335     */
10336    public ExplanationOfBenefit setPaymentAmount(Money value) { 
10337      this.paymentAmount = value;
10338      return this;
10339    }
10340
10341    /**
10342     * @return {@link #paymentRef} (Payment identifer.)
10343     */
10344    public Identifier getPaymentRef() { 
10345      if (this.paymentRef == null)
10346        if (Configuration.errorOnAutoCreate())
10347          throw new Error("Attempt to auto-create ExplanationOfBenefit.paymentRef");
10348        else if (Configuration.doAutoCreate())
10349          this.paymentRef = new Identifier(); // cc
10350      return this.paymentRef;
10351    }
10352
10353    public boolean hasPaymentRef() { 
10354      return this.paymentRef != null && !this.paymentRef.isEmpty();
10355    }
10356
10357    /**
10358     * @param value {@link #paymentRef} (Payment identifer.)
10359     */
10360    public ExplanationOfBenefit setPaymentRef(Identifier value) { 
10361      this.paymentRef = value;
10362      return this;
10363    }
10364
10365    /**
10366     * @return {@link #reserved} (Status of funds reservation (For provider, for Patient, None).)
10367     */
10368    public Coding getReserved() { 
10369      if (this.reserved == null)
10370        if (Configuration.errorOnAutoCreate())
10371          throw new Error("Attempt to auto-create ExplanationOfBenefit.reserved");
10372        else if (Configuration.doAutoCreate())
10373          this.reserved = new Coding(); // cc
10374      return this.reserved;
10375    }
10376
10377    public boolean hasReserved() { 
10378      return this.reserved != null && !this.reserved.isEmpty();
10379    }
10380
10381    /**
10382     * @param value {@link #reserved} (Status of funds reservation (For provider, for Patient, None).)
10383     */
10384    public ExplanationOfBenefit setReserved(Coding value) { 
10385      this.reserved = value;
10386      return this;
10387    }
10388
10389    /**
10390     * @return {@link #form} (The form to be used for printing the content.)
10391     */
10392    public Coding getForm() { 
10393      if (this.form == null)
10394        if (Configuration.errorOnAutoCreate())
10395          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
10396        else if (Configuration.doAutoCreate())
10397          this.form = new Coding(); // cc
10398      return this.form;
10399    }
10400
10401    public boolean hasForm() { 
10402      return this.form != null && !this.form.isEmpty();
10403    }
10404
10405    /**
10406     * @param value {@link #form} (The form to be used for printing the content.)
10407     */
10408    public ExplanationOfBenefit setForm(Coding value) { 
10409      this.form = value;
10410      return this;
10411    }
10412
10413    /**
10414     * @return {@link #note} (Note text.)
10415     */
10416    public List<NotesComponent> getNote() { 
10417      if (this.note == null)
10418        this.note = new ArrayList<NotesComponent>();
10419      return this.note;
10420    }
10421
10422    public boolean hasNote() { 
10423      if (this.note == null)
10424        return false;
10425      for (NotesComponent item : this.note)
10426        if (!item.isEmpty())
10427          return true;
10428      return false;
10429    }
10430
10431    /**
10432     * @return {@link #note} (Note text.)
10433     */
10434    // syntactic sugar
10435    public NotesComponent addNote() { //3
10436      NotesComponent t = new NotesComponent();
10437      if (this.note == null)
10438        this.note = new ArrayList<NotesComponent>();
10439      this.note.add(t);
10440      return t;
10441    }
10442
10443    // syntactic sugar
10444    public ExplanationOfBenefit addNote(NotesComponent t) { //3
10445      if (t == null)
10446        return this;
10447      if (this.note == null)
10448        this.note = new ArrayList<NotesComponent>();
10449      this.note.add(t);
10450      return this;
10451    }
10452
10453    /**
10454     * @return {@link #benefitBalance} (Balance by Benefit Category.)
10455     */
10456    public List<BenefitBalanceComponent> getBenefitBalance() { 
10457      if (this.benefitBalance == null)
10458        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
10459      return this.benefitBalance;
10460    }
10461
10462    public boolean hasBenefitBalance() { 
10463      if (this.benefitBalance == null)
10464        return false;
10465      for (BenefitBalanceComponent item : this.benefitBalance)
10466        if (!item.isEmpty())
10467          return true;
10468      return false;
10469    }
10470
10471    /**
10472     * @return {@link #benefitBalance} (Balance by Benefit Category.)
10473     */
10474    // syntactic sugar
10475    public BenefitBalanceComponent addBenefitBalance() { //3
10476      BenefitBalanceComponent t = new BenefitBalanceComponent();
10477      if (this.benefitBalance == null)
10478        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
10479      this.benefitBalance.add(t);
10480      return t;
10481    }
10482
10483    // syntactic sugar
10484    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
10485      if (t == null)
10486        return this;
10487      if (this.benefitBalance == null)
10488        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
10489      this.benefitBalance.add(t);
10490      return this;
10491    }
10492
10493      protected void listChildren(List<Property> childrenList) {
10494        super.listChildren(childrenList);
10495        childrenList.add(new Property("identifier", "Identifier", "The Response Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
10496        childrenList.add(new Property("claim[x]", "Identifier|Reference(Claim)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, java.lang.Integer.MAX_VALUE, claim));
10497        childrenList.add(new Property("claimResponse[x]", "Identifier|Reference(ClaimResponse)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, java.lang.Integer.MAX_VALUE, claimResponse));
10498        childrenList.add(new Property("subType", "Coding", "A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.", 0, java.lang.Integer.MAX_VALUE, subType));
10499        childrenList.add(new Property("ruleset", "Coding", "The version of the specification on which this instance relies.", 0, java.lang.Integer.MAX_VALUE, ruleset));
10500        childrenList.add(new Property("originalRuleset", "Coding", "The version of the specification from which the original instance was created.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
10501        childrenList.add(new Property("created", "dateTime", "The date when the EOB was created.", 0, java.lang.Integer.MAX_VALUE, created));
10502        childrenList.add(new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, java.lang.Integer.MAX_VALUE, billablePeriod));
10503        childrenList.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, java.lang.Integer.MAX_VALUE, disposition));
10504        childrenList.add(new Property("provider[x]", "Identifier|Reference(Practitioner)", "The provider which is responsible for the claim.", 0, java.lang.Integer.MAX_VALUE, provider));
10505        childrenList.add(new Property("organization[x]", "Identifier|Reference(Organization)", "The provider which is responsible for the claim.", 0, java.lang.Integer.MAX_VALUE, organization));
10506        childrenList.add(new Property("facility[x]", "Identifier|Reference(Location)", "Facility where the services were provided.", 0, java.lang.Integer.MAX_VALUE, facility));
10507        childrenList.add(new Property("related", "", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, java.lang.Integer.MAX_VALUE, related));
10508        childrenList.add(new Property("prescription[x]", "Identifier|Reference(MedicationOrder|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, java.lang.Integer.MAX_VALUE, prescription));
10509        childrenList.add(new Property("originalPrescription[x]", "Identifier|Reference(MedicationOrder)", "Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.", 0, java.lang.Integer.MAX_VALUE, originalPrescription));
10510        childrenList.add(new Property("payee", "", "The party to be reimbursed for the services.", 0, java.lang.Integer.MAX_VALUE, payee));
10511        childrenList.add(new Property("referral[x]", "Identifier|Reference(ReferralRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, java.lang.Integer.MAX_VALUE, referral));
10512        childrenList.add(new Property("occurrenceCode", "Coding", "**Insert definition of Occurrence codes.", 0, java.lang.Integer.MAX_VALUE, occurrenceCode));
10513        childrenList.add(new Property("occurenceSpanCode", "Coding", "**Insert definition of Occurrence Span codes.", 0, java.lang.Integer.MAX_VALUE, occurenceSpanCode));
10514        childrenList.add(new Property("valueCode", "Coding", "**Insert definition of Value codes.", 0, java.lang.Integer.MAX_VALUE, valueCode));
10515        childrenList.add(new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
10516        childrenList.add(new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure));
10517        childrenList.add(new Property("specialCondition", "Coding", "List of special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.", 0, java.lang.Integer.MAX_VALUE, specialCondition));
10518        childrenList.add(new Property("patient[x]", "Identifier|Reference(Patient)", "Patient Resource.", 0, java.lang.Integer.MAX_VALUE, patient));
10519        childrenList.add(new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, java.lang.Integer.MAX_VALUE, precedence));
10520        childrenList.add(new Property("coverage", "", "Financial instrument by which payment information for health care.", 0, java.lang.Integer.MAX_VALUE, coverage));
10521        childrenList.add(new Property("accidentDate", "date", "Date of an accident which these services are addressing.", 0, java.lang.Integer.MAX_VALUE, accidentDate));
10522        childrenList.add(new Property("accidentType", "Coding", "Type of accident: work, auto, etc.", 0, java.lang.Integer.MAX_VALUE, accidentType));
10523        childrenList.add(new Property("accidentLocation[x]", "Address|Reference(Location)", "Accident Place.", 0, java.lang.Integer.MAX_VALUE, accidentLocation));
10524        childrenList.add(new Property("interventionException", "Coding", "A list of intervention and exception codes which may influence the adjudication of the claim.", 0, java.lang.Integer.MAX_VALUE, interventionException));
10525        childrenList.add(new Property("onset", "", "Period, start and last dates of aspects of the Condition or related services.", 0, java.lang.Integer.MAX_VALUE, onset));
10526        childrenList.add(new Property("employmentImpacted", "Period", "The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).", 0, java.lang.Integer.MAX_VALUE, employmentImpacted));
10527        childrenList.add(new Property("hospitalization", "Period", "The start and optional end dates of when the patient was confined to a treatment center.", 0, java.lang.Integer.MAX_VALUE, hospitalization));
10528        childrenList.add(new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item));
10529        childrenList.add(new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem));
10530        childrenList.add(new Property("missingTeeth", "", "A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons.", 0, java.lang.Integer.MAX_VALUE, missingTeeth));
10531        childrenList.add(new Property("totalCost", "Money", "The total cost of the services reported.", 0, java.lang.Integer.MAX_VALUE, totalCost));
10532        childrenList.add(new Property("unallocDeductable", "Money", "The amount of deductable applied which was not allocated to any particular service line.", 0, java.lang.Integer.MAX_VALUE, unallocDeductable));
10533        childrenList.add(new Property("totalBenefit", "Money", "Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).", 0, java.lang.Integer.MAX_VALUE, totalBenefit));
10534        childrenList.add(new Property("paymentAdjustment", "Money", "Adjustment to the payment of this transaction which is not related to adjudication of this transaction.", 0, java.lang.Integer.MAX_VALUE, paymentAdjustment));
10535        childrenList.add(new Property("paymentAdjustmentReason", "Coding", "Reason for the payment adjustment.", 0, java.lang.Integer.MAX_VALUE, paymentAdjustmentReason));
10536        childrenList.add(new Property("paymentDate", "date", "Estimated payment data.", 0, java.lang.Integer.MAX_VALUE, paymentDate));
10537        childrenList.add(new Property("paymentAmount", "Money", "Payable less any payment adjustment.", 0, java.lang.Integer.MAX_VALUE, paymentAmount));
10538        childrenList.add(new Property("paymentRef", "Identifier", "Payment identifer.", 0, java.lang.Integer.MAX_VALUE, paymentRef));
10539        childrenList.add(new Property("reserved", "Coding", "Status of funds reservation (For provider, for Patient, None).", 0, java.lang.Integer.MAX_VALUE, reserved));
10540        childrenList.add(new Property("form", "Coding", "The form to be used for printing the content.", 0, java.lang.Integer.MAX_VALUE, form));
10541        childrenList.add(new Property("note", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, note));
10542        childrenList.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
10543      }
10544
10545      @Override
10546      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10547        switch (hash) {
10548        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
10549        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Type
10550        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Type
10551        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // Coding
10552        case 1548678118: /*ruleset*/ return this.ruleset == null ? new Base[0] : new Base[] {this.ruleset}; // Coding
10553        case 1089373397: /*originalRuleset*/ return this.originalRuleset == null ? new Base[0] : new Base[] {this.originalRuleset}; // Coding
10554        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
10555        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
10556        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
10557        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Type
10558        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Type
10559        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Type
10560        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimsComponent
10561        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Type
10562        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Type
10563        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
10564        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Type
10565        case 1721744222: /*occurrenceCode*/ return this.occurrenceCode == null ? new Base[0] : this.occurrenceCode.toArray(new Base[this.occurrenceCode.size()]); // Coding
10566        case -556690898: /*occurenceSpanCode*/ return this.occurenceSpanCode == null ? new Base[0] : this.occurenceSpanCode.toArray(new Base[this.occurenceSpanCode.size()]); // Coding
10567        case -766209282: /*valueCode*/ return this.valueCode == null ? new Base[0] : this.valueCode.toArray(new Base[this.valueCode.size()]); // Coding
10568        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
10569        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
10570        case -481489822: /*specialCondition*/ return this.specialCondition == null ? new Base[0] : this.specialCondition.toArray(new Base[this.specialCondition.size()]); // Coding
10571        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Type
10572        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
10573        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // CoverageComponent
10574        case -63170979: /*accidentDate*/ return this.accidentDate == null ? new Base[0] : new Base[] {this.accidentDate}; // DateType
10575        case -62671383: /*accidentType*/ return this.accidentType == null ? new Base[0] : new Base[] {this.accidentType}; // Coding
10576        case -1074014492: /*accidentLocation*/ return this.accidentLocation == null ? new Base[0] : new Base[] {this.accidentLocation}; // Type
10577        case 1753076536: /*interventionException*/ return this.interventionException == null ? new Base[0] : this.interventionException.toArray(new Base[this.interventionException.size()]); // Coding
10578        case 105901603: /*onset*/ return this.onset == null ? new Base[0] : this.onset.toArray(new Base[this.onset.size()]); // OnsetComponent
10579        case 1051487345: /*employmentImpacted*/ return this.employmentImpacted == null ? new Base[0] : new Base[] {this.employmentImpacted}; // Period
10580        case 1057894634: /*hospitalization*/ return this.hospitalization == null ? new Base[0] : new Base[] {this.hospitalization}; // Period
10581        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemsComponent
10582        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
10583        case -1157130302: /*missingTeeth*/ return this.missingTeeth == null ? new Base[0] : this.missingTeeth.toArray(new Base[this.missingTeeth.size()]); // MissingTeethComponent
10584        case -577782479: /*totalCost*/ return this.totalCost == null ? new Base[0] : new Base[] {this.totalCost}; // Money
10585        case 2096309753: /*unallocDeductable*/ return this.unallocDeductable == null ? new Base[0] : new Base[] {this.unallocDeductable}; // Money
10586        case 332332211: /*totalBenefit*/ return this.totalBenefit == null ? new Base[0] : new Base[] {this.totalBenefit}; // Money
10587        case 856402963: /*paymentAdjustment*/ return this.paymentAdjustment == null ? new Base[0] : new Base[] {this.paymentAdjustment}; // Money
10588        case -1386508233: /*paymentAdjustmentReason*/ return this.paymentAdjustmentReason == null ? new Base[0] : new Base[] {this.paymentAdjustmentReason}; // Coding
10589        case -1540873516: /*paymentDate*/ return this.paymentDate == null ? new Base[0] : new Base[] {this.paymentDate}; // DateType
10590        case 909332990: /*paymentAmount*/ return this.paymentAmount == null ? new Base[0] : new Base[] {this.paymentAmount}; // Money
10591        case 1612875949: /*paymentRef*/ return this.paymentRef == null ? new Base[0] : new Base[] {this.paymentRef}; // Identifier
10592        case -350385368: /*reserved*/ return this.reserved == null ? new Base[0] : new Base[] {this.reserved}; // Coding
10593        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Coding
10594        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // NotesComponent
10595        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
10596        default: return super.getProperty(hash, name, checkValid);
10597        }
10598
10599      }
10600
10601      @Override
10602      public void setProperty(int hash, String name, Base value) throws FHIRException {
10603        switch (hash) {
10604        case -1618432855: // identifier
10605          this.getIdentifier().add(castToIdentifier(value)); // Identifier
10606          break;
10607        case 94742588: // claim
10608          this.claim = (Type) value; // Type
10609          break;
10610        case 689513629: // claimResponse
10611          this.claimResponse = (Type) value; // Type
10612          break;
10613        case -1868521062: // subType
10614          this.getSubType().add(castToCoding(value)); // Coding
10615          break;
10616        case 1548678118: // ruleset
10617          this.ruleset = castToCoding(value); // Coding
10618          break;
10619        case 1089373397: // originalRuleset
10620          this.originalRuleset = castToCoding(value); // Coding
10621          break;
10622        case 1028554472: // created
10623          this.created = castToDateTime(value); // DateTimeType
10624          break;
10625        case -332066046: // billablePeriod
10626          this.billablePeriod = castToPeriod(value); // Period
10627          break;
10628        case 583380919: // disposition
10629          this.disposition = castToString(value); // StringType
10630          break;
10631        case -987494927: // provider
10632          this.provider = (Type) value; // Type
10633          break;
10634        case 1178922291: // organization
10635          this.organization = (Type) value; // Type
10636          break;
10637        case 501116579: // facility
10638          this.facility = (Type) value; // Type
10639          break;
10640        case 1090493483: // related
10641          this.getRelated().add((RelatedClaimsComponent) value); // RelatedClaimsComponent
10642          break;
10643        case 460301338: // prescription
10644          this.prescription = (Type) value; // Type
10645          break;
10646        case -1814015861: // originalPrescription
10647          this.originalPrescription = (Type) value; // Type
10648          break;
10649        case 106443592: // payee
10650          this.payee = (PayeeComponent) value; // PayeeComponent
10651          break;
10652        case -722568291: // referral
10653          this.referral = (Type) value; // Type
10654          break;
10655        case 1721744222: // occurrenceCode
10656          this.getOccurrenceCode().add(castToCoding(value)); // Coding
10657          break;
10658        case -556690898: // occurenceSpanCode
10659          this.getOccurenceSpanCode().add(castToCoding(value)); // Coding
10660          break;
10661        case -766209282: // valueCode
10662          this.getValueCode().add(castToCoding(value)); // Coding
10663          break;
10664        case 1196993265: // diagnosis
10665          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
10666          break;
10667        case -1095204141: // procedure
10668          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
10669          break;
10670        case -481489822: // specialCondition
10671          this.getSpecialCondition().add(castToCoding(value)); // Coding
10672          break;
10673        case -791418107: // patient
10674          this.patient = (Type) value; // Type
10675          break;
10676        case 159695370: // precedence
10677          this.precedence = castToPositiveInt(value); // PositiveIntType
10678          break;
10679        case -351767064: // coverage
10680          this.coverage = (CoverageComponent) value; // CoverageComponent
10681          break;
10682        case -63170979: // accidentDate
10683          this.accidentDate = castToDate(value); // DateType
10684          break;
10685        case -62671383: // accidentType
10686          this.accidentType = castToCoding(value); // Coding
10687          break;
10688        case -1074014492: // accidentLocation
10689          this.accidentLocation = (Type) value; // Type
10690          break;
10691        case 1753076536: // interventionException
10692          this.getInterventionException().add(castToCoding(value)); // Coding
10693          break;
10694        case 105901603: // onset
10695          this.getOnset().add((OnsetComponent) value); // OnsetComponent
10696          break;
10697        case 1051487345: // employmentImpacted
10698          this.employmentImpacted = castToPeriod(value); // Period
10699          break;
10700        case 1057894634: // hospitalization
10701          this.hospitalization = castToPeriod(value); // Period
10702          break;
10703        case 3242771: // item
10704          this.getItem().add((ItemsComponent) value); // ItemsComponent
10705          break;
10706        case -1148899500: // addItem
10707          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
10708          break;
10709        case -1157130302: // missingTeeth
10710          this.getMissingTeeth().add((MissingTeethComponent) value); // MissingTeethComponent
10711          break;
10712        case -577782479: // totalCost
10713          this.totalCost = castToMoney(value); // Money
10714          break;
10715        case 2096309753: // unallocDeductable
10716          this.unallocDeductable = castToMoney(value); // Money
10717          break;
10718        case 332332211: // totalBenefit
10719          this.totalBenefit = castToMoney(value); // Money
10720          break;
10721        case 856402963: // paymentAdjustment
10722          this.paymentAdjustment = castToMoney(value); // Money
10723          break;
10724        case -1386508233: // paymentAdjustmentReason
10725          this.paymentAdjustmentReason = castToCoding(value); // Coding
10726          break;
10727        case -1540873516: // paymentDate
10728          this.paymentDate = castToDate(value); // DateType
10729          break;
10730        case 909332990: // paymentAmount
10731          this.paymentAmount = castToMoney(value); // Money
10732          break;
10733        case 1612875949: // paymentRef
10734          this.paymentRef = castToIdentifier(value); // Identifier
10735          break;
10736        case -350385368: // reserved
10737          this.reserved = castToCoding(value); // Coding
10738          break;
10739        case 3148996: // form
10740          this.form = castToCoding(value); // Coding
10741          break;
10742        case 3387378: // note
10743          this.getNote().add((NotesComponent) value); // NotesComponent
10744          break;
10745        case 596003397: // benefitBalance
10746          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
10747          break;
10748        default: super.setProperty(hash, name, value);
10749        }
10750
10751      }
10752
10753      @Override
10754      public void setProperty(String name, Base value) throws FHIRException {
10755        if (name.equals("identifier"))
10756          this.getIdentifier().add(castToIdentifier(value));
10757        else if (name.equals("claim[x]"))
10758          this.claim = (Type) value; // Type
10759        else if (name.equals("claimResponse[x]"))
10760          this.claimResponse = (Type) value; // Type
10761        else if (name.equals("subType"))
10762          this.getSubType().add(castToCoding(value));
10763        else if (name.equals("ruleset"))
10764          this.ruleset = castToCoding(value); // Coding
10765        else if (name.equals("originalRuleset"))
10766          this.originalRuleset = castToCoding(value); // Coding
10767        else if (name.equals("created"))
10768          this.created = castToDateTime(value); // DateTimeType
10769        else if (name.equals("billablePeriod"))
10770          this.billablePeriod = castToPeriod(value); // Period
10771        else if (name.equals("disposition"))
10772          this.disposition = castToString(value); // StringType
10773        else if (name.equals("provider[x]"))
10774          this.provider = (Type) value; // Type
10775        else if (name.equals("organization[x]"))
10776          this.organization = (Type) value; // Type
10777        else if (name.equals("facility[x]"))
10778          this.facility = (Type) value; // Type
10779        else if (name.equals("related"))
10780          this.getRelated().add((RelatedClaimsComponent) value);
10781        else if (name.equals("prescription[x]"))
10782          this.prescription = (Type) value; // Type
10783        else if (name.equals("originalPrescription[x]"))
10784          this.originalPrescription = (Type) value; // Type
10785        else if (name.equals("payee"))
10786          this.payee = (PayeeComponent) value; // PayeeComponent
10787        else if (name.equals("referral[x]"))
10788          this.referral = (Type) value; // Type
10789        else if (name.equals("occurrenceCode"))
10790          this.getOccurrenceCode().add(castToCoding(value));
10791        else if (name.equals("occurenceSpanCode"))
10792          this.getOccurenceSpanCode().add(castToCoding(value));
10793        else if (name.equals("valueCode"))
10794          this.getValueCode().add(castToCoding(value));
10795        else if (name.equals("diagnosis"))
10796          this.getDiagnosis().add((DiagnosisComponent) value);
10797        else if (name.equals("procedure"))
10798          this.getProcedure().add((ProcedureComponent) value);
10799        else if (name.equals("specialCondition"))
10800          this.getSpecialCondition().add(castToCoding(value));
10801        else if (name.equals("patient[x]"))
10802          this.patient = (Type) value; // Type
10803        else if (name.equals("precedence"))
10804          this.precedence = castToPositiveInt(value); // PositiveIntType
10805        else if (name.equals("coverage"))
10806          this.coverage = (CoverageComponent) value; // CoverageComponent
10807        else if (name.equals("accidentDate"))
10808          this.accidentDate = castToDate(value); // DateType
10809        else if (name.equals("accidentType"))
10810          this.accidentType = castToCoding(value); // Coding
10811        else if (name.equals("accidentLocation[x]"))
10812          this.accidentLocation = (Type) value; // Type
10813        else if (name.equals("interventionException"))
10814          this.getInterventionException().add(castToCoding(value));
10815        else if (name.equals("onset"))
10816          this.getOnset().add((OnsetComponent) value);
10817        else if (name.equals("employmentImpacted"))
10818          this.employmentImpacted = castToPeriod(value); // Period
10819        else if (name.equals("hospitalization"))
10820          this.hospitalization = castToPeriod(value); // Period
10821        else if (name.equals("item"))
10822          this.getItem().add((ItemsComponent) value);
10823        else if (name.equals("addItem"))
10824          this.getAddItem().add((AddedItemComponent) value);
10825        else if (name.equals("missingTeeth"))
10826          this.getMissingTeeth().add((MissingTeethComponent) value);
10827        else if (name.equals("totalCost"))
10828          this.totalCost = castToMoney(value); // Money
10829        else if (name.equals("unallocDeductable"))
10830          this.unallocDeductable = castToMoney(value); // Money
10831        else if (name.equals("totalBenefit"))
10832          this.totalBenefit = castToMoney(value); // Money
10833        else if (name.equals("paymentAdjustment"))
10834          this.paymentAdjustment = castToMoney(value); // Money
10835        else if (name.equals("paymentAdjustmentReason"))
10836          this.paymentAdjustmentReason = castToCoding(value); // Coding
10837        else if (name.equals("paymentDate"))
10838          this.paymentDate = castToDate(value); // DateType
10839        else if (name.equals("paymentAmount"))
10840          this.paymentAmount = castToMoney(value); // Money
10841        else if (name.equals("paymentRef"))
10842          this.paymentRef = castToIdentifier(value); // Identifier
10843        else if (name.equals("reserved"))
10844          this.reserved = castToCoding(value); // Coding
10845        else if (name.equals("form"))
10846          this.form = castToCoding(value); // Coding
10847        else if (name.equals("note"))
10848          this.getNote().add((NotesComponent) value);
10849        else if (name.equals("benefitBalance"))
10850          this.getBenefitBalance().add((BenefitBalanceComponent) value);
10851        else
10852          super.setProperty(name, value);
10853      }
10854
10855      @Override
10856      public Base makeProperty(int hash, String name) throws FHIRException {
10857        switch (hash) {
10858        case -1618432855:  return addIdentifier(); // Identifier
10859        case 683016900:  return getClaim(); // Type
10860        case -1527963965:  return getClaimResponse(); // Type
10861        case -1868521062:  return addSubType(); // Coding
10862        case 1548678118:  return getRuleset(); // Coding
10863        case 1089373397:  return getOriginalRuleset(); // Coding
10864        case 1028554472: throw new FHIRException("Cannot make property created as it is not a complex type"); // DateTimeType
10865        case -332066046:  return getBillablePeriod(); // Period
10866        case 583380919: throw new FHIRException("Cannot make property disposition as it is not a complex type"); // StringType
10867        case 2064698607:  return getProvider(); // Type
10868        case 1326483053:  return getOrganization(); // Type
10869        case -542224643:  return getFacility(); // Type
10870        case 1090493483:  return addRelated(); // RelatedClaimsComponent
10871        case -993324506:  return getPrescription(); // Type
10872        case -2067905515:  return getOriginalPrescription(); // Type
10873        case 106443592:  return getPayee(); // PayeeComponent
10874        case 344221635:  return getReferral(); // Type
10875        case 1721744222:  return addOccurrenceCode(); // Coding
10876        case -556690898:  return addOccurenceSpanCode(); // Coding
10877        case -766209282:  return addValueCode(); // Coding
10878        case 1196993265:  return addDiagnosis(); // DiagnosisComponent
10879        case -1095204141:  return addProcedure(); // ProcedureComponent
10880        case -481489822:  return addSpecialCondition(); // Coding
10881        case -2061246629:  return getPatient(); // Type
10882        case 159695370: throw new FHIRException("Cannot make property precedence as it is not a complex type"); // PositiveIntType
10883        case -351767064:  return getCoverage(); // CoverageComponent
10884        case -63170979: throw new FHIRException("Cannot make property accidentDate as it is not a complex type"); // DateType
10885        case -62671383:  return getAccidentType(); // Coding
10886        case 1540715292:  return getAccidentLocation(); // Type
10887        case 1753076536:  return addInterventionException(); // Coding
10888        case 105901603:  return addOnset(); // OnsetComponent
10889        case 1051487345:  return getEmploymentImpacted(); // Period
10890        case 1057894634:  return getHospitalization(); // Period
10891        case 3242771:  return addItem(); // ItemsComponent
10892        case -1148899500:  return addAddItem(); // AddedItemComponent
10893        case -1157130302:  return addMissingTeeth(); // MissingTeethComponent
10894        case -577782479:  return getTotalCost(); // Money
10895        case 2096309753:  return getUnallocDeductable(); // Money
10896        case 332332211:  return getTotalBenefit(); // Money
10897        case 856402963:  return getPaymentAdjustment(); // Money
10898        case -1386508233:  return getPaymentAdjustmentReason(); // Coding
10899        case -1540873516: throw new FHIRException("Cannot make property paymentDate as it is not a complex type"); // DateType
10900        case 909332990:  return getPaymentAmount(); // Money
10901        case 1612875949:  return getPaymentRef(); // Identifier
10902        case -350385368:  return getReserved(); // Coding
10903        case 3148996:  return getForm(); // Coding
10904        case 3387378:  return addNote(); // NotesComponent
10905        case 596003397:  return addBenefitBalance(); // BenefitBalanceComponent
10906        default: return super.makeProperty(hash, name);
10907        }
10908
10909      }
10910
10911      @Override
10912      public Base addChild(String name) throws FHIRException {
10913        if (name.equals("identifier")) {
10914          return addIdentifier();
10915        }
10916        else if (name.equals("claimIdentifier")) {
10917          this.claim = new Identifier();
10918          return this.claim;
10919        }
10920        else if (name.equals("claimReference")) {
10921          this.claim = new Reference();
10922          return this.claim;
10923        }
10924        else if (name.equals("claimResponseIdentifier")) {
10925          this.claimResponse = new Identifier();
10926          return this.claimResponse;
10927        }
10928        else if (name.equals("claimResponseReference")) {
10929          this.claimResponse = new Reference();
10930          return this.claimResponse;
10931        }
10932        else if (name.equals("subType")) {
10933          return addSubType();
10934        }
10935        else if (name.equals("ruleset")) {
10936          this.ruleset = new Coding();
10937          return this.ruleset;
10938        }
10939        else if (name.equals("originalRuleset")) {
10940          this.originalRuleset = new Coding();
10941          return this.originalRuleset;
10942        }
10943        else if (name.equals("created")) {
10944          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
10945        }
10946        else if (name.equals("billablePeriod")) {
10947          this.billablePeriod = new Period();
10948          return this.billablePeriod;
10949        }
10950        else if (name.equals("disposition")) {
10951          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
10952        }
10953        else if (name.equals("providerIdentifier")) {
10954          this.provider = new Identifier();
10955          return this.provider;
10956        }
10957        else if (name.equals("providerReference")) {
10958          this.provider = new Reference();
10959          return this.provider;
10960        }
10961        else if (name.equals("organizationIdentifier")) {
10962          this.organization = new Identifier();
10963          return this.organization;
10964        }
10965        else if (name.equals("organizationReference")) {
10966          this.organization = new Reference();
10967          return this.organization;
10968        }
10969        else if (name.equals("facilityIdentifier")) {
10970          this.facility = new Identifier();
10971          return this.facility;
10972        }
10973        else if (name.equals("facilityReference")) {
10974          this.facility = new Reference();
10975          return this.facility;
10976        }
10977        else if (name.equals("related")) {
10978          return addRelated();
10979        }
10980        else if (name.equals("prescriptionIdentifier")) {
10981          this.prescription = new Identifier();
10982          return this.prescription;
10983        }
10984        else if (name.equals("prescriptionReference")) {
10985          this.prescription = new Reference();
10986          return this.prescription;
10987        }
10988        else if (name.equals("originalPrescriptionIdentifier")) {
10989          this.originalPrescription = new Identifier();
10990          return this.originalPrescription;
10991        }
10992        else if (name.equals("originalPrescriptionReference")) {
10993          this.originalPrescription = new Reference();
10994          return this.originalPrescription;
10995        }
10996        else if (name.equals("payee")) {
10997          this.payee = new PayeeComponent();
10998          return this.payee;
10999        }
11000        else if (name.equals("referralIdentifier")) {
11001          this.referral = new Identifier();
11002          return this.referral;
11003        }
11004        else if (name.equals("referralReference")) {
11005          this.referral = new Reference();
11006          return this.referral;
11007        }
11008        else if (name.equals("occurrenceCode")) {
11009          return addOccurrenceCode();
11010        }
11011        else if (name.equals("occurenceSpanCode")) {
11012          return addOccurenceSpanCode();
11013        }
11014        else if (name.equals("valueCode")) {
11015          return addValueCode();
11016        }
11017        else if (name.equals("diagnosis")) {
11018          return addDiagnosis();
11019        }
11020        else if (name.equals("procedure")) {
11021          return addProcedure();
11022        }
11023        else if (name.equals("specialCondition")) {
11024          return addSpecialCondition();
11025        }
11026        else if (name.equals("patientIdentifier")) {
11027          this.patient = new Identifier();
11028          return this.patient;
11029        }
11030        else if (name.equals("patientReference")) {
11031          this.patient = new Reference();
11032          return this.patient;
11033        }
11034        else if (name.equals("precedence")) {
11035          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
11036        }
11037        else if (name.equals("coverage")) {
11038          this.coverage = new CoverageComponent();
11039          return this.coverage;
11040        }
11041        else if (name.equals("accidentDate")) {
11042          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.accidentDate");
11043        }
11044        else if (name.equals("accidentType")) {
11045          this.accidentType = new Coding();
11046          return this.accidentType;
11047        }
11048        else if (name.equals("accidentLocationAddress")) {
11049          this.accidentLocation = new Address();
11050          return this.accidentLocation;
11051        }
11052        else if (name.equals("accidentLocationReference")) {
11053          this.accidentLocation = new Reference();
11054          return this.accidentLocation;
11055        }
11056        else if (name.equals("interventionException")) {
11057          return addInterventionException();
11058        }
11059        else if (name.equals("onset")) {
11060          return addOnset();
11061        }
11062        else if (name.equals("employmentImpacted")) {
11063          this.employmentImpacted = new Period();
11064          return this.employmentImpacted;
11065        }
11066        else if (name.equals("hospitalization")) {
11067          this.hospitalization = new Period();
11068          return this.hospitalization;
11069        }
11070        else if (name.equals("item")) {
11071          return addItem();
11072        }
11073        else if (name.equals("addItem")) {
11074          return addAddItem();
11075        }
11076        else if (name.equals("missingTeeth")) {
11077          return addMissingTeeth();
11078        }
11079        else if (name.equals("totalCost")) {
11080          this.totalCost = new Money();
11081          return this.totalCost;
11082        }
11083        else if (name.equals("unallocDeductable")) {
11084          this.unallocDeductable = new Money();
11085          return this.unallocDeductable;
11086        }
11087        else if (name.equals("totalBenefit")) {
11088          this.totalBenefit = new Money();
11089          return this.totalBenefit;
11090        }
11091        else if (name.equals("paymentAdjustment")) {
11092          this.paymentAdjustment = new Money();
11093          return this.paymentAdjustment;
11094        }
11095        else if (name.equals("paymentAdjustmentReason")) {
11096          this.paymentAdjustmentReason = new Coding();
11097          return this.paymentAdjustmentReason;
11098        }
11099        else if (name.equals("paymentDate")) {
11100          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.paymentDate");
11101        }
11102        else if (name.equals("paymentAmount")) {
11103          this.paymentAmount = new Money();
11104          return this.paymentAmount;
11105        }
11106        else if (name.equals("paymentRef")) {
11107          this.paymentRef = new Identifier();
11108          return this.paymentRef;
11109        }
11110        else if (name.equals("reserved")) {
11111          this.reserved = new Coding();
11112          return this.reserved;
11113        }
11114        else if (name.equals("form")) {
11115          this.form = new Coding();
11116          return this.form;
11117        }
11118        else if (name.equals("note")) {
11119          return addNote();
11120        }
11121        else if (name.equals("benefitBalance")) {
11122          return addBenefitBalance();
11123        }
11124        else
11125          return super.addChild(name);
11126      }
11127
11128  public String fhirType() {
11129    return "ExplanationOfBenefit";
11130
11131  }
11132
11133      public ExplanationOfBenefit copy() {
11134        ExplanationOfBenefit dst = new ExplanationOfBenefit();
11135        copyValues(dst);
11136        if (identifier != null) {
11137          dst.identifier = new ArrayList<Identifier>();
11138          for (Identifier i : identifier)
11139            dst.identifier.add(i.copy());
11140        };
11141        dst.claim = claim == null ? null : claim.copy();
11142        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
11143        if (subType != null) {
11144          dst.subType = new ArrayList<Coding>();
11145          for (Coding i : subType)
11146            dst.subType.add(i.copy());
11147        };
11148        dst.ruleset = ruleset == null ? null : ruleset.copy();
11149        dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
11150        dst.created = created == null ? null : created.copy();
11151        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
11152        dst.disposition = disposition == null ? null : disposition.copy();
11153        dst.provider = provider == null ? null : provider.copy();
11154        dst.organization = organization == null ? null : organization.copy();
11155        dst.facility = facility == null ? null : facility.copy();
11156        if (related != null) {
11157          dst.related = new ArrayList<RelatedClaimsComponent>();
11158          for (RelatedClaimsComponent i : related)
11159            dst.related.add(i.copy());
11160        };
11161        dst.prescription = prescription == null ? null : prescription.copy();
11162        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
11163        dst.payee = payee == null ? null : payee.copy();
11164        dst.referral = referral == null ? null : referral.copy();
11165        if (occurrenceCode != null) {
11166          dst.occurrenceCode = new ArrayList<Coding>();
11167          for (Coding i : occurrenceCode)
11168            dst.occurrenceCode.add(i.copy());
11169        };
11170        if (occurenceSpanCode != null) {
11171          dst.occurenceSpanCode = new ArrayList<Coding>();
11172          for (Coding i : occurenceSpanCode)
11173            dst.occurenceSpanCode.add(i.copy());
11174        };
11175        if (valueCode != null) {
11176          dst.valueCode = new ArrayList<Coding>();
11177          for (Coding i : valueCode)
11178            dst.valueCode.add(i.copy());
11179        };
11180        if (diagnosis != null) {
11181          dst.diagnosis = new ArrayList<DiagnosisComponent>();
11182          for (DiagnosisComponent i : diagnosis)
11183            dst.diagnosis.add(i.copy());
11184        };
11185        if (procedure != null) {
11186          dst.procedure = new ArrayList<ProcedureComponent>();
11187          for (ProcedureComponent i : procedure)
11188            dst.procedure.add(i.copy());
11189        };
11190        if (specialCondition != null) {
11191          dst.specialCondition = new ArrayList<Coding>();
11192          for (Coding i : specialCondition)
11193            dst.specialCondition.add(i.copy());
11194        };
11195        dst.patient = patient == null ? null : patient.copy();
11196        dst.precedence = precedence == null ? null : precedence.copy();
11197        dst.coverage = coverage == null ? null : coverage.copy();
11198        dst.accidentDate = accidentDate == null ? null : accidentDate.copy();
11199        dst.accidentType = accidentType == null ? null : accidentType.copy();
11200        dst.accidentLocation = accidentLocation == null ? null : accidentLocation.copy();
11201        if (interventionException != null) {
11202          dst.interventionException = new ArrayList<Coding>();
11203          for (Coding i : interventionException)
11204            dst.interventionException.add(i.copy());
11205        };
11206        if (onset != null) {
11207          dst.onset = new ArrayList<OnsetComponent>();
11208          for (OnsetComponent i : onset)
11209            dst.onset.add(i.copy());
11210        };
11211        dst.employmentImpacted = employmentImpacted == null ? null : employmentImpacted.copy();
11212        dst.hospitalization = hospitalization == null ? null : hospitalization.copy();
11213        if (item != null) {
11214          dst.item = new ArrayList<ItemsComponent>();
11215          for (ItemsComponent i : item)
11216            dst.item.add(i.copy());
11217        };
11218        if (addItem != null) {
11219          dst.addItem = new ArrayList<AddedItemComponent>();
11220          for (AddedItemComponent i : addItem)
11221            dst.addItem.add(i.copy());
11222        };
11223        if (missingTeeth != null) {
11224          dst.missingTeeth = new ArrayList<MissingTeethComponent>();
11225          for (MissingTeethComponent i : missingTeeth)
11226            dst.missingTeeth.add(i.copy());
11227        };
11228        dst.totalCost = totalCost == null ? null : totalCost.copy();
11229        dst.unallocDeductable = unallocDeductable == null ? null : unallocDeductable.copy();
11230        dst.totalBenefit = totalBenefit == null ? null : totalBenefit.copy();
11231        dst.paymentAdjustment = paymentAdjustment == null ? null : paymentAdjustment.copy();
11232        dst.paymentAdjustmentReason = paymentAdjustmentReason == null ? null : paymentAdjustmentReason.copy();
11233        dst.paymentDate = paymentDate == null ? null : paymentDate.copy();
11234        dst.paymentAmount = paymentAmount == null ? null : paymentAmount.copy();
11235        dst.paymentRef = paymentRef == null ? null : paymentRef.copy();
11236        dst.reserved = reserved == null ? null : reserved.copy();
11237        dst.form = form == null ? null : form.copy();
11238        if (note != null) {
11239          dst.note = new ArrayList<NotesComponent>();
11240          for (NotesComponent i : note)
11241            dst.note.add(i.copy());
11242        };
11243        if (benefitBalance != null) {
11244          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
11245          for (BenefitBalanceComponent i : benefitBalance)
11246            dst.benefitBalance.add(i.copy());
11247        };
11248        return dst;
11249      }
11250
11251      protected ExplanationOfBenefit typedCopy() {
11252        return copy();
11253      }
11254
11255      @Override
11256      public boolean equalsDeep(Base other) {
11257        if (!super.equalsDeep(other))
11258          return false;
11259        if (!(other instanceof ExplanationOfBenefit))
11260          return false;
11261        ExplanationOfBenefit o = (ExplanationOfBenefit) other;
11262        return compareDeep(identifier, o.identifier, true) && compareDeep(claim, o.claim, true) && compareDeep(claimResponse, o.claimResponse, true)
11263           && compareDeep(subType, o.subType, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
11264           && compareDeep(created, o.created, true) && compareDeep(billablePeriod, o.billablePeriod, true)
11265           && compareDeep(disposition, o.disposition, true) && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true)
11266           && compareDeep(facility, o.facility, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
11267           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
11268           && compareDeep(referral, o.referral, true) && compareDeep(occurrenceCode, o.occurrenceCode, true)
11269           && compareDeep(occurenceSpanCode, o.occurenceSpanCode, true) && compareDeep(valueCode, o.valueCode, true)
11270           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(specialCondition, o.specialCondition, true)
11271           && compareDeep(patient, o.patient, true) && compareDeep(precedence, o.precedence, true) && compareDeep(coverage, o.coverage, true)
11272           && compareDeep(accidentDate, o.accidentDate, true) && compareDeep(accidentType, o.accidentType, true)
11273           && compareDeep(accidentLocation, o.accidentLocation, true) && compareDeep(interventionException, o.interventionException, true)
11274           && compareDeep(onset, o.onset, true) && compareDeep(employmentImpacted, o.employmentImpacted, true)
11275           && compareDeep(hospitalization, o.hospitalization, true) && compareDeep(item, o.item, true) && compareDeep(addItem, o.addItem, true)
11276           && compareDeep(missingTeeth, o.missingTeeth, true) && compareDeep(totalCost, o.totalCost, true)
11277           && compareDeep(unallocDeductable, o.unallocDeductable, true) && compareDeep(totalBenefit, o.totalBenefit, true)
11278           && compareDeep(paymentAdjustment, o.paymentAdjustment, true) && compareDeep(paymentAdjustmentReason, o.paymentAdjustmentReason, true)
11279           && compareDeep(paymentDate, o.paymentDate, true) && compareDeep(paymentAmount, o.paymentAmount, true)
11280           && compareDeep(paymentRef, o.paymentRef, true) && compareDeep(reserved, o.reserved, true) && compareDeep(form, o.form, true)
11281           && compareDeep(note, o.note, true) && compareDeep(benefitBalance, o.benefitBalance, true);
11282      }
11283
11284      @Override
11285      public boolean equalsShallow(Base other) {
11286        if (!super.equalsShallow(other))
11287          return false;
11288        if (!(other instanceof ExplanationOfBenefit))
11289          return false;
11290        ExplanationOfBenefit o = (ExplanationOfBenefit) other;
11291        return compareValues(created, o.created, true) && compareValues(disposition, o.disposition, true) && compareValues(precedence, o.precedence, true)
11292           && compareValues(accidentDate, o.accidentDate, true) && compareValues(paymentDate, o.paymentDate, true)
11293          ;
11294      }
11295
11296      public boolean isEmpty() {
11297        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (claim == null || claim.isEmpty())
11298           && (claimResponse == null || claimResponse.isEmpty()) && (subType == null || subType.isEmpty())
11299           && (ruleset == null || ruleset.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
11300           && (created == null || created.isEmpty()) && (billablePeriod == null || billablePeriod.isEmpty())
11301           && (disposition == null || disposition.isEmpty()) && (provider == null || provider.isEmpty())
11302           && (organization == null || organization.isEmpty()) && (facility == null || facility.isEmpty())
11303           && (related == null || related.isEmpty()) && (prescription == null || prescription.isEmpty())
11304           && (originalPrescription == null || originalPrescription.isEmpty()) && (payee == null || payee.isEmpty())
11305           && (referral == null || referral.isEmpty()) && (occurrenceCode == null || occurrenceCode.isEmpty())
11306           && (occurenceSpanCode == null || occurenceSpanCode.isEmpty()) && (valueCode == null || valueCode.isEmpty())
11307           && (diagnosis == null || diagnosis.isEmpty()) && (procedure == null || procedure.isEmpty())
11308           && (specialCondition == null || specialCondition.isEmpty()) && (patient == null || patient.isEmpty())
11309           && (precedence == null || precedence.isEmpty()) && (coverage == null || coverage.isEmpty())
11310           && (accidentDate == null || accidentDate.isEmpty()) && (accidentType == null || accidentType.isEmpty())
11311           && (accidentLocation == null || accidentLocation.isEmpty()) && (interventionException == null || interventionException.isEmpty())
11312           && (onset == null || onset.isEmpty()) && (employmentImpacted == null || employmentImpacted.isEmpty())
11313           && (hospitalization == null || hospitalization.isEmpty()) && (item == null || item.isEmpty())
11314           && (addItem == null || addItem.isEmpty()) && (missingTeeth == null || missingTeeth.isEmpty())
11315           && (totalCost == null || totalCost.isEmpty()) && (unallocDeductable == null || unallocDeductable.isEmpty())
11316           && (totalBenefit == null || totalBenefit.isEmpty()) && (paymentAdjustment == null || paymentAdjustment.isEmpty())
11317           && (paymentAdjustmentReason == null || paymentAdjustmentReason.isEmpty()) && (paymentDate == null || paymentDate.isEmpty())
11318           && (paymentAmount == null || paymentAmount.isEmpty()) && (paymentRef == null || paymentRef.isEmpty())
11319           && (reserved == null || reserved.isEmpty()) && (form == null || form.isEmpty()) && (note == null || note.isEmpty())
11320           && (benefitBalance == null || benefitBalance.isEmpty());
11321      }
11322
11323  @Override
11324  public ResourceType getResourceType() {
11325    return ResourceType.ExplanationOfBenefit;
11326   }
11327
11328 /**
11329   * Search parameter: <b>patientidentifier</b>
11330   * <p>
11331   * Description: <b>The reference to the patient</b><br>
11332   * Type: <b>token</b><br>
11333   * Path: <b>ExplanationOfBenefit.patientIdentifier</b><br>
11334   * </p>
11335   */
11336  @SearchParamDefinition(name="patientidentifier", path="ExplanationOfBenefit.patient.as(Identifier)", description="The reference to the patient", type="token" )
11337  public static final String SP_PATIENTIDENTIFIER = "patientidentifier";
11338 /**
11339   * <b>Fluent Client</b> search parameter constant for <b>patientidentifier</b>
11340   * <p>
11341   * Description: <b>The reference to the patient</b><br>
11342   * Type: <b>token</b><br>
11343   * Path: <b>ExplanationOfBenefit.patientIdentifier</b><br>
11344   * </p>
11345   */
11346  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PATIENTIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PATIENTIDENTIFIER);
11347
11348 /**
11349   * Search parameter: <b>claimindentifier</b>
11350   * <p>
11351   * Description: <b>The reference to the claim</b><br>
11352   * Type: <b>token</b><br>
11353   * Path: <b>ExplanationOfBenefit.claimIdentifier</b><br>
11354   * </p>
11355   */
11356  @SearchParamDefinition(name="claimindentifier", path="ExplanationOfBenefit.claim.as(Identifier)", description="The reference to the claim", type="token" )
11357  public static final String SP_CLAIMINDENTIFIER = "claimindentifier";
11358 /**
11359   * <b>Fluent Client</b> search parameter constant for <b>claimindentifier</b>
11360   * <p>
11361   * Description: <b>The reference to the claim</b><br>
11362   * Type: <b>token</b><br>
11363   * Path: <b>ExplanationOfBenefit.claimIdentifier</b><br>
11364   * </p>
11365   */
11366  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLAIMINDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLAIMINDENTIFIER);
11367
11368 /**
11369   * Search parameter: <b>facilityreference</b>
11370   * <p>
11371   * Description: <b>Facility responsible for the goods and services</b><br>
11372   * Type: <b>reference</b><br>
11373   * Path: <b>ExplanationOfBenefit.facilityReference</b><br>
11374   * </p>
11375   */
11376  @SearchParamDefinition(name="facilityreference", path="ExplanationOfBenefit.facility.as(Reference)", description="Facility responsible for the goods and services", type="reference" )
11377  public static final String SP_FACILITYREFERENCE = "facilityreference";
11378 /**
11379   * <b>Fluent Client</b> search parameter constant for <b>facilityreference</b>
11380   * <p>
11381   * Description: <b>Facility responsible for the goods and services</b><br>
11382   * Type: <b>reference</b><br>
11383   * Path: <b>ExplanationOfBenefit.facilityReference</b><br>
11384   * </p>
11385   */
11386  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITYREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITYREFERENCE);
11387
11388/**
11389   * Constant for fluent queries to be used to add include statements. Specifies
11390   * the path value of "<b>ExplanationOfBenefit:facilityreference</b>".
11391   */
11392  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITYREFERENCE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facilityreference").toLocked();
11393
11394 /**
11395   * Search parameter: <b>providerreference</b>
11396   * <p>
11397   * Description: <b>The reference to the provider</b><br>
11398   * Type: <b>reference</b><br>
11399   * Path: <b>ExplanationOfBenefit.providerReference</b><br>
11400   * </p>
11401   */
11402  @SearchParamDefinition(name="providerreference", path="ExplanationOfBenefit.provider.as(Reference)", description="The reference to the provider", type="reference" )
11403  public static final String SP_PROVIDERREFERENCE = "providerreference";
11404 /**
11405   * <b>Fluent Client</b> search parameter constant for <b>providerreference</b>
11406   * <p>
11407   * Description: <b>The reference to the provider</b><br>
11408   * Type: <b>reference</b><br>
11409   * Path: <b>ExplanationOfBenefit.providerReference</b><br>
11410   * </p>
11411   */
11412  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDERREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDERREFERENCE);
11413
11414/**
11415   * Constant for fluent queries to be used to add include statements. Specifies
11416   * the path value of "<b>ExplanationOfBenefit:providerreference</b>".
11417   */
11418  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDERREFERENCE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:providerreference").toLocked();
11419
11420 /**
11421   * Search parameter: <b>facilityidentifier</b>
11422   * <p>
11423   * Description: <b>Facility responsible for the goods and services</b><br>
11424   * Type: <b>token</b><br>
11425   * Path: <b>ExplanationOfBenefit.facilityIdentifier</b><br>
11426   * </p>
11427   */
11428  @SearchParamDefinition(name="facilityidentifier", path="ExplanationOfBenefit.facility.as(Identifier)", description="Facility responsible for the goods and services", type="token" )
11429  public static final String SP_FACILITYIDENTIFIER = "facilityidentifier";
11430 /**
11431   * <b>Fluent Client</b> search parameter constant for <b>facilityidentifier</b>
11432   * <p>
11433   * Description: <b>Facility responsible for the goods and services</b><br>
11434   * Type: <b>token</b><br>
11435   * Path: <b>ExplanationOfBenefit.facilityIdentifier</b><br>
11436   * </p>
11437   */
11438  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FACILITYIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FACILITYIDENTIFIER);
11439
11440 /**
11441   * Search parameter: <b>organizationidentifier</b>
11442   * <p>
11443   * Description: <b>The reference to the providing organization</b><br>
11444   * Type: <b>token</b><br>
11445   * Path: <b>ExplanationOfBenefit.organizationIdentifier</b><br>
11446   * </p>
11447   */
11448  @SearchParamDefinition(name="organizationidentifier", path="ExplanationOfBenefit.organization.as(Identifier)", description="The reference to the providing organization", type="token" )
11449  public static final String SP_ORGANIZATIONIDENTIFIER = "organizationidentifier";
11450 /**
11451   * <b>Fluent Client</b> search parameter constant for <b>organizationidentifier</b>
11452   * <p>
11453   * Description: <b>The reference to the providing organization</b><br>
11454   * Type: <b>token</b><br>
11455   * Path: <b>ExplanationOfBenefit.organizationIdentifier</b><br>
11456   * </p>
11457   */
11458  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ORGANIZATIONIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ORGANIZATIONIDENTIFIER);
11459
11460 /**
11461   * Search parameter: <b>patientreference</b>
11462   * <p>
11463   * Description: <b>The reference to the patient</b><br>
11464   * Type: <b>reference</b><br>
11465   * Path: <b>ExplanationOfBenefit.patientReference</b><br>
11466   * </p>
11467   */
11468  @SearchParamDefinition(name="patientreference", path="ExplanationOfBenefit.patient.as(Reference)", description="The reference to the patient", type="reference" )
11469  public static final String SP_PATIENTREFERENCE = "patientreference";
11470 /**
11471   * <b>Fluent Client</b> search parameter constant for <b>patientreference</b>
11472   * <p>
11473   * Description: <b>The reference to the patient</b><br>
11474   * Type: <b>reference</b><br>
11475   * Path: <b>ExplanationOfBenefit.patientReference</b><br>
11476   * </p>
11477   */
11478  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENTREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENTREFERENCE);
11479
11480/**
11481   * Constant for fluent queries to be used to add include statements. Specifies
11482   * the path value of "<b>ExplanationOfBenefit:patientreference</b>".
11483   */
11484  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENTREFERENCE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patientreference").toLocked();
11485
11486 /**
11487   * Search parameter: <b>created</b>
11488   * <p>
11489   * Description: <b>The creation date for the EOB</b><br>
11490   * Type: <b>date</b><br>
11491   * Path: <b>ExplanationOfBenefit.created</b><br>
11492   * </p>
11493   */
11494  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
11495  public static final String SP_CREATED = "created";
11496 /**
11497   * <b>Fluent Client</b> search parameter constant for <b>created</b>
11498   * <p>
11499   * Description: <b>The creation date for the EOB</b><br>
11500   * Type: <b>date</b><br>
11501   * Path: <b>ExplanationOfBenefit.created</b><br>
11502   * </p>
11503   */
11504  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
11505
11506 /**
11507   * Search parameter: <b>organizationreference</b>
11508   * <p>
11509   * Description: <b>The reference to the providing organization</b><br>
11510   * Type: <b>reference</b><br>
11511   * Path: <b>ExplanationOfBenefit.organizationReference</b><br>
11512   * </p>
11513   */
11514  @SearchParamDefinition(name="organizationreference", path="ExplanationOfBenefit.organization.as(Reference)", description="The reference to the providing organization", type="reference" )
11515  public static final String SP_ORGANIZATIONREFERENCE = "organizationreference";
11516 /**
11517   * <b>Fluent Client</b> search parameter constant for <b>organizationreference</b>
11518   * <p>
11519   * Description: <b>The reference to the providing organization</b><br>
11520   * Type: <b>reference</b><br>
11521   * Path: <b>ExplanationOfBenefit.organizationReference</b><br>
11522   * </p>
11523   */
11524  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATIONREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATIONREFERENCE);
11525
11526/**
11527   * Constant for fluent queries to be used to add include statements. Specifies
11528   * the path value of "<b>ExplanationOfBenefit:organizationreference</b>".
11529   */
11530  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATIONREFERENCE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:organizationreference").toLocked();
11531
11532 /**
11533   * Search parameter: <b>identifier</b>
11534   * <p>
11535   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
11536   * Type: <b>token</b><br>
11537   * Path: <b>ExplanationOfBenefit.identifier</b><br>
11538   * </p>
11539   */
11540  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
11541  public static final String SP_IDENTIFIER = "identifier";
11542 /**
11543   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
11544   * <p>
11545   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
11546   * Type: <b>token</b><br>
11547   * Path: <b>ExplanationOfBenefit.identifier</b><br>
11548   * </p>
11549   */
11550  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
11551
11552 /**
11553   * Search parameter: <b>disposition</b>
11554   * <p>
11555   * Description: <b>The contents of the disposition message</b><br>
11556   * Type: <b>string</b><br>
11557   * Path: <b>ExplanationOfBenefit.disposition</b><br>
11558   * </p>
11559   */
11560  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
11561  public static final String SP_DISPOSITION = "disposition";
11562 /**
11563   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
11564   * <p>
11565   * Description: <b>The contents of the disposition message</b><br>
11566   * Type: <b>string</b><br>
11567   * Path: <b>ExplanationOfBenefit.disposition</b><br>
11568   * </p>
11569   */
11570  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
11571
11572 /**
11573   * Search parameter: <b>provideridentifier</b>
11574   * <p>
11575   * Description: <b>The reference to the provider</b><br>
11576   * Type: <b>token</b><br>
11577   * Path: <b>ExplanationOfBenefit.providerIdentifier</b><br>
11578   * </p>
11579   */
11580  @SearchParamDefinition(name="provideridentifier", path="ExplanationOfBenefit.provider.as(Identifier)", description="The reference to the provider", type="token" )
11581  public static final String SP_PROVIDERIDENTIFIER = "provideridentifier";
11582 /**
11583   * <b>Fluent Client</b> search parameter constant for <b>provideridentifier</b>
11584   * <p>
11585   * Description: <b>The reference to the provider</b><br>
11586   * Type: <b>token</b><br>
11587   * Path: <b>ExplanationOfBenefit.providerIdentifier</b><br>
11588   * </p>
11589   */
11590  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PROVIDERIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PROVIDERIDENTIFIER);
11591
11592 /**
11593   * Search parameter: <b>claimreference</b>
11594   * <p>
11595   * Description: <b>The reference to the claim</b><br>
11596   * Type: <b>reference</b><br>
11597   * Path: <b>ExplanationOfBenefit.claimReference</b><br>
11598   * </p>
11599   */
11600  @SearchParamDefinition(name="claimreference", path="ExplanationOfBenefit.claim.as(Reference)", description="The reference to the claim", type="reference" )
11601  public static final String SP_CLAIMREFERENCE = "claimreference";
11602 /**
11603   * <b>Fluent Client</b> search parameter constant for <b>claimreference</b>
11604   * <p>
11605   * Description: <b>The reference to the claim</b><br>
11606   * Type: <b>reference</b><br>
11607   * Path: <b>ExplanationOfBenefit.claimReference</b><br>
11608   * </p>
11609   */
11610  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIMREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIMREFERENCE);
11611
11612/**
11613   * Constant for fluent queries to be used to add include statements. Specifies
11614   * the path value of "<b>ExplanationOfBenefit:claimreference</b>".
11615   */
11616  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIMREFERENCE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claimreference").toLocked();
11617
11618
11619}
11620