001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006import java.math.BigDecimal;
007
008/*
009  Copyright (c) 2011+, HL7, Inc.
010  All rights reserved.
011  
012  Redistribution and use in source and binary forms, with or without modification, 
013  are permitted provided that the following conditions are met:
014  
015   * Redistributions of source code must retain the above copyright notice, this 
016     list of conditions and the following disclaimer.
017   * Redistributions in binary form must reproduce the above copyright notice, 
018     this list of conditions and the following disclaimer in the documentation 
019     and/or other materials provided with the distribution.
020   * Neither the name of HL7 nor the names of its contributors may be used to 
021     endorse or promote products derived from this software without specific 
022     prior written permission.
023  
024  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
025  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
026  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
027  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
028  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
029  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
030  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
031  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
032  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
033  POSSIBILITY OF SUCH DAMAGE.
034  
035*/
036
037// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
038import java.util.ArrayList;
039import java.util.Date;
040import java.util.List;
041
042import org.hl7.fhir.exceptions.FHIRException;
043import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
044import org.hl7.fhir.utilities.Utilities;
045
046import ca.uhn.fhir.model.api.annotation.Block;
047import ca.uhn.fhir.model.api.annotation.Child;
048import ca.uhn.fhir.model.api.annotation.Description;
049import ca.uhn.fhir.model.api.annotation.ResourceDef;
050import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
051/**
052 * 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.
053 */
054@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/Profile/ExplanationOfBenefit")
055public class ExplanationOfBenefit extends DomainResource {
056
057    @Block()
058    public static class RelatedClaimsComponent extends BackboneElement implements IBaseBackboneElement {
059        /**
060         * Other claims which are related to this claim such as prior claim versions or for related services.
061         */
062        @Child(name = "claim", type = {Identifier.class, Claim.class}, order=1, min=0, max=1, modifier=false, summary=true)
063        @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." )
064        protected Type claim;
065
066        /**
067         * For example prior or umbrella.
068         */
069        @Child(name = "relationship", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
070        @Description(shortDefinition="How the reference claim is related", formalDefinition="For example prior or umbrella." )
071        protected Coding relationship;
072
073        /**
074         * 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         */
076        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=true)
077        @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 # ." )
078        protected Identifier reference;
079
080        private static final long serialVersionUID = -2033217402L;
081
082    /**
083     * Constructor
084     */
085      public RelatedClaimsComponent() {
086        super();
087      }
088
089        /**
090         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
091         */
092        public Type getClaim() { 
093          return this.claim;
094        }
095
096        /**
097         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
098         */
099        public Identifier getClaimIdentifier() throws FHIRException { 
100          if (!(this.claim instanceof Identifier))
101            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.claim.getClass().getName()+" was encountered");
102          return (Identifier) this.claim;
103        }
104
105        public boolean hasClaimIdentifier() { 
106          return this.claim instanceof Identifier;
107        }
108
109        /**
110         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
111         */
112        public Reference getClaimReference() throws FHIRException { 
113          if (!(this.claim instanceof Reference))
114            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.claim.getClass().getName()+" was encountered");
115          return (Reference) this.claim;
116        }
117
118        public boolean hasClaimReference() { 
119          return this.claim instanceof Reference;
120        }
121
122        public boolean hasClaim() { 
123          return this.claim != null && !this.claim.isEmpty();
124        }
125
126        /**
127         * @param value {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
128         */
129        public RelatedClaimsComponent setClaim(Type value) { 
130          this.claim = value;
131          return this;
132        }
133
134        /**
135         * @return {@link #relationship} (For example prior or umbrella.)
136         */
137        public Coding getRelationship() { 
138          if (this.relationship == null)
139            if (Configuration.errorOnAutoCreate())
140              throw new Error("Attempt to auto-create RelatedClaimsComponent.relationship");
141            else if (Configuration.doAutoCreate())
142              this.relationship = new Coding(); // cc
143          return this.relationship;
144        }
145
146        public boolean hasRelationship() { 
147          return this.relationship != null && !this.relationship.isEmpty();
148        }
149
150        /**
151         * @param value {@link #relationship} (For example prior or umbrella.)
152         */
153        public RelatedClaimsComponent setRelationship(Coding value) { 
154          this.relationship = value;
155          return this;
156        }
157
158        /**
159         * @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 # .)
160         */
161        public Identifier getReference() { 
162          if (this.reference == null)
163            if (Configuration.errorOnAutoCreate())
164              throw new Error("Attempt to auto-create RelatedClaimsComponent.reference");
165            else if (Configuration.doAutoCreate())
166              this.reference = new Identifier(); // cc
167          return this.reference;
168        }
169
170        public boolean hasReference() { 
171          return this.reference != null && !this.reference.isEmpty();
172        }
173
174        /**
175         * @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 # .)
176         */
177        public RelatedClaimsComponent setReference(Identifier value) { 
178          this.reference = value;
179          return this;
180        }
181
182        protected void listChildren(List<Property> childrenList) {
183          super.listChildren(childrenList);
184          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));
185          childrenList.add(new Property("relationship", "Coding", "For example prior or umbrella.", 0, java.lang.Integer.MAX_VALUE, relationship));
186          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));
187        }
188
189      @Override
190      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
191        switch (hash) {
192        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Type
193        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Coding
194        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
195        default: return super.getProperty(hash, name, checkValid);
196        }
197
198      }
199
200      @Override
201      public void setProperty(int hash, String name, Base value) throws FHIRException {
202        switch (hash) {
203        case 94742588: // claim
204          this.claim = (Type) value; // Type
205          break;
206        case -261851592: // relationship
207          this.relationship = castToCoding(value); // Coding
208          break;
209        case -925155509: // reference
210          this.reference = castToIdentifier(value); // Identifier
211          break;
212        default: super.setProperty(hash, name, value);
213        }
214
215      }
216
217      @Override
218      public void setProperty(String name, Base value) throws FHIRException {
219        if (name.equals("claim[x]"))
220          this.claim = (Type) value; // Type
221        else if (name.equals("relationship"))
222          this.relationship = castToCoding(value); // Coding
223        else if (name.equals("reference"))
224          this.reference = castToIdentifier(value); // Identifier
225        else
226          super.setProperty(name, value);
227      }
228
229      @Override
230      public Base makeProperty(int hash, String name) throws FHIRException {
231        switch (hash) {
232        case 683016900:  return getClaim(); // Type
233        case -261851592:  return getRelationship(); // Coding
234        case -925155509:  return getReference(); // Identifier
235        default: return super.makeProperty(hash, name);
236        }
237
238      }
239
240      @Override
241      public Base addChild(String name) throws FHIRException {
242        if (name.equals("claimIdentifier")) {
243          this.claim = new Identifier();
244          return this.claim;
245        }
246        else if (name.equals("claimReference")) {
247          this.claim = new Reference();
248          return this.claim;
249        }
250        else if (name.equals("relationship")) {
251          this.relationship = new Coding();
252          return this.relationship;
253        }
254        else if (name.equals("reference")) {
255          this.reference = new Identifier();
256          return this.reference;
257        }
258        else
259          return super.addChild(name);
260      }
261
262      public RelatedClaimsComponent copy() {
263        RelatedClaimsComponent dst = new RelatedClaimsComponent();
264        copyValues(dst);
265        dst.claim = claim == null ? null : claim.copy();
266        dst.relationship = relationship == null ? null : relationship.copy();
267        dst.reference = reference == null ? null : reference.copy();
268        return dst;
269      }
270
271      @Override
272      public boolean equalsDeep(Base other) {
273        if (!super.equalsDeep(other))
274          return false;
275        if (!(other instanceof RelatedClaimsComponent))
276          return false;
277        RelatedClaimsComponent o = (RelatedClaimsComponent) other;
278        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
279          ;
280      }
281
282      @Override
283      public boolean equalsShallow(Base other) {
284        if (!super.equalsShallow(other))
285          return false;
286        if (!(other instanceof RelatedClaimsComponent))
287          return false;
288        RelatedClaimsComponent o = (RelatedClaimsComponent) other;
289        return true;
290      }
291
292      public boolean isEmpty() {
293        return super.isEmpty() && (claim == null || claim.isEmpty()) && (relationship == null || relationship.isEmpty())
294           && (reference == null || reference.isEmpty());
295      }
296
297  public String fhirType() {
298    return "ExplanationOfBenefit.related";
299
300  }
301
302  }
303
304    @Block()
305    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
306        /**
307         * Type of Party to be reimbursed: Subscriber, provider, other.
308         */
309        @Child(name = "type", type = {Coding.class}, order=1, min=0, max=1, modifier=false, summary=true)
310        @Description(shortDefinition="Type of party: Subscriber, Provider, other", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
311        protected Coding type;
312
313        /**
314         * Party to be reimbursed: Subscriber, provider, other.
315         */
316        @Child(name = "party", type = {Identifier.class, Practitioner.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=true)
317        @Description(shortDefinition="Party to receive the payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
318        protected Type party;
319
320        private static final long serialVersionUID = 1304353420L;
321
322    /**
323     * Constructor
324     */
325      public PayeeComponent() {
326        super();
327      }
328
329        /**
330         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
331         */
332        public Coding getType() { 
333          if (this.type == null)
334            if (Configuration.errorOnAutoCreate())
335              throw new Error("Attempt to auto-create PayeeComponent.type");
336            else if (Configuration.doAutoCreate())
337              this.type = new Coding(); // cc
338          return this.type;
339        }
340
341        public boolean hasType() { 
342          return this.type != null && !this.type.isEmpty();
343        }
344
345        /**
346         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
347         */
348        public PayeeComponent setType(Coding value) { 
349          this.type = value;
350          return this;
351        }
352
353        /**
354         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
355         */
356        public Type getParty() { 
357          return this.party;
358        }
359
360        /**
361         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
362         */
363        public Identifier getPartyIdentifier() throws FHIRException { 
364          if (!(this.party instanceof Identifier))
365            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.party.getClass().getName()+" was encountered");
366          return (Identifier) this.party;
367        }
368
369        public boolean hasPartyIdentifier() { 
370          return this.party instanceof Identifier;
371        }
372
373        /**
374         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
375         */
376        public Reference getPartyReference() throws FHIRException { 
377          if (!(this.party instanceof Reference))
378            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.party.getClass().getName()+" was encountered");
379          return (Reference) this.party;
380        }
381
382        public boolean hasPartyReference() { 
383          return this.party instanceof Reference;
384        }
385
386        public boolean hasParty() { 
387          return this.party != null && !this.party.isEmpty();
388        }
389
390        /**
391         * @param value {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
392         */
393        public PayeeComponent setParty(Type value) { 
394          this.party = value;
395          return this;
396        }
397
398        protected void listChildren(List<Property> childrenList) {
399          super.listChildren(childrenList);
400          childrenList.add(new Property("type", "Coding", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, java.lang.Integer.MAX_VALUE, type));
401          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));
402        }
403
404      @Override
405      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
406        switch (hash) {
407        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
408        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Type
409        default: return super.getProperty(hash, name, checkValid);
410        }
411
412      }
413
414      @Override
415      public void setProperty(int hash, String name, Base value) throws FHIRException {
416        switch (hash) {
417        case 3575610: // type
418          this.type = castToCoding(value); // Coding
419          break;
420        case 106437350: // party
421          this.party = (Type) value; // Type
422          break;
423        default: super.setProperty(hash, name, value);
424        }
425
426      }
427
428      @Override
429      public void setProperty(String name, Base value) throws FHIRException {
430        if (name.equals("type"))
431          this.type = castToCoding(value); // Coding
432        else if (name.equals("party[x]"))
433          this.party = (Type) value; // Type
434        else
435          super.setProperty(name, value);
436      }
437
438      @Override
439      public Base makeProperty(int hash, String name) throws FHIRException {
440        switch (hash) {
441        case 3575610:  return getType(); // Coding
442        case 1189320666:  return getParty(); // Type
443        default: return super.makeProperty(hash, name);
444        }
445
446      }
447
448      @Override
449      public Base addChild(String name) throws FHIRException {
450        if (name.equals("type")) {
451          this.type = new Coding();
452          return this.type;
453        }
454        else if (name.equals("partyIdentifier")) {
455          this.party = new Identifier();
456          return this.party;
457        }
458        else if (name.equals("partyReference")) {
459          this.party = new Reference();
460          return this.party;
461        }
462        else
463          return super.addChild(name);
464      }
465
466      public PayeeComponent copy() {
467        PayeeComponent dst = new PayeeComponent();
468        copyValues(dst);
469        dst.type = type == null ? null : type.copy();
470        dst.party = party == null ? null : party.copy();
471        return dst;
472      }
473
474      @Override
475      public boolean equalsDeep(Base other) {
476        if (!super.equalsDeep(other))
477          return false;
478        if (!(other instanceof PayeeComponent))
479          return false;
480        PayeeComponent o = (PayeeComponent) other;
481        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
482      }
483
484      @Override
485      public boolean equalsShallow(Base other) {
486        if (!super.equalsShallow(other))
487          return false;
488        if (!(other instanceof PayeeComponent))
489          return false;
490        PayeeComponent o = (PayeeComponent) other;
491        return true;
492      }
493
494      public boolean isEmpty() {
495        return super.isEmpty() && (type == null || type.isEmpty()) && (party == null || party.isEmpty())
496          ;
497      }
498
499  public String fhirType() {
500    return "ExplanationOfBenefit.payee";
501
502  }
503
504  }
505
506    @Block()
507    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
508        /**
509         * Sequence of diagnosis which serves to order and provide a link.
510         */
511        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
512        @Description(shortDefinition="Number to covey order of diagnosis", formalDefinition="Sequence of diagnosis which serves to order and provide a link." )
513        protected PositiveIntType sequence;
514
515        /**
516         * The diagnosis.
517         */
518        @Child(name = "diagnosis", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
519        @Description(shortDefinition="Patient's list of diagnosis", formalDefinition="The diagnosis." )
520        protected Coding diagnosis;
521
522        private static final long serialVersionUID = -795010186L;
523
524    /**
525     * Constructor
526     */
527      public DiagnosisComponent() {
528        super();
529      }
530
531    /**
532     * Constructor
533     */
534      public DiagnosisComponent(PositiveIntType sequence, Coding diagnosis) {
535        super();
536        this.sequence = sequence;
537        this.diagnosis = diagnosis;
538      }
539
540        /**
541         * @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
542         */
543        public PositiveIntType getSequenceElement() { 
544          if (this.sequence == null)
545            if (Configuration.errorOnAutoCreate())
546              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
547            else if (Configuration.doAutoCreate())
548              this.sequence = new PositiveIntType(); // bb
549          return this.sequence;
550        }
551
552        public boolean hasSequenceElement() { 
553          return this.sequence != null && !this.sequence.isEmpty();
554        }
555
556        public boolean hasSequence() { 
557          return this.sequence != null && !this.sequence.isEmpty();
558        }
559
560        /**
561         * @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
562         */
563        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
564          this.sequence = value;
565          return this;
566        }
567
568        /**
569         * @return Sequence of diagnosis which serves to order and provide a link.
570         */
571        public int getSequence() { 
572          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
573        }
574
575        /**
576         * @param value Sequence of diagnosis which serves to order and provide a link.
577         */
578        public DiagnosisComponent setSequence(int value) { 
579            if (this.sequence == null)
580              this.sequence = new PositiveIntType();
581            this.sequence.setValue(value);
582          return this;
583        }
584
585        /**
586         * @return {@link #diagnosis} (The diagnosis.)
587         */
588        public Coding getDiagnosis() { 
589          if (this.diagnosis == null)
590            if (Configuration.errorOnAutoCreate())
591              throw new Error("Attempt to auto-create DiagnosisComponent.diagnosis");
592            else if (Configuration.doAutoCreate())
593              this.diagnosis = new Coding(); // cc
594          return this.diagnosis;
595        }
596
597        public boolean hasDiagnosis() { 
598          return this.diagnosis != null && !this.diagnosis.isEmpty();
599        }
600
601        /**
602         * @param value {@link #diagnosis} (The diagnosis.)
603         */
604        public DiagnosisComponent setDiagnosis(Coding value) { 
605          this.diagnosis = value;
606          return this;
607        }
608
609        protected void listChildren(List<Property> childrenList) {
610          super.listChildren(childrenList);
611          childrenList.add(new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to order and provide a link.", 0, java.lang.Integer.MAX_VALUE, sequence));
612          childrenList.add(new Property("diagnosis", "Coding", "The diagnosis.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
613        }
614
615      @Override
616      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
617        switch (hash) {
618        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
619        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Coding
620        default: return super.getProperty(hash, name, checkValid);
621        }
622
623      }
624
625      @Override
626      public void setProperty(int hash, String name, Base value) throws FHIRException {
627        switch (hash) {
628        case 1349547969: // sequence
629          this.sequence = castToPositiveInt(value); // PositiveIntType
630          break;
631        case 1196993265: // diagnosis
632          this.diagnosis = castToCoding(value); // Coding
633          break;
634        default: super.setProperty(hash, name, value);
635        }
636
637      }
638
639      @Override
640      public void setProperty(String name, Base value) throws FHIRException {
641        if (name.equals("sequence"))
642          this.sequence = castToPositiveInt(value); // PositiveIntType
643        else if (name.equals("diagnosis"))
644          this.diagnosis = castToCoding(value); // Coding
645        else
646          super.setProperty(name, value);
647      }
648
649      @Override
650      public Base makeProperty(int hash, String name) throws FHIRException {
651        switch (hash) {
652        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
653        case 1196993265:  return getDiagnosis(); // Coding
654        default: return super.makeProperty(hash, name);
655        }
656
657      }
658
659      @Override
660      public Base addChild(String name) throws FHIRException {
661        if (name.equals("sequence")) {
662          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
663        }
664        else if (name.equals("diagnosis")) {
665          this.diagnosis = new Coding();
666          return this.diagnosis;
667        }
668        else
669          return super.addChild(name);
670      }
671
672      public DiagnosisComponent copy() {
673        DiagnosisComponent dst = new DiagnosisComponent();
674        copyValues(dst);
675        dst.sequence = sequence == null ? null : sequence.copy();
676        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
677        return dst;
678      }
679
680      @Override
681      public boolean equalsDeep(Base other) {
682        if (!super.equalsDeep(other))
683          return false;
684        if (!(other instanceof DiagnosisComponent))
685          return false;
686        DiagnosisComponent o = (DiagnosisComponent) other;
687        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true);
688      }
689
690      @Override
691      public boolean equalsShallow(Base other) {
692        if (!super.equalsShallow(other))
693          return false;
694        if (!(other instanceof DiagnosisComponent))
695          return false;
696        DiagnosisComponent o = (DiagnosisComponent) other;
697        return compareValues(sequence, o.sequence, true);
698      }
699
700      public boolean isEmpty() {
701        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (diagnosis == null || diagnosis.isEmpty())
702          ;
703      }
704
705  public String fhirType() {
706    return "ExplanationOfBenefit.diagnosis";
707
708  }
709
710  }
711
712    @Block()
713    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
714        /**
715         * Sequence of procedures which serves to order and provide a link.
716         */
717        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
718        @Description(shortDefinition="Procedure sequence for reference", formalDefinition="Sequence of procedures which serves to order and provide a link." )
719        protected PositiveIntType sequence;
720
721        /**
722         * Date and optionally time the procedure was performed .
723         */
724        @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
725        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed ." )
726        protected DateTimeType date;
727
728        /**
729         * The procedure code.
730         */
731        @Child(name = "procedure", type = {Coding.class, Procedure.class}, order=3, min=1, max=1, modifier=false, summary=true)
732        @Description(shortDefinition="Patient's list of procedures performed", formalDefinition="The procedure code." )
733        protected Type procedure;
734
735        private static final long serialVersionUID = 864307347L;
736
737    /**
738     * Constructor
739     */
740      public ProcedureComponent() {
741        super();
742      }
743
744    /**
745     * Constructor
746     */
747      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
748        super();
749        this.sequence = sequence;
750        this.procedure = procedure;
751      }
752
753        /**
754         * @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
755         */
756        public PositiveIntType getSequenceElement() { 
757          if (this.sequence == null)
758            if (Configuration.errorOnAutoCreate())
759              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
760            else if (Configuration.doAutoCreate())
761              this.sequence = new PositiveIntType(); // bb
762          return this.sequence;
763        }
764
765        public boolean hasSequenceElement() { 
766          return this.sequence != null && !this.sequence.isEmpty();
767        }
768
769        public boolean hasSequence() { 
770          return this.sequence != null && !this.sequence.isEmpty();
771        }
772
773        /**
774         * @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
775         */
776        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
777          this.sequence = value;
778          return this;
779        }
780
781        /**
782         * @return Sequence of procedures which serves to order and provide a link.
783         */
784        public int getSequence() { 
785          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
786        }
787
788        /**
789         * @param value Sequence of procedures which serves to order and provide a link.
790         */
791        public ProcedureComponent setSequence(int value) { 
792            if (this.sequence == null)
793              this.sequence = new PositiveIntType();
794            this.sequence.setValue(value);
795          return this;
796        }
797
798        /**
799         * @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
800         */
801        public DateTimeType getDateElement() { 
802          if (this.date == null)
803            if (Configuration.errorOnAutoCreate())
804              throw new Error("Attempt to auto-create ProcedureComponent.date");
805            else if (Configuration.doAutoCreate())
806              this.date = new DateTimeType(); // bb
807          return this.date;
808        }
809
810        public boolean hasDateElement() { 
811          return this.date != null && !this.date.isEmpty();
812        }
813
814        public boolean hasDate() { 
815          return this.date != null && !this.date.isEmpty();
816        }
817
818        /**
819         * @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
820         */
821        public ProcedureComponent setDateElement(DateTimeType value) { 
822          this.date = value;
823          return this;
824        }
825
826        /**
827         * @return Date and optionally time the procedure was performed .
828         */
829        public Date getDate() { 
830          return this.date == null ? null : this.date.getValue();
831        }
832
833        /**
834         * @param value Date and optionally time the procedure was performed .
835         */
836        public ProcedureComponent setDate(Date value) { 
837          if (value == null)
838            this.date = null;
839          else {
840            if (this.date == null)
841              this.date = new DateTimeType();
842            this.date.setValue(value);
843          }
844          return this;
845        }
846
847        /**
848         * @return {@link #procedure} (The procedure code.)
849         */
850        public Type getProcedure() { 
851          return this.procedure;
852        }
853
854        /**
855         * @return {@link #procedure} (The procedure code.)
856         */
857        public Coding getProcedureCoding() throws FHIRException { 
858          if (!(this.procedure instanceof Coding))
859            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.procedure.getClass().getName()+" was encountered");
860          return (Coding) this.procedure;
861        }
862
863        public boolean hasProcedureCoding() { 
864          return this.procedure instanceof Coding;
865        }
866
867        /**
868         * @return {@link #procedure} (The procedure code.)
869         */
870        public Reference getProcedureReference() throws FHIRException { 
871          if (!(this.procedure instanceof Reference))
872            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
873          return (Reference) this.procedure;
874        }
875
876        public boolean hasProcedureReference() { 
877          return this.procedure instanceof Reference;
878        }
879
880        public boolean hasProcedure() { 
881          return this.procedure != null && !this.procedure.isEmpty();
882        }
883
884        /**
885         * @param value {@link #procedure} (The procedure code.)
886         */
887        public ProcedureComponent setProcedure(Type value) { 
888          this.procedure = value;
889          return this;
890        }
891
892        protected void listChildren(List<Property> childrenList) {
893          super.listChildren(childrenList);
894          childrenList.add(new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, java.lang.Integer.MAX_VALUE, sequence));
895          childrenList.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, java.lang.Integer.MAX_VALUE, date));
896          childrenList.add(new Property("procedure[x]", "Coding|Reference(Procedure)", "The procedure code.", 0, java.lang.Integer.MAX_VALUE, procedure));
897        }
898
899      @Override
900      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
901        switch (hash) {
902        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
903        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
904        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
905        default: return super.getProperty(hash, name, checkValid);
906        }
907
908      }
909
910      @Override
911      public void setProperty(int hash, String name, Base value) throws FHIRException {
912        switch (hash) {
913        case 1349547969: // sequence
914          this.sequence = castToPositiveInt(value); // PositiveIntType
915          break;
916        case 3076014: // date
917          this.date = castToDateTime(value); // DateTimeType
918          break;
919        case -1095204141: // procedure
920          this.procedure = (Type) value; // Type
921          break;
922        default: super.setProperty(hash, name, value);
923        }
924
925      }
926
927      @Override
928      public void setProperty(String name, Base value) throws FHIRException {
929        if (name.equals("sequence"))
930          this.sequence = castToPositiveInt(value); // PositiveIntType
931        else if (name.equals("date"))
932          this.date = castToDateTime(value); // DateTimeType
933        else if (name.equals("procedure[x]"))
934          this.procedure = (Type) value; // Type
935        else
936          super.setProperty(name, value);
937      }
938
939      @Override
940      public Base makeProperty(int hash, String name) throws FHIRException {
941        switch (hash) {
942        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
943        case 3076014: throw new FHIRException("Cannot make property date as it is not a complex type"); // DateTimeType
944        case 1640074445:  return getProcedure(); // Type
945        default: return super.makeProperty(hash, name);
946        }
947
948      }
949
950      @Override
951      public Base addChild(String name) throws FHIRException {
952        if (name.equals("sequence")) {
953          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
954        }
955        else if (name.equals("date")) {
956          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
957        }
958        else if (name.equals("procedureCoding")) {
959          this.procedure = new Coding();
960          return this.procedure;
961        }
962        else if (name.equals("procedureReference")) {
963          this.procedure = new Reference();
964          return this.procedure;
965        }
966        else
967          return super.addChild(name);
968      }
969
970      public ProcedureComponent copy() {
971        ProcedureComponent dst = new ProcedureComponent();
972        copyValues(dst);
973        dst.sequence = sequence == null ? null : sequence.copy();
974        dst.date = date == null ? null : date.copy();
975        dst.procedure = procedure == null ? null : procedure.copy();
976        return dst;
977      }
978
979      @Override
980      public boolean equalsDeep(Base other) {
981        if (!super.equalsDeep(other))
982          return false;
983        if (!(other instanceof ProcedureComponent))
984          return false;
985        ProcedureComponent o = (ProcedureComponent) other;
986        return compareDeep(sequence, o.sequence, true) && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
987          ;
988      }
989
990      @Override
991      public boolean equalsShallow(Base other) {
992        if (!super.equalsShallow(other))
993          return false;
994        if (!(other instanceof ProcedureComponent))
995          return false;
996        ProcedureComponent o = (ProcedureComponent) other;
997        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
998      }
999
1000      public boolean isEmpty() {
1001        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (date == null || date.isEmpty())
1002           && (procedure == null || procedure.isEmpty());
1003      }
1004
1005  public String fhirType() {
1006    return "ExplanationOfBenefit.procedure";
1007
1008  }
1009
1010  }
1011
1012    @Block()
1013    public static class CoverageComponent extends BackboneElement implements IBaseBackboneElement {
1014        /**
1015         * Reference to the program or plan identification, underwriter or payor.
1016         */
1017        @Child(name = "coverage", type = {Identifier.class, Coverage.class}, order=1, min=1, max=1, modifier=false, summary=true)
1018        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
1019        protected Type coverage;
1020
1021        /**
1022         * A list of references from the Insurer to which these services pertain.
1023         */
1024        @Child(name = "preAuthRef", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1025        @Description(shortDefinition="Pre-Authorization/Determination Reference", formalDefinition="A list of references from the Insurer to which these services pertain." )
1026        protected List<StringType> preAuthRef;
1027
1028        private static final long serialVersionUID = -21571213L;
1029
1030    /**
1031     * Constructor
1032     */
1033      public CoverageComponent() {
1034        super();
1035      }
1036
1037    /**
1038     * Constructor
1039     */
1040      public CoverageComponent(Type coverage) {
1041        super();
1042        this.coverage = coverage;
1043      }
1044
1045        /**
1046         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
1047         */
1048        public Type getCoverage() { 
1049          return this.coverage;
1050        }
1051
1052        /**
1053         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
1054         */
1055        public Identifier getCoverageIdentifier() throws FHIRException { 
1056          if (!(this.coverage instanceof Identifier))
1057            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.coverage.getClass().getName()+" was encountered");
1058          return (Identifier) this.coverage;
1059        }
1060
1061        public boolean hasCoverageIdentifier() { 
1062          return this.coverage instanceof Identifier;
1063        }
1064
1065        /**
1066         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
1067         */
1068        public Reference getCoverageReference() throws FHIRException { 
1069          if (!(this.coverage instanceof Reference))
1070            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.coverage.getClass().getName()+" was encountered");
1071          return (Reference) this.coverage;
1072        }
1073
1074        public boolean hasCoverageReference() { 
1075          return this.coverage instanceof Reference;
1076        }
1077
1078        public boolean hasCoverage() { 
1079          return this.coverage != null && !this.coverage.isEmpty();
1080        }
1081
1082        /**
1083         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
1084         */
1085        public CoverageComponent setCoverage(Type value) { 
1086          this.coverage = value;
1087          return this;
1088        }
1089
1090        /**
1091         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1092         */
1093        public List<StringType> getPreAuthRef() { 
1094          if (this.preAuthRef == null)
1095            this.preAuthRef = new ArrayList<StringType>();
1096          return this.preAuthRef;
1097        }
1098
1099        public boolean hasPreAuthRef() { 
1100          if (this.preAuthRef == null)
1101            return false;
1102          for (StringType item : this.preAuthRef)
1103            if (!item.isEmpty())
1104              return true;
1105          return false;
1106        }
1107
1108        /**
1109         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1110         */
1111    // syntactic sugar
1112        public StringType addPreAuthRefElement() {//2 
1113          StringType t = new StringType();
1114          if (this.preAuthRef == null)
1115            this.preAuthRef = new ArrayList<StringType>();
1116          this.preAuthRef.add(t);
1117          return t;
1118        }
1119
1120        /**
1121         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1122         */
1123        public CoverageComponent addPreAuthRef(String value) { //1
1124          StringType t = new StringType();
1125          t.setValue(value);
1126          if (this.preAuthRef == null)
1127            this.preAuthRef = new ArrayList<StringType>();
1128          this.preAuthRef.add(t);
1129          return this;
1130        }
1131
1132        /**
1133         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
1134         */
1135        public boolean hasPreAuthRef(String value) { 
1136          if (this.preAuthRef == null)
1137            return false;
1138          for (StringType v : this.preAuthRef)
1139            if (v.equals(value)) // string
1140              return true;
1141          return false;
1142        }
1143
1144        protected void listChildren(List<Property> childrenList) {
1145          super.listChildren(childrenList);
1146          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));
1147          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));
1148        }
1149
1150      @Override
1151      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1152        switch (hash) {
1153        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Type
1154        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
1155        default: return super.getProperty(hash, name, checkValid);
1156        }
1157
1158      }
1159
1160      @Override
1161      public void setProperty(int hash, String name, Base value) throws FHIRException {
1162        switch (hash) {
1163        case -351767064: // coverage
1164          this.coverage = (Type) value; // Type
1165          break;
1166        case 522246568: // preAuthRef
1167          this.getPreAuthRef().add(castToString(value)); // StringType
1168          break;
1169        default: super.setProperty(hash, name, value);
1170        }
1171
1172      }
1173
1174      @Override
1175      public void setProperty(String name, Base value) throws FHIRException {
1176        if (name.equals("coverage[x]"))
1177          this.coverage = (Type) value; // Type
1178        else if (name.equals("preAuthRef"))
1179          this.getPreAuthRef().add(castToString(value));
1180        else
1181          super.setProperty(name, value);
1182      }
1183
1184      @Override
1185      public Base makeProperty(int hash, String name) throws FHIRException {
1186        switch (hash) {
1187        case 227689880:  return getCoverage(); // Type
1188        case 522246568: throw new FHIRException("Cannot make property preAuthRef as it is not a complex type"); // StringType
1189        default: return super.makeProperty(hash, name);
1190        }
1191
1192      }
1193
1194      @Override
1195      public Base addChild(String name) throws FHIRException {
1196        if (name.equals("coverageIdentifier")) {
1197          this.coverage = new Identifier();
1198          return this.coverage;
1199        }
1200        else if (name.equals("coverageReference")) {
1201          this.coverage = new Reference();
1202          return this.coverage;
1203        }
1204        else if (name.equals("preAuthRef")) {
1205          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
1206        }
1207        else
1208          return super.addChild(name);
1209      }
1210
1211      public CoverageComponent copy() {
1212        CoverageComponent dst = new CoverageComponent();
1213        copyValues(dst);
1214        dst.coverage = coverage == null ? null : coverage.copy();
1215        if (preAuthRef != null) {
1216          dst.preAuthRef = new ArrayList<StringType>();
1217          for (StringType i : preAuthRef)
1218            dst.preAuthRef.add(i.copy());
1219        };
1220        return dst;
1221      }
1222
1223      @Override
1224      public boolean equalsDeep(Base other) {
1225        if (!super.equalsDeep(other))
1226          return false;
1227        if (!(other instanceof CoverageComponent))
1228          return false;
1229        CoverageComponent o = (CoverageComponent) other;
1230        return compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true);
1231      }
1232
1233      @Override
1234      public boolean equalsShallow(Base other) {
1235        if (!super.equalsShallow(other))
1236          return false;
1237        if (!(other instanceof CoverageComponent))
1238          return false;
1239        CoverageComponent o = (CoverageComponent) other;
1240        return compareValues(preAuthRef, o.preAuthRef, true);
1241      }
1242
1243      public boolean isEmpty() {
1244        return super.isEmpty() && (coverage == null || coverage.isEmpty()) && (preAuthRef == null || preAuthRef.isEmpty())
1245          ;
1246      }
1247
1248  public String fhirType() {
1249    return "ExplanationOfBenefit.coverage";
1250
1251  }
1252
1253  }
1254
1255    @Block()
1256    public static class OnsetComponent extends BackboneElement implements IBaseBackboneElement {
1257        /**
1258         * The start or start and end dates for the treatable condition.
1259         */
1260        @Child(name = "time", type = {DateType.class, Period.class}, order=1, min=0, max=1, modifier=false, summary=true)
1261        @Description(shortDefinition="Illness, injury or treatable condition date", formalDefinition="The start or start and end dates for the treatable condition." )
1262        protected Type time;
1263
1264        /**
1265         * Onset typifications eg. Start of pregnancy, start of illnes, etc.
1266         */
1267        @Child(name = "type", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
1268        @Description(shortDefinition="Onset of what", formalDefinition="Onset typifications eg. Start of pregnancy, start of illnes, etc." )
1269        protected Coding type;
1270
1271        private static final long serialVersionUID = -560173231L;
1272
1273    /**
1274     * Constructor
1275     */
1276      public OnsetComponent() {
1277        super();
1278      }
1279
1280        /**
1281         * @return {@link #time} (The start or start and end dates for the treatable condition.)
1282         */
1283        public Type getTime() { 
1284          return this.time;
1285        }
1286
1287        /**
1288         * @return {@link #time} (The start or start and end dates for the treatable condition.)
1289         */
1290        public DateType getTimeDateType() throws FHIRException { 
1291          if (!(this.time instanceof DateType))
1292            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.time.getClass().getName()+" was encountered");
1293          return (DateType) this.time;
1294        }
1295
1296        public boolean hasTimeDateType() { 
1297          return this.time instanceof DateType;
1298        }
1299
1300        /**
1301         * @return {@link #time} (The start or start and end dates for the treatable condition.)
1302         */
1303        public Period getTimePeriod() throws FHIRException { 
1304          if (!(this.time instanceof Period))
1305            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.time.getClass().getName()+" was encountered");
1306          return (Period) this.time;
1307        }
1308
1309        public boolean hasTimePeriod() { 
1310          return this.time instanceof Period;
1311        }
1312
1313        public boolean hasTime() { 
1314          return this.time != null && !this.time.isEmpty();
1315        }
1316
1317        /**
1318         * @param value {@link #time} (The start or start and end dates for the treatable condition.)
1319         */
1320        public OnsetComponent setTime(Type value) { 
1321          this.time = value;
1322          return this;
1323        }
1324
1325        /**
1326         * @return {@link #type} (Onset typifications eg. Start of pregnancy, start of illnes, etc.)
1327         */
1328        public Coding getType() { 
1329          if (this.type == null)
1330            if (Configuration.errorOnAutoCreate())
1331              throw new Error("Attempt to auto-create OnsetComponent.type");
1332            else if (Configuration.doAutoCreate())
1333              this.type = new Coding(); // cc
1334          return this.type;
1335        }
1336
1337        public boolean hasType() { 
1338          return this.type != null && !this.type.isEmpty();
1339        }
1340
1341        /**
1342         * @param value {@link #type} (Onset typifications eg. Start of pregnancy, start of illnes, etc.)
1343         */
1344        public OnsetComponent setType(Coding value) { 
1345          this.type = value;
1346          return this;
1347        }
1348
1349        protected void listChildren(List<Property> childrenList) {
1350          super.listChildren(childrenList);
1351          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));
1352          childrenList.add(new Property("type", "Coding", "Onset typifications eg. Start of pregnancy, start of illnes, etc.", 0, java.lang.Integer.MAX_VALUE, type));
1353        }
1354
1355      @Override
1356      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1357        switch (hash) {
1358        case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // Type
1359        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
1360        default: return super.getProperty(hash, name, checkValid);
1361        }
1362
1363      }
1364
1365      @Override
1366      public void setProperty(int hash, String name, Base value) throws FHIRException {
1367        switch (hash) {
1368        case 3560141: // time
1369          this.time = (Type) value; // Type
1370          break;
1371        case 3575610: // type
1372          this.type = castToCoding(value); // Coding
1373          break;
1374        default: super.setProperty(hash, name, value);
1375        }
1376
1377      }
1378
1379      @Override
1380      public void setProperty(String name, Base value) throws FHIRException {
1381        if (name.equals("time[x]"))
1382          this.time = (Type) value; // Type
1383        else if (name.equals("type"))
1384          this.type = castToCoding(value); // Coding
1385        else
1386          super.setProperty(name, value);
1387      }
1388
1389      @Override
1390      public Base makeProperty(int hash, String name) throws FHIRException {
1391        switch (hash) {
1392        case -1313930605:  return getTime(); // Type
1393        case 3575610:  return getType(); // Coding
1394        default: return super.makeProperty(hash, name);
1395        }
1396
1397      }
1398
1399      @Override
1400      public Base addChild(String name) throws FHIRException {
1401        if (name.equals("timeDate")) {
1402          this.time = new DateType();
1403          return this.time;
1404        }
1405        else if (name.equals("timePeriod")) {
1406          this.time = new Period();
1407          return this.time;
1408        }
1409        else if (name.equals("type")) {
1410          this.type = new Coding();
1411          return this.type;
1412        }
1413        else
1414          return super.addChild(name);
1415      }
1416
1417      public OnsetComponent copy() {
1418        OnsetComponent dst = new OnsetComponent();
1419        copyValues(dst);
1420        dst.time = time == null ? null : time.copy();
1421        dst.type = type == null ? null : type.copy();
1422        return dst;
1423      }
1424
1425      @Override
1426      public boolean equalsDeep(Base other) {
1427        if (!super.equalsDeep(other))
1428          return false;
1429        if (!(other instanceof OnsetComponent))
1430          return false;
1431        OnsetComponent o = (OnsetComponent) other;
1432        return compareDeep(time, o.time, true) && compareDeep(type, o.type, true);
1433      }
1434
1435      @Override
1436      public boolean equalsShallow(Base other) {
1437        if (!super.equalsShallow(other))
1438          return false;
1439        if (!(other instanceof OnsetComponent))
1440          return false;
1441        OnsetComponent o = (OnsetComponent) other;
1442        return true;
1443      }
1444
1445      public boolean isEmpty() {
1446        return super.isEmpty() && (time == null || time.isEmpty()) && (type == null || type.isEmpty())
1447          ;
1448      }
1449
1450  public String fhirType() {
1451    return "ExplanationOfBenefit.onset";
1452
1453  }
1454
1455  }
1456
1457    @Block()
1458    public static class ItemsComponent extends BackboneElement implements IBaseBackboneElement {
1459        /**
1460         * A service line number.
1461         */
1462        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1463        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
1464        protected PositiveIntType sequence;
1465
1466        /**
1467         * The type of product or service.
1468         */
1469        @Child(name = "type", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
1470        @Description(shortDefinition="Group or type of product or service", formalDefinition="The type of product or service." )
1471        protected Coding type;
1472
1473        /**
1474         * The practitioner who is responsible for the services rendered to the patient.
1475         */
1476        @Child(name = "provider", type = {Identifier.class, Practitioner.class}, order=3, min=0, max=1, modifier=false, summary=true)
1477        @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
1478        protected Type provider;
1479
1480        /**
1481         * The practitioner who is supervising the work of the servicing provider(s).
1482         */
1483        @Child(name = "supervisor", type = {Identifier.class, Practitioner.class}, order=4, min=0, max=1, modifier=false, summary=true)
1484        @Description(shortDefinition="Supervising Practitioner", formalDefinition="The practitioner who is supervising the work of the servicing provider(s)." )
1485        protected Type supervisor;
1486
1487        /**
1488         * The qualification which is applicable for this service.
1489         */
1490        @Child(name = "providerQualification", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
1491        @Description(shortDefinition="Type, classification or Specialization", formalDefinition="The qualification which is applicable for this service." )
1492        protected Coding providerQualification;
1493
1494        /**
1495         * Diagnosis applicable for this service or product line.
1496         */
1497        @Child(name = "diagnosisLinkId", type = {PositiveIntType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1498        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnosis applicable for this service or product line." )
1499        protected List<PositiveIntType> diagnosisLinkId;
1500
1501        /**
1502         * If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.
1503         */
1504        @Child(name = "service", type = {Coding.class}, order=7, min=1, max=1, modifier=false, summary=true)
1505        @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." )
1506        protected Coding service;
1507
1508        /**
1509         * Unusual circumstances which may influence adjudication.
1510         */
1511        @Child(name = "serviceModifier", type = {Coding.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1512        @Description(shortDefinition="Service/Product modifiers", formalDefinition="Unusual circumstances which may influence adjudication." )
1513        protected List<Coding> serviceModifier;
1514
1515        /**
1516         * 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         */
1518        @Child(name = "modifier", type = {Coding.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1519        @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." )
1520        protected List<Coding> modifier;
1521
1522        /**
1523         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
1524         */
1525        @Child(name = "programCode", type = {Coding.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1526        @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." )
1527        protected List<Coding> programCode;
1528
1529        /**
1530         * The date or dates when the enclosed suite of services were performed or completed.
1531         */
1532        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=true)
1533        @Description(shortDefinition="Date or dates of Service", formalDefinition="The date or dates when the enclosed suite of services were performed or completed." )
1534        protected Type serviced;
1535
1536        /**
1537         * Where the service was provided.
1538         */
1539        @Child(name = "place", type = {Coding.class}, order=12, min=0, max=1, modifier=false, summary=true)
1540        @Description(shortDefinition="Place of service", formalDefinition="Where the service was provided." )
1541        protected Coding place;
1542
1543        /**
1544         * The number of repetitions of a service or product.
1545         */
1546        @Child(name = "quantity", type = {SimpleQuantity.class}, order=13, min=0, max=1, modifier=false, summary=true)
1547        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
1548        protected SimpleQuantity quantity;
1549
1550        /**
1551         * 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         */
1553        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=true)
1554        @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." )
1555        protected Money unitPrice;
1556
1557        /**
1558         * 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         */
1560        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=true)
1561        @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." )
1562        protected DecimalType factor;
1563
1564        /**
1565         * 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         */
1567        @Child(name = "points", type = {DecimalType.class}, order=16, min=0, max=1, modifier=false, summary=true)
1568        @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." )
1569        protected DecimalType points;
1570
1571        /**
1572         * 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         */
1574        @Child(name = "net", type = {Money.class}, order=17, min=0, max=1, modifier=false, summary=true)
1575        @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." )
1576        protected Money net;
1577
1578        /**
1579         * List of Unique Device Identifiers associated with this line item.
1580         */
1581        @Child(name = "udi", type = {Device.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1582        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
1583        protected List<Reference> udi;
1584        /**
1585         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
1586         */
1587        protected List<Device> udiTarget;
1588
1589
1590        /**
1591         * Physical service site on the patient (limb, tooth, etc).
1592         */
1593        @Child(name = "bodySite", type = {Coding.class}, order=19, min=0, max=1, modifier=false, summary=true)
1594        @Description(shortDefinition="Service Location", formalDefinition="Physical service site on the patient (limb, tooth, etc)." )
1595        protected Coding bodySite;
1596
1597        /**
1598         * A region or surface of the site, eg. limb region or tooth surface(s).
1599         */
1600        @Child(name = "subSite", type = {Coding.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1601        @Description(shortDefinition="Service Sub-location", formalDefinition="A region or surface of the site, eg. limb region or tooth surface(s)." )
1602        protected List<Coding> subSite;
1603
1604        /**
1605         * A list of note references to the notes provided below.
1606         */
1607        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1608        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
1609        protected List<PositiveIntType> noteNumber;
1610
1611        /**
1612         * The adjudications results.
1613         */
1614        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1615        @Description(shortDefinition="Adjudication details", formalDefinition="The adjudications results." )
1616        protected List<ItemAdjudicationComponent> adjudication;
1617
1618        /**
1619         * Second tier of goods and services.
1620         */
1621        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1622        @Description(shortDefinition="Additional items", formalDefinition="Second tier of goods and services." )
1623        protected List<DetailComponent> detail;
1624
1625        /**
1626         * The materials and placement date of prior fixed prosthesis.
1627         */
1628        @Child(name = "prosthesis", type = {}, order=24, min=0, max=1, modifier=false, summary=true)
1629        @Description(shortDefinition="Prosthetic details", formalDefinition="The materials and placement date of prior fixed prosthesis." )
1630        protected ProsthesisComponent prosthesis;
1631
1632        private static final long serialVersionUID = 2037926144L;
1633
1634    /**
1635     * Constructor
1636     */
1637      public ItemsComponent() {
1638        super();
1639      }
1640
1641    /**
1642     * Constructor
1643     */
1644      public ItemsComponent(PositiveIntType sequence, Coding type, Coding service) {
1645        super();
1646        this.sequence = sequence;
1647        this.type = type;
1648        this.service = service;
1649      }
1650
1651        /**
1652         * @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
1653         */
1654        public PositiveIntType getSequenceElement() { 
1655          if (this.sequence == null)
1656            if (Configuration.errorOnAutoCreate())
1657              throw new Error("Attempt to auto-create ItemsComponent.sequence");
1658            else if (Configuration.doAutoCreate())
1659              this.sequence = new PositiveIntType(); // bb
1660          return this.sequence;
1661        }
1662
1663        public boolean hasSequenceElement() { 
1664          return this.sequence != null && !this.sequence.isEmpty();
1665        }
1666
1667        public boolean hasSequence() { 
1668          return this.sequence != null && !this.sequence.isEmpty();
1669        }
1670
1671        /**
1672         * @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
1673         */
1674        public ItemsComponent setSequenceElement(PositiveIntType value) { 
1675          this.sequence = value;
1676          return this;
1677        }
1678
1679        /**
1680         * @return A service line number.
1681         */
1682        public int getSequence() { 
1683          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1684        }
1685
1686        /**
1687         * @param value A service line number.
1688         */
1689        public ItemsComponent setSequence(int value) { 
1690            if (this.sequence == null)
1691              this.sequence = new PositiveIntType();
1692            this.sequence.setValue(value);
1693          return this;
1694        }
1695
1696        /**
1697         * @return {@link #type} (The type of product or service.)
1698         */
1699        public Coding getType() { 
1700          if (this.type == null)
1701            if (Configuration.errorOnAutoCreate())
1702              throw new Error("Attempt to auto-create ItemsComponent.type");
1703            else if (Configuration.doAutoCreate())
1704              this.type = new Coding(); // cc
1705          return this.type;
1706        }
1707
1708        public boolean hasType() { 
1709          return this.type != null && !this.type.isEmpty();
1710        }
1711
1712        /**
1713         * @param value {@link #type} (The type of product or service.)
1714         */
1715        public ItemsComponent setType(Coding value) { 
1716          this.type = value;
1717          return this;
1718        }
1719
1720        /**
1721         * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1722         */
1723        public Type getProvider() { 
1724          return this.provider;
1725        }
1726
1727        /**
1728         * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1729         */
1730        public Identifier getProviderIdentifier() throws FHIRException { 
1731          if (!(this.provider instanceof Identifier))
1732            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.provider.getClass().getName()+" was encountered");
1733          return (Identifier) this.provider;
1734        }
1735
1736        public boolean hasProviderIdentifier() { 
1737          return this.provider instanceof Identifier;
1738        }
1739
1740        /**
1741         * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1742         */
1743        public Reference getProviderReference() throws FHIRException { 
1744          if (!(this.provider instanceof Reference))
1745            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.provider.getClass().getName()+" was encountered");
1746          return (Reference) this.provider;
1747        }
1748
1749        public boolean hasProviderReference() { 
1750          return this.provider instanceof Reference;
1751        }
1752
1753        public boolean hasProvider() { 
1754          return this.provider != null && !this.provider.isEmpty();
1755        }
1756
1757        /**
1758         * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
1759         */
1760        public ItemsComponent setProvider(Type value) { 
1761          this.provider = value;
1762          return this;
1763        }
1764
1765        /**
1766         * @return {@link #supervisor} (The practitioner who is supervising the work of the servicing provider(s).)
1767         */
1768        public Type getSupervisor() { 
1769          return this.supervisor;
1770        }
1771
1772        /**
1773         * @return {@link #supervisor} (The practitioner who is supervising the work of the servicing provider(s).)
1774         */
1775        public Identifier getSupervisorIdentifier() throws FHIRException { 
1776          if (!(this.supervisor instanceof Identifier))
1777            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.supervisor.getClass().getName()+" was encountered");
1778          return (Identifier) this.supervisor;
1779        }
1780
1781        public boolean hasSupervisorIdentifier() { 
1782          return this.supervisor instanceof Identifier;
1783        }
1784
1785        /**
1786         * @return {@link #supervisor} (The practitioner who is supervising the work of the servicing provider(s).)
1787         */
1788        public Reference getSupervisorReference() throws FHIRException { 
1789          if (!(this.supervisor instanceof Reference))
1790            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.supervisor.getClass().getName()+" was encountered");
1791          return (Reference) this.supervisor;
1792        }
1793
1794        public boolean hasSupervisorReference() { 
1795          return this.supervisor instanceof Reference;
1796        }
1797
1798        public boolean hasSupervisor() { 
1799          return this.supervisor != null && !this.supervisor.isEmpty();
1800        }
1801
1802        /**
1803         * @param value {@link #supervisor} (The practitioner who is supervising the work of the servicing provider(s).)
1804         */
1805        public ItemsComponent setSupervisor(Type value) { 
1806          this.supervisor = value;
1807          return this;
1808        }
1809
1810        /**
1811         * @return {@link #providerQualification} (The qualification which is applicable for this service.)
1812         */
1813        public Coding getProviderQualification() { 
1814          if (this.providerQualification == null)
1815            if (Configuration.errorOnAutoCreate())
1816              throw new Error("Attempt to auto-create ItemsComponent.providerQualification");
1817            else if (Configuration.doAutoCreate())
1818              this.providerQualification = new Coding(); // cc
1819          return this.providerQualification;
1820        }
1821
1822        public boolean hasProviderQualification() { 
1823          return this.providerQualification != null && !this.providerQualification.isEmpty();
1824        }
1825
1826        /**
1827         * @param value {@link #providerQualification} (The qualification which is applicable for this service.)
1828         */
1829        public ItemsComponent setProviderQualification(Coding value) { 
1830          this.providerQualification = value;
1831          return this;
1832        }
1833
1834        /**
1835         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1836         */
1837        public List<PositiveIntType> getDiagnosisLinkId() { 
1838          if (this.diagnosisLinkId == null)
1839            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
1840          return this.diagnosisLinkId;
1841        }
1842
1843        public boolean hasDiagnosisLinkId() { 
1844          if (this.diagnosisLinkId == null)
1845            return false;
1846          for (PositiveIntType item : this.diagnosisLinkId)
1847            if (!item.isEmpty())
1848              return true;
1849          return false;
1850        }
1851
1852        /**
1853         * @return {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1854         */
1855    // syntactic sugar
1856        public PositiveIntType addDiagnosisLinkIdElement() {//2 
1857          PositiveIntType t = new PositiveIntType();
1858          if (this.diagnosisLinkId == null)
1859            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
1860          this.diagnosisLinkId.add(t);
1861          return t;
1862        }
1863
1864        /**
1865         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1866         */
1867        public ItemsComponent addDiagnosisLinkId(int value) { //1
1868          PositiveIntType t = new PositiveIntType();
1869          t.setValue(value);
1870          if (this.diagnosisLinkId == null)
1871            this.diagnosisLinkId = new ArrayList<PositiveIntType>();
1872          this.diagnosisLinkId.add(t);
1873          return this;
1874        }
1875
1876        /**
1877         * @param value {@link #diagnosisLinkId} (Diagnosis applicable for this service or product line.)
1878         */
1879        public boolean hasDiagnosisLinkId(int value) { 
1880          if (this.diagnosisLinkId == null)
1881            return false;
1882          for (PositiveIntType v : this.diagnosisLinkId)
1883            if (v.equals(value)) // positiveInt
1884              return true;
1885          return false;
1886        }
1887
1888        /**
1889         * @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.)
1890         */
1891        public Coding getService() { 
1892          if (this.service == null)
1893            if (Configuration.errorOnAutoCreate())
1894              throw new Error("Attempt to auto-create ItemsComponent.service");
1895            else if (Configuration.doAutoCreate())
1896              this.service = new Coding(); // cc
1897          return this.service;
1898        }
1899
1900        public boolean hasService() { 
1901          return this.service != null && !this.service.isEmpty();
1902        }
1903
1904        /**
1905         * @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.)
1906         */
1907        public ItemsComponent setService(Coding value) { 
1908          this.service = value;
1909          return this;
1910        }
1911
1912        /**
1913         * @return {@link #serviceModifier} (Unusual circumstances which may influence adjudication.)
1914         */
1915        public List<Coding> getServiceModifier() { 
1916          if (this.serviceModifier == null)
1917            this.serviceModifier = new ArrayList<Coding>();
1918          return this.serviceModifier;
1919        }
1920
1921        public boolean hasServiceModifier() { 
1922          if (this.serviceModifier == null)
1923            return false;
1924          for (Coding item : this.serviceModifier)
1925            if (!item.isEmpty())
1926              return true;
1927          return false;
1928        }
1929
1930        /**
1931         * @return {@link #serviceModifier} (Unusual circumstances which may influence adjudication.)
1932         */
1933    // syntactic sugar
1934        public Coding addServiceModifier() { //3
1935          Coding t = new Coding();
1936          if (this.serviceModifier == null)
1937            this.serviceModifier = new ArrayList<Coding>();
1938          this.serviceModifier.add(t);
1939          return t;
1940        }
1941
1942    // syntactic sugar
1943        public ItemsComponent addServiceModifier(Coding t) { //3
1944          if (t == null)
1945            return this;
1946          if (this.serviceModifier == null)
1947            this.serviceModifier = new ArrayList<Coding>();
1948          this.serviceModifier.add(t);
1949          return this;
1950        }
1951
1952        /**
1953         * @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.)
1954         */
1955        public List<Coding> getModifier() { 
1956          if (this.modifier == null)
1957            this.modifier = new ArrayList<Coding>();
1958          return this.modifier;
1959        }
1960
1961        public boolean hasModifier() { 
1962          if (this.modifier == null)
1963            return false;
1964          for (Coding item : this.modifier)
1965            if (!item.isEmpty())
1966              return true;
1967          return false;
1968        }
1969
1970        /**
1971         * @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.)
1972         */
1973    // syntactic sugar
1974        public Coding addModifier() { //3
1975          Coding t = new Coding();
1976          if (this.modifier == null)
1977            this.modifier = new ArrayList<Coding>();
1978          this.modifier.add(t);
1979          return t;
1980        }
1981
1982    // syntactic sugar
1983        public ItemsComponent addModifier(Coding t) { //3
1984          if (t == null)
1985            return this;
1986          if (this.modifier == null)
1987            this.modifier = new ArrayList<Coding>();
1988          this.modifier.add(t);
1989          return this;
1990        }
1991
1992        /**
1993         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
1994         */
1995        public List<Coding> getProgramCode() { 
1996          if (this.programCode == null)
1997            this.programCode = new ArrayList<Coding>();
1998          return this.programCode;
1999        }
2000
2001        public boolean hasProgramCode() { 
2002          if (this.programCode == null)
2003            return false;
2004          for (Coding item : this.programCode)
2005            if (!item.isEmpty())
2006              return true;
2007          return false;
2008        }
2009
2010        /**
2011         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
2012         */
2013    // syntactic sugar
2014        public Coding addProgramCode() { //3
2015          Coding t = new Coding();
2016          if (this.programCode == null)
2017            this.programCode = new ArrayList<Coding>();
2018          this.programCode.add(t);
2019          return t;
2020        }
2021
2022    // syntactic sugar
2023        public ItemsComponent addProgramCode(Coding t) { //3
2024          if (t == null)
2025            return this;
2026          if (this.programCode == null)
2027            this.programCode = new ArrayList<Coding>();
2028          this.programCode.add(t);
2029          return this;
2030        }
2031
2032        /**
2033         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2034         */
2035        public Type getServiced() { 
2036          return this.serviced;
2037        }
2038
2039        /**
2040         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2041         */
2042        public DateType getServicedDateType() throws FHIRException { 
2043          if (!(this.serviced instanceof DateType))
2044            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
2045          return (DateType) this.serviced;
2046        }
2047
2048        public boolean hasServicedDateType() { 
2049          return this.serviced instanceof DateType;
2050        }
2051
2052        /**
2053         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2054         */
2055        public Period getServicedPeriod() throws FHIRException { 
2056          if (!(this.serviced instanceof Period))
2057            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
2058          return (Period) this.serviced;
2059        }
2060
2061        public boolean hasServicedPeriod() { 
2062          return this.serviced instanceof Period;
2063        }
2064
2065        public boolean hasServiced() { 
2066          return this.serviced != null && !this.serviced.isEmpty();
2067        }
2068
2069        /**
2070         * @param value {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
2071         */
2072        public ItemsComponent setServiced(Type value) { 
2073          this.serviced = value;
2074          return this;
2075        }
2076
2077        /**
2078         * @return {@link #place} (Where the service was provided.)
2079         */
2080        public Coding getPlace() { 
2081          if (this.place == null)
2082            if (Configuration.errorOnAutoCreate())
2083              throw new Error("Attempt to auto-create ItemsComponent.place");
2084            else if (Configuration.doAutoCreate())
2085              this.place = new Coding(); // cc
2086          return this.place;
2087        }
2088
2089        public boolean hasPlace() { 
2090          return this.place != null && !this.place.isEmpty();
2091        }
2092
2093        /**
2094         * @param value {@link #place} (Where the service was provided.)
2095         */
2096        public ItemsComponent setPlace(Coding value) { 
2097          this.place = value;
2098          return this;
2099        }
2100
2101        /**
2102         * @return {@link #quantity} (The number of repetitions of a service or product.)
2103         */
2104        public SimpleQuantity getQuantity() { 
2105          if (this.quantity == null)
2106            if (Configuration.errorOnAutoCreate())
2107              throw new Error("Attempt to auto-create ItemsComponent.quantity");
2108            else if (Configuration.doAutoCreate())
2109              this.quantity = new SimpleQuantity(); // cc
2110          return this.quantity;
2111        }
2112
2113        public boolean hasQuantity() { 
2114          return this.quantity != null && !this.quantity.isEmpty();
2115        }
2116
2117        /**
2118         * @param value {@link #quantity} (The number of repetitions of a service or product.)
2119         */
2120        public ItemsComponent setQuantity(SimpleQuantity value) { 
2121          this.quantity = value;
2122          return this;
2123        }
2124
2125        /**
2126         * @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.)
2127         */
2128        public Money getUnitPrice() { 
2129          if (this.unitPrice == null)
2130            if (Configuration.errorOnAutoCreate())
2131              throw new Error("Attempt to auto-create ItemsComponent.unitPrice");
2132            else if (Configuration.doAutoCreate())
2133              this.unitPrice = new Money(); // cc
2134          return this.unitPrice;
2135        }
2136
2137        public boolean hasUnitPrice() { 
2138          return this.unitPrice != null && !this.unitPrice.isEmpty();
2139        }
2140
2141        /**
2142         * @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.)
2143         */
2144        public ItemsComponent setUnitPrice(Money value) { 
2145          this.unitPrice = value;
2146          return this;
2147        }
2148
2149        /**
2150         * @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
2151         */
2152        public DecimalType getFactorElement() { 
2153          if (this.factor == null)
2154            if (Configuration.errorOnAutoCreate())
2155              throw new Error("Attempt to auto-create ItemsComponent.factor");
2156            else if (Configuration.doAutoCreate())
2157              this.factor = new DecimalType(); // bb
2158          return this.factor;
2159        }
2160
2161        public boolean hasFactorElement() { 
2162          return this.factor != null && !this.factor.isEmpty();
2163        }
2164
2165        public boolean hasFactor() { 
2166          return this.factor != null && !this.factor.isEmpty();
2167        }
2168
2169        /**
2170         * @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
2171         */
2172        public ItemsComponent setFactorElement(DecimalType value) { 
2173          this.factor = value;
2174          return this;
2175        }
2176
2177        /**
2178         * @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.
2179         */
2180        public BigDecimal getFactor() { 
2181          return this.factor == null ? null : this.factor.getValue();
2182        }
2183
2184        /**
2185         * @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.
2186         */
2187        public ItemsComponent setFactor(BigDecimal value) { 
2188          if (value == null)
2189            this.factor = null;
2190          else {
2191            if (this.factor == null)
2192              this.factor = new DecimalType();
2193            this.factor.setValue(value);
2194          }
2195          return this;
2196        }
2197
2198        /**
2199         * @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.
2200         */
2201        public ItemsComponent setFactor(long value) { 
2202              this.factor = new DecimalType();
2203            this.factor.setValue(value);
2204          return this;
2205        }
2206
2207        /**
2208         * @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.
2209         */
2210        public ItemsComponent setFactor(double value) { 
2211              this.factor = new DecimalType();
2212            this.factor.setValue(value);
2213          return this;
2214        }
2215
2216        /**
2217         * @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
2218         */
2219        public DecimalType getPointsElement() { 
2220          if (this.points == null)
2221            if (Configuration.errorOnAutoCreate())
2222              throw new Error("Attempt to auto-create ItemsComponent.points");
2223            else if (Configuration.doAutoCreate())
2224              this.points = new DecimalType(); // bb
2225          return this.points;
2226        }
2227
2228        public boolean hasPointsElement() { 
2229          return this.points != null && !this.points.isEmpty();
2230        }
2231
2232        public boolean hasPoints() { 
2233          return this.points != null && !this.points.isEmpty();
2234        }
2235
2236        /**
2237         * @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
2238         */
2239        public ItemsComponent setPointsElement(DecimalType value) { 
2240          this.points = value;
2241          return this;
2242        }
2243
2244        /**
2245         * @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.
2246         */
2247        public BigDecimal getPoints() { 
2248          return this.points == null ? null : this.points.getValue();
2249        }
2250
2251        /**
2252         * @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.
2253         */
2254        public ItemsComponent setPoints(BigDecimal value) { 
2255          if (value == null)
2256            this.points = null;
2257          else {
2258            if (this.points == null)
2259              this.points = new DecimalType();
2260            this.points.setValue(value);
2261          }
2262          return this;
2263        }
2264
2265        /**
2266         * @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.
2267         */
2268        public ItemsComponent setPoints(long value) { 
2269              this.points = new DecimalType();
2270            this.points.setValue(value);
2271          return this;
2272        }
2273
2274        /**
2275         * @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.
2276         */
2277        public ItemsComponent setPoints(double value) { 
2278              this.points = new DecimalType();
2279            this.points.setValue(value);
2280          return this;
2281        }
2282
2283        /**
2284         * @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.)
2285         */
2286        public Money getNet() { 
2287          if (this.net == null)
2288            if (Configuration.errorOnAutoCreate())
2289              throw new Error("Attempt to auto-create ItemsComponent.net");
2290            else if (Configuration.doAutoCreate())
2291              this.net = new Money(); // cc
2292          return this.net;
2293        }
2294
2295        public boolean hasNet() { 
2296          return this.net != null && !this.net.isEmpty();
2297        }
2298
2299        /**
2300         * @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.)
2301         */
2302        public ItemsComponent setNet(Money value) { 
2303          this.net = value;
2304          return this;
2305        }
2306
2307        /**
2308         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
2309         */
2310        public List<Reference> getUdi() { 
2311          if (this.udi == null)
2312            this.udi = new ArrayList<Reference>();
2313          return this.udi;
2314        }
2315
2316        public boolean hasUdi() { 
2317          if (this.udi == null)
2318            return false;
2319          for (Reference item : this.udi)
2320            if (!item.isEmpty())
2321              return true;
2322          return false;
2323        }
2324
2325        /**
2326         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
2327         */
2328    // syntactic sugar
2329        public Reference addUdi() { //3
2330          Reference t = new Reference();
2331          if (this.udi == null)
2332            this.udi = new ArrayList<Reference>();
2333          this.udi.add(t);
2334          return t;
2335        }
2336
2337    // syntactic sugar
2338        public ItemsComponent addUdi(Reference t) { //3
2339          if (t == null)
2340            return this;
2341          if (this.udi == null)
2342            this.udi = new ArrayList<Reference>();
2343          this.udi.add(t);
2344          return this;
2345        }
2346
2347        /**
2348         * @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.)
2349         */
2350        public List<Device> getUdiTarget() { 
2351          if (this.udiTarget == null)
2352            this.udiTarget = new ArrayList<Device>();
2353          return this.udiTarget;
2354        }
2355
2356    // syntactic sugar
2357        /**
2358         * @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.)
2359         */
2360        public Device addUdiTarget() { 
2361          Device r = new Device();
2362          if (this.udiTarget == null)
2363            this.udiTarget = new ArrayList<Device>();
2364          this.udiTarget.add(r);
2365          return r;
2366        }
2367
2368        /**
2369         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
2370         */
2371        public Coding getBodySite() { 
2372          if (this.bodySite == null)
2373            if (Configuration.errorOnAutoCreate())
2374              throw new Error("Attempt to auto-create ItemsComponent.bodySite");
2375            else if (Configuration.doAutoCreate())
2376              this.bodySite = new Coding(); // cc
2377          return this.bodySite;
2378        }
2379
2380        public boolean hasBodySite() { 
2381          return this.bodySite != null && !this.bodySite.isEmpty();
2382        }
2383
2384        /**
2385         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc).)
2386         */
2387        public ItemsComponent setBodySite(Coding value) { 
2388          this.bodySite = value;
2389          return this;
2390        }
2391
2392        /**
2393         * @return {@link #subSite} (A region or surface of the site, eg. limb region or tooth surface(s).)
2394         */
2395        public List<Coding> getSubSite() { 
2396          if (this.subSite == null)
2397            this.subSite = new ArrayList<Coding>();
2398          return this.subSite;
2399        }
2400
2401        public boolean hasSubSite() { 
2402          if (this.subSite == null)
2403            return false;
2404          for (Coding item : this.subSite)
2405            if (!item.isEmpty())
2406              return true;
2407          return false;
2408        }
2409
2410        /**
2411         * @return {@link #subSite} (A region or surface of the site, eg. limb region or tooth surface(s).)
2412         */
2413    // syntactic sugar
2414        public Coding addSubSite() { //3
2415          Coding t = new Coding();
2416          if (this.subSite == null)
2417            this.subSite = new ArrayList<Coding>();
2418          this.subSite.add(t);
2419          return t;
2420        }
2421
2422    // syntactic sugar
2423        public ItemsComponent addSubSite(Coding t) { //3
2424          if (t == null)
2425            return this;
2426          if (this.subSite == null)
2427            this.subSite = new ArrayList<Coding>();
2428          this.subSite.add(t);
2429          return this;
2430        }
2431
2432        /**
2433         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
2434         */
2435        public List<PositiveIntType> getNoteNumber() { 
2436          if (this.noteNumber == null)
2437            this.noteNumber = new ArrayList<PositiveIntType>();
2438          return this.noteNumber;
2439        }
2440
2441        public boolean hasNoteNumber() { 
2442          if (this.noteNumber == null)
2443            return false;
2444          for (PositiveIntType item : this.noteNumber)
2445            if (!item.isEmpty())
2446              return true;
2447          return false;
2448        }
2449
2450        /**
2451         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
2452         */
2453    // syntactic sugar
2454        public PositiveIntType addNoteNumberElement() {//2 
2455          PositiveIntType t = new PositiveIntType();
2456          if (this.noteNumber == null)
2457            this.noteNumber = new ArrayList<PositiveIntType>();
2458          this.noteNumber.add(t);
2459          return t;
2460        }
2461
2462        /**
2463         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
2464         */
2465        public ItemsComponent addNoteNumber(int value) { //1
2466          PositiveIntType t = new PositiveIntType();
2467          t.setValue(value);
2468          if (this.noteNumber == null)
2469            this.noteNumber = new ArrayList<PositiveIntType>();
2470          this.noteNumber.add(t);
2471          return this;
2472        }
2473
2474        /**
2475         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
2476         */
2477        public boolean hasNoteNumber(int value) { 
2478          if (this.noteNumber == null)
2479            return false;
2480          for (PositiveIntType v : this.noteNumber)
2481            if (v.equals(value)) // positiveInt
2482              return true;
2483          return false;
2484        }
2485
2486        /**
2487         * @return {@link #adjudication} (The adjudications results.)
2488         */
2489        public List<ItemAdjudicationComponent> getAdjudication() { 
2490          if (this.adjudication == null)
2491            this.adjudication = new ArrayList<ItemAdjudicationComponent>();
2492          return this.adjudication;
2493        }
2494
2495        public boolean hasAdjudication() { 
2496          if (this.adjudication == null)
2497            return false;
2498          for (ItemAdjudicationComponent item : this.adjudication)
2499            if (!item.isEmpty())
2500              return true;
2501          return false;
2502        }
2503
2504        /**
2505         * @return {@link #adjudication} (The adjudications results.)
2506         */
2507    // syntactic sugar
2508        public ItemAdjudicationComponent addAdjudication() { //3
2509          ItemAdjudicationComponent t = new ItemAdjudicationComponent();
2510          if (this.adjudication == null)
2511            this.adjudication = new ArrayList<ItemAdjudicationComponent>();
2512          this.adjudication.add(t);
2513          return t;
2514        }
2515
2516    // syntactic sugar
2517        public ItemsComponent addAdjudication(ItemAdjudicationComponent t) { //3
2518          if (t == null)
2519            return this;
2520          if (this.adjudication == null)
2521            this.adjudication = new ArrayList<ItemAdjudicationComponent>();
2522          this.adjudication.add(t);
2523          return this;
2524        }
2525
2526        /**
2527         * @return {@link #detail} (Second tier of goods and services.)
2528         */
2529        public List<DetailComponent> getDetail() { 
2530          if (this.detail == null)
2531            this.detail = new ArrayList<DetailComponent>();
2532          return this.detail;
2533        }
2534
2535        public boolean hasDetail() { 
2536          if (this.detail == null)
2537            return false;
2538          for (DetailComponent item : this.detail)
2539            if (!item.isEmpty())
2540              return true;
2541          return false;
2542        }
2543
2544        /**
2545         * @return {@link #detail} (Second tier of goods and services.)
2546         */
2547    // syntactic sugar
2548        public DetailComponent addDetail() { //3
2549          DetailComponent t = new DetailComponent();
2550          if (this.detail == null)
2551            this.detail = new ArrayList<DetailComponent>();
2552          this.detail.add(t);
2553          return t;
2554        }
2555
2556    // syntactic sugar
2557        public ItemsComponent addDetail(DetailComponent t) { //3
2558          if (t == null)
2559            return this;
2560          if (this.detail == null)
2561            this.detail = new ArrayList<DetailComponent>();
2562          this.detail.add(t);
2563          return this;
2564        }
2565
2566        /**
2567         * @return {@link #prosthesis} (The materials and placement date of prior fixed prosthesis.)
2568         */
2569        public ProsthesisComponent getProsthesis() { 
2570          if (this.prosthesis == null)
2571            if (Configuration.errorOnAutoCreate())
2572              throw new Error("Attempt to auto-create ItemsComponent.prosthesis");
2573            else if (Configuration.doAutoCreate())
2574              this.prosthesis = new ProsthesisComponent(); // cc
2575          return this.prosthesis;
2576        }
2577
2578        public boolean hasProsthesis() { 
2579          return this.prosthesis != null && !this.prosthesis.isEmpty();
2580        }
2581
2582        /**
2583         * @param value {@link #prosthesis} (The materials and placement date of prior fixed prosthesis.)
2584         */
2585        public ItemsComponent setProsthesis(ProsthesisComponent value) { 
2586          this.prosthesis = value;
2587          return this;
2588        }
2589
2590        protected void listChildren(List<Property> childrenList) {
2591          super.listChildren(childrenList);
2592          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
2593          childrenList.add(new Property("type", "Coding", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
2594          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));
2595          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));
2596          childrenList.add(new Property("providerQualification", "Coding", "The qualification which is applicable for this service.", 0, java.lang.Integer.MAX_VALUE, providerQualification));
2597          childrenList.add(new Property("diagnosisLinkId", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisLinkId));
2598          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));
2599          childrenList.add(new Property("serviceModifier", "Coding", "Unusual circumstances which may influence adjudication.", 0, java.lang.Integer.MAX_VALUE, serviceModifier));
2600          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));
2601          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));
2602          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));
2603          childrenList.add(new Property("place", "Coding", "Where the service was provided.", 0, java.lang.Integer.MAX_VALUE, place));
2604          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
2605          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));
2606          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));
2607          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));
2608          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));
2609          childrenList.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2610          childrenList.add(new Property("bodySite", "Coding", "Physical service site on the patient (limb, tooth, etc).", 0, java.lang.Integer.MAX_VALUE, bodySite));
2611          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));
2612          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
2613          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
2614          childrenList.add(new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
2615          childrenList.add(new Property("prosthesis", "", "The materials and placement date of prior fixed prosthesis.", 0, java.lang.Integer.MAX_VALUE, prosthesis));
2616        }
2617
2618      @Override
2619      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2620        switch (hash) {
2621        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2622        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
2623        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Type
2624        case -1697229976: /*supervisor*/ return this.supervisor == null ? new Base[0] : new Base[] {this.supervisor}; // Type
2625        case -1240156290: /*providerQualification*/ return this.providerQualification == null ? new Base[0] : new Base[] {this.providerQualification}; // Coding
2626        case -1659207418: /*diagnosisLinkId*/ return this.diagnosisLinkId == null ? new Base[0] : this.diagnosisLinkId.toArray(new Base[this.diagnosisLinkId.size()]); // PositiveIntType
2627        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // Coding
2628        case 615164076: /*serviceModifier*/ return this.serviceModifier == null ? new Base[0] : this.serviceModifier.toArray(new Base[this.serviceModifier.size()]); // Coding
2629        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // Coding
2630        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // Coding
2631        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
2632        case 106748167: /*place*/ return this.place == null ? new Base[0] : new Base[] {this.place}; // Coding
2633        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
2634        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
2635        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
2636        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
2637        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
2638        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2639        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // Coding
2640        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // Coding
2641        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
2642        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // ItemAdjudicationComponent
2643        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
2644        case -2138744398: /*prosthesis*/ return this.prosthesis == null ? new Base[0] : new Base[] {this.prosthesis}; // ProsthesisComponent
2645        default: return super.getProperty(hash, name, checkValid);
2646        }
2647
2648      }
2649
2650      @Override
2651      public void setProperty(int hash, String name, Base value) throws FHIRException {
2652        switch (hash) {
2653        case 1349547969: // sequence
2654          this.sequence = castToPositiveInt(value); // PositiveIntType
2655          break;
2656        case 3575610: // type
2657          this.type = castToCoding(value); // Coding
2658          break;
2659        case -987494927: // provider
2660          this.provider = (Type) value; // Type
2661          break;
2662        case -1697229976: // supervisor
2663          this.supervisor = (Type) value; // Type
2664          break;
2665        case -1240156290: // providerQualification
2666          this.providerQualification = castToCoding(value); // Coding
2667          break;
2668        case -1659207418: // diagnosisLinkId
2669          this.getDiagnosisLinkId().add(castToPositiveInt(value)); // PositiveIntType
2670          break;
2671        case 1984153269: // service
2672          this.service = castToCoding(value); // Coding
2673          break;
2674        case 615164076: // serviceModifier
2675          this.getServiceModifier().add(castToCoding(value)); // Coding
2676          break;
2677        case -615513385: // modifier
2678          this.getModifier().add(castToCoding(value)); // Coding
2679          break;
2680        case 1010065041: // programCode
2681          this.getProgramCode().add(castToCoding(value)); // Coding
2682          break;
2683        case 1379209295: // serviced
2684          this.serviced = (Type) value; // Type
2685          break;
2686        case 106748167: // place
2687          this.place = castToCoding(value); // Coding
2688          break;
2689        case -1285004149: // quantity
2690          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2691          break;
2692        case -486196699: // unitPrice
2693          this.unitPrice = castToMoney(value); // Money
2694          break;
2695        case -1282148017: // factor
2696          this.factor = castToDecimal(value); // DecimalType
2697          break;
2698        case -982754077: // points
2699          this.points = castToDecimal(value); // DecimalType
2700          break;
2701        case 108957: // net
2702          this.net = castToMoney(value); // Money
2703          break;
2704        case 115642: // udi
2705          this.getUdi().add(castToReference(value)); // Reference
2706          break;
2707        case 1702620169: // bodySite
2708          this.bodySite = castToCoding(value); // Coding
2709          break;
2710        case -1868566105: // subSite
2711          this.getSubSite().add(castToCoding(value)); // Coding
2712          break;
2713        case -1110033957: // noteNumber
2714          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
2715          break;
2716        case -231349275: // adjudication
2717          this.getAdjudication().add((ItemAdjudicationComponent) value); // ItemAdjudicationComponent
2718          break;
2719        case -1335224239: // detail
2720          this.getDetail().add((DetailComponent) value); // DetailComponent
2721          break;
2722        case -2138744398: // prosthesis
2723          this.prosthesis = (ProsthesisComponent) value; // ProsthesisComponent
2724          break;
2725        default: super.setProperty(hash, name, value);
2726        }
2727
2728      }
2729
2730      @Override
2731      public void setProperty(String name, Base value) throws FHIRException {
2732        if (name.equals("sequence"))
2733          this.sequence = castToPositiveInt(value); // PositiveIntType
2734        else if (name.equals("type"))
2735          this.type = castToCoding(value); // Coding
2736        else if (name.equals("provider[x]"))
2737          this.provider = (Type) value; // Type
2738        else if (name.equals("supervisor[x]"))
2739          this.supervisor = (Type) value; // Type
2740        else if (name.equals("providerQualification"))
2741          this.providerQualification = castToCoding(value); // Coding
2742        else if (name.equals("diagnosisLinkId"))
2743          this.getDiagnosisLinkId().add(castToPositiveInt(value));
2744        else if (name.equals("service"))
2745          this.service = castToCoding(value); // Coding
2746        else if (name.equals("serviceModifier"))
2747          this.getServiceModifier().add(castToCoding(value));
2748        else if (name.equals("modifier"))
2749          this.getModifier().add(castToCoding(value));
2750        else if (name.equals("programCode"))
2751          this.getProgramCode().add(castToCoding(value));
2752        else if (name.equals("serviced[x]"))
2753          this.serviced = (Type) value; // Type
2754        else if (name.equals("place"))
2755          this.place = castToCoding(value); // Coding
2756        else if (name.equals("quantity"))
2757          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2758        else if (name.equals("unitPrice"))
2759          this.unitPrice = castToMoney(value); // Money
2760        else if (name.equals("factor"))
2761          this.factor = castToDecimal(value); // DecimalType
2762        else if (name.equals("points"))
2763          this.points = castToDecimal(value); // DecimalType
2764        else if (name.equals("net"))
2765          this.net = castToMoney(value); // Money
2766        else if (name.equals("udi"))
2767          this.getUdi().add(castToReference(value));
2768        else if (name.equals("bodySite"))
2769          this.bodySite = castToCoding(value); // Coding
2770        else if (name.equals("subSite"))
2771          this.getSubSite().add(castToCoding(value));
2772        else if (name.equals("noteNumber"))
2773          this.getNoteNumber().add(castToPositiveInt(value));
2774        else if (name.equals("adjudication"))
2775          this.getAdjudication().add((ItemAdjudicationComponent) value);
2776        else if (name.equals("detail"))
2777          this.getDetail().add((DetailComponent) value);
2778        else if (name.equals("prosthesis"))
2779          this.prosthesis = (ProsthesisComponent) value; // ProsthesisComponent
2780        else
2781          super.setProperty(name, value);
2782      }
2783
2784      @Override
2785      public Base makeProperty(int hash, String name) throws FHIRException {
2786        switch (hash) {
2787        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
2788        case 3575610:  return getType(); // Coding
2789        case 2064698607:  return getProvider(); // Type
2790        case -1823115240:  return getSupervisor(); // Type
2791        case -1240156290:  return getProviderQualification(); // Coding
2792        case -1659207418: throw new FHIRException("Cannot make property diagnosisLinkId as it is not a complex type"); // PositiveIntType
2793        case 1984153269:  return getService(); // Coding
2794        case 615164076:  return addServiceModifier(); // Coding
2795        case -615513385:  return addModifier(); // Coding
2796        case 1010065041:  return addProgramCode(); // Coding
2797        case -1927922223:  return getServiced(); // Type
2798        case 106748167:  return getPlace(); // Coding
2799        case -1285004149:  return getQuantity(); // SimpleQuantity
2800        case -486196699:  return getUnitPrice(); // Money
2801        case -1282148017: throw new FHIRException("Cannot make property factor as it is not a complex type"); // DecimalType
2802        case -982754077: throw new FHIRException("Cannot make property points as it is not a complex type"); // DecimalType
2803        case 108957:  return getNet(); // Money
2804        case 115642:  return addUdi(); // Reference
2805        case 1702620169:  return getBodySite(); // Coding
2806        case -1868566105:  return addSubSite(); // Coding
2807        case -1110033957: throw new FHIRException("Cannot make property noteNumber as it is not a complex type"); // PositiveIntType
2808        case -231349275:  return addAdjudication(); // ItemAdjudicationComponent
2809        case -1335224239:  return addDetail(); // DetailComponent
2810        case -2138744398:  return getProsthesis(); // ProsthesisComponent
2811        default: return super.makeProperty(hash, name);
2812        }
2813
2814      }
2815
2816      @Override
2817      public Base addChild(String name) throws FHIRException {
2818        if (name.equals("sequence")) {
2819          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2820        }
2821        else if (name.equals("type")) {
2822          this.type = new Coding();
2823          return this.type;
2824        }
2825        else if (name.equals("providerIdentifier")) {
2826          this.provider = new Identifier();
2827          return this.provider;
2828        }
2829        else if (name.equals("providerReference")) {
2830          this.provider = new Reference();
2831          return this.provider;
2832        }
2833        else if (name.equals("supervisorIdentifier")) {
2834          this.supervisor = new Identifier();
2835          return this.supervisor;
2836        }
2837        else if (name.equals("supervisorReference")) {
2838          this.supervisor = new Reference();
2839          return this.supervisor;
2840        }
2841        else if (name.equals("providerQualification")) {
2842          this.providerQualification = new Coding();
2843          return this.providerQualification;
2844        }
2845        else if (name.equals("diagnosisLinkId")) {
2846          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisLinkId");
2847        }
2848        else if (name.equals("service")) {
2849          this.service = new Coding();
2850          return this.service;
2851        }
2852        else if (name.equals("serviceModifier")) {
2853          return addServiceModifier();
2854        }
2855        else if (name.equals("modifier")) {
2856          return addModifier();
2857        }
2858        else if (name.equals("programCode")) {
2859          return addProgramCode();
2860        }
2861        else if (name.equals("servicedDate")) {
2862          this.serviced = new DateType();
2863          return this.serviced;
2864        }
2865        else if (name.equals("servicedPeriod")) {
2866          this.serviced = new Period();
2867          return this.serviced;
2868        }
2869        else if (name.equals("place")) {
2870          this.place = new Coding();
2871          return this.place;
2872        }
2873        else if (name.equals("quantity")) {
2874          this.quantity = new SimpleQuantity();
2875          return this.quantity;
2876        }
2877        else if (name.equals("unitPrice")) {
2878          this.unitPrice = new Money();
2879          return this.unitPrice;
2880        }
2881        else if (name.equals("factor")) {
2882          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
2883        }
2884        else if (name.equals("points")) {
2885          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.points");
2886        }
2887        else if (name.equals("net")) {
2888          this.net = new Money();
2889          return this.net;
2890        }
2891        else if (name.equals("udi")) {
2892          return addUdi();
2893        }
2894        else if (name.equals("bodySite")) {
2895          this.bodySite = new Coding();
2896          return this.bodySite;
2897        }
2898        else if (name.equals("subSite")) {
2899          return addSubSite();
2900        }
2901        else if (name.equals("noteNumber")) {
2902          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
2903        }
2904        else if (name.equals("adjudication")) {
2905          return addAdjudication();
2906        }
2907        else if (name.equals("detail")) {
2908          return addDetail();
2909        }
2910        else if (name.equals("prosthesis")) {
2911          this.prosthesis = new ProsthesisComponent();
2912          return this.prosthesis;
2913        }
2914        else
2915          return super.addChild(name);
2916      }
2917
2918      public ItemsComponent copy() {
2919        ItemsComponent dst = new ItemsComponent();
2920        copyValues(dst);
2921        dst.sequence = sequence == null ? null : sequence.copy();
2922        dst.type = type == null ? null : type.copy();
2923        dst.provider = provider == null ? null : provider.copy();
2924        dst.supervisor = supervisor == null ? null : supervisor.copy();
2925        dst.providerQualification = providerQualification == null ? null : providerQualification.copy();
2926        if (diagnosisLinkId != null) {
2927          dst.diagnosisLinkId = new ArrayList<PositiveIntType>();
2928          for (PositiveIntType i : diagnosisLinkId)
2929            dst.diagnosisLinkId.add(i.copy());
2930        };
2931        dst.service = service == null ? null : service.copy();
2932        if (serviceModifier != null) {
2933          dst.serviceModifier = new ArrayList<Coding>();
2934          for (Coding i : serviceModifier)
2935            dst.serviceModifier.add(i.copy());
2936        };
2937        if (modifier != null) {
2938          dst.modifier = new ArrayList<Coding>();
2939          for (Coding i : modifier)
2940            dst.modifier.add(i.copy());
2941        };
2942        if (programCode != null) {
2943          dst.programCode = new ArrayList<Coding>();
2944          for (Coding i : programCode)
2945            dst.programCode.add(i.copy());
2946        };
2947        dst.serviced = serviced == null ? null : serviced.copy();
2948        dst.place = place == null ? null : place.copy();
2949        dst.quantity = quantity == null ? null : quantity.copy();
2950        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
2951        dst.factor = factor == null ? null : factor.copy();
2952        dst.points = points == null ? null : points.copy();
2953        dst.net = net == null ? null : net.copy();
2954        if (udi != null) {
2955          dst.udi = new ArrayList<Reference>();
2956          for (Reference i : udi)
2957            dst.udi.add(i.copy());
2958        };
2959        dst.bodySite = bodySite == null ? null : bodySite.copy();
2960        if (subSite != null) {
2961          dst.subSite = new ArrayList<Coding>();
2962          for (Coding i : subSite)
2963            dst.subSite.add(i.copy());
2964        };
2965        if (noteNumber != null) {
2966          dst.noteNumber = new ArrayList<PositiveIntType>();
2967          for (PositiveIntType i : noteNumber)
2968            dst.noteNumber.add(i.copy());
2969        };
2970        if (adjudication != null) {
2971          dst.adjudication = new ArrayList<ItemAdjudicationComponent>();
2972          for (ItemAdjudicationComponent i : adjudication)
2973            dst.adjudication.add(i.copy());
2974        };
2975        if (detail != null) {
2976          dst.detail = new ArrayList<DetailComponent>();
2977          for (DetailComponent i : detail)
2978            dst.detail.add(i.copy());
2979        };
2980        dst.prosthesis = prosthesis == null ? null : prosthesis.copy();
2981        return dst;
2982      }
2983
2984      @Override
2985      public boolean equalsDeep(Base other) {
2986        if (!super.equalsDeep(other))
2987          return false;
2988        if (!(other instanceof ItemsComponent))
2989          return false;
2990        ItemsComponent o = (ItemsComponent) other;
2991        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(provider, o.provider, true)
2992           && compareDeep(supervisor, o.supervisor, true) && compareDeep(providerQualification, o.providerQualification, true)
2993           && compareDeep(diagnosisLinkId, o.diagnosisLinkId, true) && compareDeep(service, o.service, true)
2994           && compareDeep(serviceModifier, o.serviceModifier, true) && compareDeep(modifier, o.modifier, true)
2995           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(place, o.place, true)
2996           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
2997           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
2998           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(noteNumber, o.noteNumber, true)
2999           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true) && compareDeep(prosthesis, o.prosthesis, true)
3000          ;
3001      }
3002
3003      @Override
3004      public boolean equalsShallow(Base other) {
3005        if (!super.equalsShallow(other))
3006          return false;
3007        if (!(other instanceof ItemsComponent))
3008          return false;
3009        ItemsComponent o = (ItemsComponent) other;
3010        return compareValues(sequence, o.sequence, true) && compareValues(diagnosisLinkId, o.diagnosisLinkId, true)
3011           && compareValues(factor, o.factor, true) && compareValues(points, o.points, true) && compareValues(noteNumber, o.noteNumber, true)
3012          ;
3013      }
3014
3015      public boolean isEmpty() {
3016        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (type == null || type.isEmpty())
3017           && (provider == null || provider.isEmpty()) && (supervisor == null || supervisor.isEmpty())
3018           && (providerQualification == null || providerQualification.isEmpty()) && (diagnosisLinkId == null || diagnosisLinkId.isEmpty())
3019           && (service == null || service.isEmpty()) && (serviceModifier == null || serviceModifier.isEmpty())
3020           && (modifier == null || modifier.isEmpty()) && (programCode == null || programCode.isEmpty())
3021           && (serviced == null || serviced.isEmpty()) && (place == null || place.isEmpty()) && (quantity == null || quantity.isEmpty())
3022           && (unitPrice == null || unitPrice.isEmpty()) && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty())
3023           && (net == null || net.isEmpty()) && (udi == null || udi.isEmpty()) && (bodySite == null || bodySite.isEmpty())
3024           && (subSite == null || subSite.isEmpty()) && (noteNumber == null || noteNumber.isEmpty())
3025           && (adjudication == null || adjudication.isEmpty()) && (detail == null || detail.isEmpty())
3026           && (prosthesis == null || prosthesis.isEmpty());
3027      }
3028
3029  public String fhirType() {
3030    return "ExplanationOfBenefit.item";
3031
3032  }
3033
3034  }
3035
3036    @Block()
3037    public static class ItemAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
3038        /**
3039         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
3040         */
3041        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
3042        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
3043        protected Coding category;
3044
3045        /**
3046         * Adjudication reason such as limit reached.
3047         */
3048        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
3049        @Description(shortDefinition="Adjudication reason", formalDefinition="Adjudication reason such as limit reached." )
3050        protected Coding reason;
3051
3052        /**
3053         * Monitory amount associated with the code.
3054         */
3055        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
3056        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
3057        protected Money amount;
3058
3059        /**
3060         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
3061         */
3062        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3063        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
3064        protected DecimalType value;
3065
3066        private static final long serialVersionUID = -1926987562L;
3067
3068    /**
3069     * Constructor
3070     */
3071      public ItemAdjudicationComponent() {
3072        super();
3073      }
3074
3075    /**
3076     * Constructor
3077     */
3078      public ItemAdjudicationComponent(Coding category) {
3079        super();
3080        this.category = category;
3081      }
3082
3083        /**
3084         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
3085         */
3086        public Coding getCategory() { 
3087          if (this.category == null)
3088            if (Configuration.errorOnAutoCreate())
3089              throw new Error("Attempt to auto-create ItemAdjudicationComponent.category");
3090            else if (Configuration.doAutoCreate())
3091              this.category = new Coding(); // cc
3092          return this.category;
3093        }
3094
3095        public boolean hasCategory() { 
3096          return this.category != null && !this.category.isEmpty();
3097        }
3098
3099        /**
3100         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
3101         */
3102        public ItemAdjudicationComponent setCategory(Coding value) { 
3103          this.category = value;
3104          return this;
3105        }
3106
3107        /**
3108         * @return {@link #reason} (Adjudication reason such as limit reached.)
3109         */
3110        public Coding getReason() { 
3111          if (this.reason == null)
3112            if (Configuration.errorOnAutoCreate())
3113              throw new Error("Attempt to auto-create ItemAdjudicationComponent.reason");
3114            else if (Configuration.doAutoCreate())
3115              this.reason = new Coding(); // cc
3116          return this.reason;
3117        }
3118
3119        public boolean hasReason() { 
3120          return this.reason != null && !this.reason.isEmpty();
3121        }
3122
3123        /**
3124         * @param value {@link #reason} (Adjudication reason such as limit reached.)
3125         */
3126        public ItemAdjudicationComponent setReason(Coding value) { 
3127          this.reason = value;
3128          return this;
3129        }
3130
3131        /**
3132         * @return {@link #amount} (Monitory amount associated with the code.)
3133         */
3134        public Money getAmount() { 
3135          if (this.amount == null)
3136            if (Configuration.errorOnAutoCreate())
3137              throw new Error("Attempt to auto-create ItemAdjudicationComponent.amount");
3138            else if (Configuration.doAutoCreate())
3139              this.amount = new Money(); // cc
3140          return this.amount;
3141        }
3142
3143        public boolean hasAmount() { 
3144          return this.amount != null && !this.amount.isEmpty();
3145        }
3146
3147        /**
3148         * @param value {@link #amount} (Monitory amount associated with the code.)
3149         */
3150        public ItemAdjudicationComponent setAmount(Money value) { 
3151          this.amount = value;
3152          return this;
3153        }
3154
3155        /**
3156         * @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
3157         */
3158        public DecimalType getValueElement() { 
3159          if (this.value == null)
3160            if (Configuration.errorOnAutoCreate())
3161              throw new Error("Attempt to auto-create ItemAdjudicationComponent.value");
3162            else if (Configuration.doAutoCreate())
3163              this.value = new DecimalType(); // bb
3164          return this.value;
3165        }
3166
3167        public boolean hasValueElement() { 
3168          return this.value != null && !this.value.isEmpty();
3169        }
3170
3171        public boolean hasValue() { 
3172          return this.value != null && !this.value.isEmpty();
3173        }
3174
3175        /**
3176         * @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
3177         */
3178        public ItemAdjudicationComponent setValueElement(DecimalType value) { 
3179          this.value = value;
3180          return this;
3181        }
3182
3183        /**
3184         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
3185         */
3186        public BigDecimal getValue() { 
3187          return this.value == null ? null : this.value.getValue();
3188        }
3189
3190        /**
3191         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
3192         */
3193        public ItemAdjudicationComponent setValue(BigDecimal value) { 
3194          if (value == null)
3195            this.value = null;
3196          else {
3197            if (this.value == null)
3198              this.value = new DecimalType();
3199            this.value.setValue(value);
3200          }
3201          return this;
3202        }
3203
3204        /**
3205         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
3206         */
3207        public ItemAdjudicationComponent setValue(long value) { 
3208              this.value = new DecimalType();
3209            this.value.setValue(value);
3210          return this;
3211        }
3212
3213        /**
3214         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
3215         */
3216        public ItemAdjudicationComponent setValue(double value) { 
3217              this.value = new DecimalType();
3218            this.value.setValue(value);
3219          return this;
3220        }
3221
3222        protected void listChildren(List<Property> childrenList) {
3223          super.listChildren(childrenList);
3224          childrenList.add(new Property("category", "Coding", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
3225          childrenList.add(new Property("reason", "Coding", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
3226          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
3227          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));
3228        }
3229
3230      @Override
3231      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3232        switch (hash) {
3233        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
3234        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
3235        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
3236        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
3237        default: return super.getProperty(hash, name, checkValid);
3238        }
3239
3240      }
3241
3242      @Override
3243      public void setProperty(int hash, String name, Base value) throws FHIRException {
3244        switch (hash) {
3245        case 50511102: // category
3246          this.category = castToCoding(value); // Coding
3247          break;
3248        case -934964668: // reason
3249          this.reason = castToCoding(value); // Coding
3250          break;
3251        case -1413853096: // amount
3252          this.amount = castToMoney(value); // Money
3253          break;
3254        case 111972721: // value
3255          this.value = castToDecimal(value); // DecimalType
3256          break;
3257        default: super.setProperty(hash, name, value);
3258        }
3259
3260      }
3261
3262      @Override
3263      public void setProperty(String name, Base value) throws FHIRException {
3264        if (name.equals("category"))
3265          this.category = castToCoding(value); // Coding
3266        else if (name.equals("reason"))
3267          this.reason = castToCoding(value); // Coding
3268        else if (name.equals("amount"))
3269          this.amount = castToMoney(value); // Money
3270        else if (name.equals("value"))
3271          this.value = castToDecimal(value); // DecimalType
3272        else
3273          super.setProperty(name, value);
3274      }
3275
3276      @Override
3277      public Base makeProperty(int hash, String name) throws FHIRException {
3278        switch (hash) {
3279        case 50511102:  return getCategory(); // Coding
3280        case -934964668:  return getReason(); // Coding
3281        case -1413853096:  return getAmount(); // Money
3282        case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // DecimalType
3283        default: return super.makeProperty(hash, name);
3284        }
3285
3286      }
3287
3288      @Override
3289      public Base addChild(String name) throws FHIRException {
3290        if (name.equals("category")) {
3291          this.category = new Coding();
3292          return this.category;
3293        }
3294        else if (name.equals("reason")) {
3295          this.reason = new Coding();
3296          return this.reason;
3297        }
3298        else if (name.equals("amount")) {
3299          this.amount = new Money();
3300          return this.amount;
3301        }
3302        else if (name.equals("value")) {
3303          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
3304        }
3305        else
3306          return super.addChild(name);
3307      }
3308
3309      public ItemAdjudicationComponent copy() {
3310        ItemAdjudicationComponent dst = new ItemAdjudicationComponent();
3311        copyValues(dst);
3312        dst.category = category == null ? null : category.copy();
3313        dst.reason = reason == null ? null : reason.copy();
3314        dst.amount = amount == null ? null : amount.copy();
3315        dst.value = value == null ? null : value.copy();
3316        return dst;
3317      }
3318
3319      @Override
3320      public boolean equalsDeep(Base other) {
3321        if (!super.equalsDeep(other))
3322          return false;
3323        if (!(other instanceof ItemAdjudicationComponent))
3324          return false;
3325        ItemAdjudicationComponent o = (ItemAdjudicationComponent) other;
3326        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
3327           && compareDeep(value, o.value, true);
3328      }
3329
3330      @Override
3331      public boolean equalsShallow(Base other) {
3332        if (!super.equalsShallow(other))
3333          return false;
3334        if (!(other instanceof ItemAdjudicationComponent))
3335          return false;
3336        ItemAdjudicationComponent o = (ItemAdjudicationComponent) other;
3337        return compareValues(value, o.value, true);
3338      }
3339
3340      public boolean isEmpty() {
3341        return super.isEmpty() && (category == null || category.isEmpty()) && (reason == null || reason.isEmpty())
3342           && (amount == null || amount.isEmpty()) && (value == null || value.isEmpty());
3343      }
3344
3345  public String fhirType() {
3346    return "ExplanationOfBenefit.item.adjudication";
3347
3348  }
3349
3350  }
3351
3352    @Block()
3353    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
3354        /**
3355         * A service line number.
3356         */
3357        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
3358        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
3359        protected PositiveIntType sequence;
3360
3361        /**
3362         * The type of product or service.
3363         */
3364        @Child(name = "type", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
3365        @Description(shortDefinition="Group or type of product or service", formalDefinition="The type of product or service." )
3366        protected Coding type;
3367
3368        /**
3369         * If a grouping item then 'GROUP' otherwise it is a node therefore a code to indicate the Professional Service or Product supplied.
3370         */
3371        @Child(name = "service", type = {Coding.class}, order=3, min=1, max=1, modifier=false, summary=true)
3372        @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." )
3373        protected Coding service;
3374
3375        /**
3376         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
3377         */
3378        @Child(name = "programCode", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3379        @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." )
3380        protected List<Coding> programCode;
3381
3382        /**
3383         * The number of repetitions of a service or product.
3384         */
3385        @Child(name = "quantity", type = {SimpleQuantity.class}, order=5, min=0, max=1, modifier=false, summary=true)
3386        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
3387        protected SimpleQuantity quantity;
3388
3389        /**
3390         * 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         */
3392        @Child(name = "unitPrice", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=true)
3393        @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." )
3394        protected Money unitPrice;
3395
3396        /**
3397         * 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         */
3399        @Child(name = "factor", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=true)
3400        @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." )
3401        protected DecimalType factor;
3402
3403        /**
3404         * 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         */
3406        @Child(name = "points", type = {DecimalType.class}, order=8, min=0, max=1, modifier=false, summary=true)
3407        @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." )
3408        protected DecimalType points;
3409
3410        /**
3411         * 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         */
3413        @Child(name = "net", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=true)
3414        @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." )
3415        protected Money net;
3416
3417        /**
3418         * List of Unique Device Identifiers associated with this line item.
3419         */
3420        @Child(name = "udi", type = {Device.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3421        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
3422        protected List<Reference> udi;
3423        /**
3424         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
3425         */
3426        protected List<Device> udiTarget;
3427
3428
3429        /**
3430         * The adjudications results.
3431         */
3432        @Child(name = "adjudication", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3433        @Description(shortDefinition="Detail adjudication", formalDefinition="The adjudications results." )
3434        protected List<DetailAdjudicationComponent> adjudication;
3435
3436        /**
3437         * Third tier of goods and services.
3438         */
3439        @Child(name = "subDetail", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3440        @Description(shortDefinition="Additional items", formalDefinition="Third tier of goods and services." )
3441        protected List<SubDetailComponent> subDetail;
3442
3443        private static final long serialVersionUID = -240637412L;
3444
3445    /**
3446     * Constructor
3447     */
3448      public DetailComponent() {
3449        super();
3450      }
3451
3452    /**
3453     * Constructor
3454     */
3455      public DetailComponent(PositiveIntType sequence, Coding type, Coding service) {
3456        super();
3457        this.sequence = sequence;
3458        this.type = type;
3459        this.service = service;
3460      }
3461
3462        /**
3463         * @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
3464         */
3465        public PositiveIntType getSequenceElement() { 
3466          if (this.sequence == null)
3467            if (Configuration.errorOnAutoCreate())
3468              throw new Error("Attempt to auto-create DetailComponent.sequence");
3469            else if (Configuration.doAutoCreate())
3470              this.sequence = new PositiveIntType(); // bb
3471          return this.sequence;
3472        }
3473
3474        public boolean hasSequenceElement() { 
3475          return this.sequence != null && !this.sequence.isEmpty();
3476        }
3477
3478        public boolean hasSequence() { 
3479          return this.sequence != null && !this.sequence.isEmpty();
3480        }
3481
3482        /**
3483         * @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
3484         */
3485        public DetailComponent setSequenceElement(PositiveIntType value) { 
3486          this.sequence = value;
3487          return this;
3488        }
3489
3490        /**
3491         * @return A service line number.
3492         */
3493        public int getSequence() { 
3494          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3495        }
3496
3497        /**
3498         * @param value A service line number.
3499         */
3500        public DetailComponent setSequence(int value) { 
3501            if (this.sequence == null)
3502              this.sequence = new PositiveIntType();
3503            this.sequence.setValue(value);
3504          return this;
3505        }
3506
3507        /**
3508         * @return {@link #type} (The type of product or service.)
3509         */
3510        public Coding getType() { 
3511          if (this.type == null)
3512            if (Configuration.errorOnAutoCreate())
3513              throw new Error("Attempt to auto-create DetailComponent.type");
3514            else if (Configuration.doAutoCreate())
3515              this.type = new Coding(); // cc
3516          return this.type;
3517        }
3518
3519        public boolean hasType() { 
3520          return this.type != null && !this.type.isEmpty();
3521        }
3522
3523        /**
3524         * @param value {@link #type} (The type of product or service.)
3525         */
3526        public DetailComponent setType(Coding value) { 
3527          this.type = value;
3528          return this;
3529        }
3530
3531        /**
3532         * @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.)
3533         */
3534        public Coding getService() { 
3535          if (this.service == null)
3536            if (Configuration.errorOnAutoCreate())
3537              throw new Error("Attempt to auto-create DetailComponent.service");
3538            else if (Configuration.doAutoCreate())
3539              this.service = new Coding(); // cc
3540          return this.service;
3541        }
3542
3543        public boolean hasService() { 
3544          return this.service != null && !this.service.isEmpty();
3545        }
3546
3547        /**
3548         * @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.)
3549         */
3550        public DetailComponent setService(Coding value) { 
3551          this.service = value;
3552          return this;
3553        }
3554
3555        /**
3556         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
3557         */
3558        public List<Coding> getProgramCode() { 
3559          if (this.programCode == null)
3560            this.programCode = new ArrayList<Coding>();
3561          return this.programCode;
3562        }
3563
3564        public boolean hasProgramCode() { 
3565          if (this.programCode == null)
3566            return false;
3567          for (Coding item : this.programCode)
3568            if (!item.isEmpty())
3569              return true;
3570          return false;
3571        }
3572
3573        /**
3574         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
3575         */
3576    // syntactic sugar
3577        public Coding addProgramCode() { //3
3578          Coding t = new Coding();
3579          if (this.programCode == null)
3580            this.programCode = new ArrayList<Coding>();
3581          this.programCode.add(t);
3582          return t;
3583        }
3584
3585    // syntactic sugar
3586        public DetailComponent addProgramCode(Coding t) { //3
3587          if (t == null)
3588            return this;
3589          if (this.programCode == null)
3590            this.programCode = new ArrayList<Coding>();
3591          this.programCode.add(t);
3592          return this;
3593        }
3594
3595        /**
3596         * @return {@link #quantity} (The number of repetitions of a service or product.)
3597         */
3598        public SimpleQuantity getQuantity() { 
3599          if (this.quantity == null)
3600            if (Configuration.errorOnAutoCreate())
3601              throw new Error("Attempt to auto-create DetailComponent.quantity");
3602            else if (Configuration.doAutoCreate())
3603              this.quantity = new SimpleQuantity(); // cc
3604          return this.quantity;
3605        }
3606
3607        public boolean hasQuantity() { 
3608          return this.quantity != null && !this.quantity.isEmpty();
3609        }
3610
3611        /**
3612         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3613         */
3614        public DetailComponent setQuantity(SimpleQuantity value) { 
3615          this.quantity = value;
3616          return this;
3617        }
3618
3619        /**
3620         * @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.)
3621         */
3622        public Money getUnitPrice() { 
3623          if (this.unitPrice == null)
3624            if (Configuration.errorOnAutoCreate())
3625              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
3626            else if (Configuration.doAutoCreate())
3627              this.unitPrice = new Money(); // cc
3628          return this.unitPrice;
3629        }
3630
3631        public boolean hasUnitPrice() { 
3632          return this.unitPrice != null && !this.unitPrice.isEmpty();
3633        }
3634
3635        /**
3636         * @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.)
3637         */
3638        public DetailComponent setUnitPrice(Money value) { 
3639          this.unitPrice = value;
3640          return this;
3641        }
3642
3643        /**
3644         * @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
3645         */
3646        public DecimalType getFactorElement() { 
3647          if (this.factor == null)
3648            if (Configuration.errorOnAutoCreate())
3649              throw new Error("Attempt to auto-create DetailComponent.factor");
3650            else if (Configuration.doAutoCreate())
3651              this.factor = new DecimalType(); // bb
3652          return this.factor;
3653        }
3654
3655        public boolean hasFactorElement() { 
3656          return this.factor != null && !this.factor.isEmpty();
3657        }
3658
3659        public boolean hasFactor() { 
3660          return this.factor != null && !this.factor.isEmpty();
3661        }
3662
3663        /**
3664         * @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
3665         */
3666        public DetailComponent setFactorElement(DecimalType value) { 
3667          this.factor = value;
3668          return this;
3669        }
3670
3671        /**
3672         * @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.
3673         */
3674        public BigDecimal getFactor() { 
3675          return this.factor == null ? null : this.factor.getValue();
3676        }
3677
3678        /**
3679         * @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.
3680         */
3681        public DetailComponent setFactor(BigDecimal value) { 
3682          if (value == null)
3683            this.factor = null;
3684          else {
3685            if (this.factor == null)
3686              this.factor = new DecimalType();
3687            this.factor.setValue(value);
3688          }
3689          return this;
3690        }
3691
3692        /**
3693         * @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.
3694         */
3695        public DetailComponent setFactor(long value) { 
3696              this.factor = new DecimalType();
3697            this.factor.setValue(value);
3698          return this;
3699        }
3700
3701        /**
3702         * @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.
3703         */
3704        public DetailComponent setFactor(double value) { 
3705              this.factor = new DecimalType();
3706            this.factor.setValue(value);
3707          return this;
3708        }
3709
3710        /**
3711         * @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
3712         */
3713        public DecimalType getPointsElement() { 
3714          if (this.points == null)
3715            if (Configuration.errorOnAutoCreate())
3716              throw new Error("Attempt to auto-create DetailComponent.points");
3717            else if (Configuration.doAutoCreate())
3718              this.points = new DecimalType(); // bb
3719          return this.points;
3720        }
3721
3722        public boolean hasPointsElement() { 
3723          return this.points != null && !this.points.isEmpty();
3724        }
3725
3726        public boolean hasPoints() { 
3727          return this.points != null && !this.points.isEmpty();
3728        }
3729
3730        /**
3731         * @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
3732         */
3733        public DetailComponent setPointsElement(DecimalType value) { 
3734          this.points = value;
3735          return this;
3736        }
3737
3738        /**
3739         * @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.
3740         */
3741        public BigDecimal getPoints() { 
3742          return this.points == null ? null : this.points.getValue();
3743        }
3744
3745        /**
3746         * @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.
3747         */
3748        public DetailComponent setPoints(BigDecimal value) { 
3749          if (value == null)
3750            this.points = null;
3751          else {
3752            if (this.points == null)
3753              this.points = new DecimalType();
3754            this.points.setValue(value);
3755          }
3756          return this;
3757        }
3758
3759        /**
3760         * @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.
3761         */
3762        public DetailComponent setPoints(long value) { 
3763              this.points = new DecimalType();
3764            this.points.setValue(value);
3765          return this;
3766        }
3767
3768        /**
3769         * @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.
3770         */
3771        public DetailComponent setPoints(double value) { 
3772              this.points = new DecimalType();
3773            this.points.setValue(value);
3774          return this;
3775        }
3776
3777        /**
3778         * @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.)
3779         */
3780        public Money getNet() { 
3781          if (this.net == null)
3782            if (Configuration.errorOnAutoCreate())
3783              throw new Error("Attempt to auto-create DetailComponent.net");
3784            else if (Configuration.doAutoCreate())
3785              this.net = new Money(); // cc
3786          return this.net;
3787        }
3788
3789        public boolean hasNet() { 
3790          return this.net != null && !this.net.isEmpty();
3791        }
3792
3793        /**
3794         * @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.)
3795         */
3796        public DetailComponent setNet(Money value) { 
3797          this.net = value;
3798          return this;
3799        }
3800
3801        /**
3802         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
3803         */
3804        public List<Reference> getUdi() { 
3805          if (this.udi == null)
3806            this.udi = new ArrayList<Reference>();
3807          return this.udi;
3808        }
3809
3810        public boolean hasUdi() { 
3811          if (this.udi == null)
3812            return false;
3813          for (Reference item : this.udi)
3814            if (!item.isEmpty())
3815              return true;
3816          return false;
3817        }
3818
3819        /**
3820         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
3821         */
3822    // syntactic sugar
3823        public Reference addUdi() { //3
3824          Reference t = new Reference();
3825          if (this.udi == null)
3826            this.udi = new ArrayList<Reference>();
3827          this.udi.add(t);
3828          return t;
3829        }
3830
3831    // syntactic sugar
3832        public DetailComponent addUdi(Reference t) { //3
3833          if (t == null)
3834            return this;
3835          if (this.udi == null)
3836            this.udi = new ArrayList<Reference>();
3837          this.udi.add(t);
3838          return this;
3839        }
3840
3841        /**
3842         * @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.)
3843         */
3844        public List<Device> getUdiTarget() { 
3845          if (this.udiTarget == null)
3846            this.udiTarget = new ArrayList<Device>();
3847          return this.udiTarget;
3848        }
3849
3850    // syntactic sugar
3851        /**
3852         * @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.)
3853         */
3854        public Device addUdiTarget() { 
3855          Device r = new Device();
3856          if (this.udiTarget == null)
3857            this.udiTarget = new ArrayList<Device>();
3858          this.udiTarget.add(r);
3859          return r;
3860        }
3861
3862        /**
3863         * @return {@link #adjudication} (The adjudications results.)
3864         */
3865        public List<DetailAdjudicationComponent> getAdjudication() { 
3866          if (this.adjudication == null)
3867            this.adjudication = new ArrayList<DetailAdjudicationComponent>();
3868          return this.adjudication;
3869        }
3870
3871        public boolean hasAdjudication() { 
3872          if (this.adjudication == null)
3873            return false;
3874          for (DetailAdjudicationComponent item : this.adjudication)
3875            if (!item.isEmpty())
3876              return true;
3877          return false;
3878        }
3879
3880        /**
3881         * @return {@link #adjudication} (The adjudications results.)
3882         */
3883    // syntactic sugar
3884        public DetailAdjudicationComponent addAdjudication() { //3
3885          DetailAdjudicationComponent t = new DetailAdjudicationComponent();
3886          if (this.adjudication == null)
3887            this.adjudication = new ArrayList<DetailAdjudicationComponent>();
3888          this.adjudication.add(t);
3889          return t;
3890        }
3891
3892    // syntactic sugar
3893        public DetailComponent addAdjudication(DetailAdjudicationComponent t) { //3
3894          if (t == null)
3895            return this;
3896          if (this.adjudication == null)
3897            this.adjudication = new ArrayList<DetailAdjudicationComponent>();
3898          this.adjudication.add(t);
3899          return this;
3900        }
3901
3902        /**
3903         * @return {@link #subDetail} (Third tier of goods and services.)
3904         */
3905        public List<SubDetailComponent> getSubDetail() { 
3906          if (this.subDetail == null)
3907            this.subDetail = new ArrayList<SubDetailComponent>();
3908          return this.subDetail;
3909        }
3910
3911        public boolean hasSubDetail() { 
3912          if (this.subDetail == null)
3913            return false;
3914          for (SubDetailComponent item : this.subDetail)
3915            if (!item.isEmpty())
3916              return true;
3917          return false;
3918        }
3919
3920        /**
3921         * @return {@link #subDetail} (Third tier of goods and services.)
3922         */
3923    // syntactic sugar
3924        public SubDetailComponent addSubDetail() { //3
3925          SubDetailComponent t = new SubDetailComponent();
3926          if (this.subDetail == null)
3927            this.subDetail = new ArrayList<SubDetailComponent>();
3928          this.subDetail.add(t);
3929          return t;
3930        }
3931
3932    // syntactic sugar
3933        public DetailComponent addSubDetail(SubDetailComponent t) { //3
3934          if (t == null)
3935            return this;
3936          if (this.subDetail == null)
3937            this.subDetail = new ArrayList<SubDetailComponent>();
3938          this.subDetail.add(t);
3939          return this;
3940        }
3941
3942        protected void listChildren(List<Property> childrenList) {
3943          super.listChildren(childrenList);
3944          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
3945          childrenList.add(new Property("type", "Coding", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
3946          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));
3947          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));
3948          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
3949          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));
3950          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));
3951          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));
3952          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));
3953          childrenList.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
3954          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
3955          childrenList.add(new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
3956        }
3957
3958      @Override
3959      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3960        switch (hash) {
3961        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
3962        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
3963        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // Coding
3964        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // Coding
3965        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
3966        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
3967        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
3968        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
3969        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
3970        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
3971        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // DetailAdjudicationComponent
3972        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
3973        default: return super.getProperty(hash, name, checkValid);
3974        }
3975
3976      }
3977
3978      @Override
3979      public void setProperty(int hash, String name, Base value) throws FHIRException {
3980        switch (hash) {
3981        case 1349547969: // sequence
3982          this.sequence = castToPositiveInt(value); // PositiveIntType
3983          break;
3984        case 3575610: // type
3985          this.type = castToCoding(value); // Coding
3986          break;
3987        case 1984153269: // service
3988          this.service = castToCoding(value); // Coding
3989          break;
3990        case 1010065041: // programCode
3991          this.getProgramCode().add(castToCoding(value)); // Coding
3992          break;
3993        case -1285004149: // quantity
3994          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
3995          break;
3996        case -486196699: // unitPrice
3997          this.unitPrice = castToMoney(value); // Money
3998          break;
3999        case -1282148017: // factor
4000          this.factor = castToDecimal(value); // DecimalType
4001          break;
4002        case -982754077: // points
4003          this.points = castToDecimal(value); // DecimalType
4004          break;
4005        case 108957: // net
4006          this.net = castToMoney(value); // Money
4007          break;
4008        case 115642: // udi
4009          this.getUdi().add(castToReference(value)); // Reference
4010          break;
4011        case -231349275: // adjudication
4012          this.getAdjudication().add((DetailAdjudicationComponent) value); // DetailAdjudicationComponent
4013          break;
4014        case -828829007: // subDetail
4015          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
4016          break;
4017        default: super.setProperty(hash, name, value);
4018        }
4019
4020      }
4021
4022      @Override
4023      public void setProperty(String name, Base value) throws FHIRException {
4024        if (name.equals("sequence"))
4025          this.sequence = castToPositiveInt(value); // PositiveIntType
4026        else if (name.equals("type"))
4027          this.type = castToCoding(value); // Coding
4028        else if (name.equals("service"))
4029          this.service = castToCoding(value); // Coding
4030        else if (name.equals("programCode"))
4031          this.getProgramCode().add(castToCoding(value));
4032        else if (name.equals("quantity"))
4033          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4034        else if (name.equals("unitPrice"))
4035          this.unitPrice = castToMoney(value); // Money
4036        else if (name.equals("factor"))
4037          this.factor = castToDecimal(value); // DecimalType
4038        else if (name.equals("points"))
4039          this.points = castToDecimal(value); // DecimalType
4040        else if (name.equals("net"))
4041          this.net = castToMoney(value); // Money
4042        else if (name.equals("udi"))
4043          this.getUdi().add(castToReference(value));
4044        else if (name.equals("adjudication"))
4045          this.getAdjudication().add((DetailAdjudicationComponent) value);
4046        else if (name.equals("subDetail"))
4047          this.getSubDetail().add((SubDetailComponent) value);
4048        else
4049          super.setProperty(name, value);
4050      }
4051
4052      @Override
4053      public Base makeProperty(int hash, String name) throws FHIRException {
4054        switch (hash) {
4055        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
4056        case 3575610:  return getType(); // Coding
4057        case 1984153269:  return getService(); // Coding
4058        case 1010065041:  return addProgramCode(); // Coding
4059        case -1285004149:  return getQuantity(); // SimpleQuantity
4060        case -486196699:  return getUnitPrice(); // Money
4061        case -1282148017: throw new FHIRException("Cannot make property factor as it is not a complex type"); // DecimalType
4062        case -982754077: throw new FHIRException("Cannot make property points as it is not a complex type"); // DecimalType
4063        case 108957:  return getNet(); // Money
4064        case 115642:  return addUdi(); // Reference
4065        case -231349275:  return addAdjudication(); // DetailAdjudicationComponent
4066        case -828829007:  return addSubDetail(); // SubDetailComponent
4067        default: return super.makeProperty(hash, name);
4068        }
4069
4070      }
4071
4072      @Override
4073      public Base addChild(String name) throws FHIRException {
4074        if (name.equals("sequence")) {
4075          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
4076        }
4077        else if (name.equals("type")) {
4078          this.type = new Coding();
4079          return this.type;
4080        }
4081        else if (name.equals("service")) {
4082          this.service = new Coding();
4083          return this.service;
4084        }
4085        else if (name.equals("programCode")) {
4086          return addProgramCode();
4087        }
4088        else if (name.equals("quantity")) {
4089          this.quantity = new SimpleQuantity();
4090          return this.quantity;
4091        }
4092        else if (name.equals("unitPrice")) {
4093          this.unitPrice = new Money();
4094          return this.unitPrice;
4095        }
4096        else if (name.equals("factor")) {
4097          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
4098        }
4099        else if (name.equals("points")) {
4100          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.points");
4101        }
4102        else if (name.equals("net")) {
4103          this.net = new Money();
4104          return this.net;
4105        }
4106        else if (name.equals("udi")) {
4107          return addUdi();
4108        }
4109        else if (name.equals("adjudication")) {
4110          return addAdjudication();
4111        }
4112        else if (name.equals("subDetail")) {
4113          return addSubDetail();
4114        }
4115        else
4116          return super.addChild(name);
4117      }
4118
4119      public DetailComponent copy() {
4120        DetailComponent dst = new DetailComponent();
4121        copyValues(dst);
4122        dst.sequence = sequence == null ? null : sequence.copy();
4123        dst.type = type == null ? null : type.copy();
4124        dst.service = service == null ? null : service.copy();
4125        if (programCode != null) {
4126          dst.programCode = new ArrayList<Coding>();
4127          for (Coding i : programCode)
4128            dst.programCode.add(i.copy());
4129        };
4130        dst.quantity = quantity == null ? null : quantity.copy();
4131        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4132        dst.factor = factor == null ? null : factor.copy();
4133        dst.points = points == null ? null : points.copy();
4134        dst.net = net == null ? null : net.copy();
4135        if (udi != null) {
4136          dst.udi = new ArrayList<Reference>();
4137          for (Reference i : udi)
4138            dst.udi.add(i.copy());
4139        };
4140        if (adjudication != null) {
4141          dst.adjudication = new ArrayList<DetailAdjudicationComponent>();
4142          for (DetailAdjudicationComponent i : adjudication)
4143            dst.adjudication.add(i.copy());
4144        };
4145        if (subDetail != null) {
4146          dst.subDetail = new ArrayList<SubDetailComponent>();
4147          for (SubDetailComponent i : subDetail)
4148            dst.subDetail.add(i.copy());
4149        };
4150        return dst;
4151      }
4152
4153      @Override
4154      public boolean equalsDeep(Base other) {
4155        if (!super.equalsDeep(other))
4156          return false;
4157        if (!(other instanceof DetailComponent))
4158          return false;
4159        DetailComponent o = (DetailComponent) other;
4160        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(service, o.service, true)
4161           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
4162           && compareDeep(factor, o.factor, true) && compareDeep(points, o.points, true) && compareDeep(net, o.net, true)
4163           && compareDeep(udi, o.udi, true) && compareDeep(adjudication, o.adjudication, true) && compareDeep(subDetail, o.subDetail, true)
4164          ;
4165      }
4166
4167      @Override
4168      public boolean equalsShallow(Base other) {
4169        if (!super.equalsShallow(other))
4170          return false;
4171        if (!(other instanceof DetailComponent))
4172          return false;
4173        DetailComponent o = (DetailComponent) other;
4174        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(points, o.points, true)
4175          ;
4176      }
4177
4178      public boolean isEmpty() {
4179        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (type == null || type.isEmpty())
4180           && (service == null || service.isEmpty()) && (programCode == null || programCode.isEmpty())
4181           && (quantity == null || quantity.isEmpty()) && (unitPrice == null || unitPrice.isEmpty())
4182           && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty()) && (net == null || net.isEmpty())
4183           && (udi == null || udi.isEmpty()) && (adjudication == null || adjudication.isEmpty()) && (subDetail == null || subDetail.isEmpty())
4184          ;
4185      }
4186
4187  public String fhirType() {
4188    return "ExplanationOfBenefit.item.detail";
4189
4190  }
4191
4192  }
4193
4194    @Block()
4195    public static class DetailAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
4196        /**
4197         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
4198         */
4199        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
4200        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
4201        protected Coding category;
4202
4203        /**
4204         * Adjudication reason such as limit reached.
4205         */
4206        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
4207        @Description(shortDefinition="Adjudication reason", formalDefinition="Adjudication reason such as limit reached." )
4208        protected Coding reason;
4209
4210        /**
4211         * Monitory amount associated with the code.
4212         */
4213        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
4214        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
4215        protected Money amount;
4216
4217        /**
4218         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4219         */
4220        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
4221        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
4222        protected DecimalType value;
4223
4224        private static final long serialVersionUID = -1926987562L;
4225
4226    /**
4227     * Constructor
4228     */
4229      public DetailAdjudicationComponent() {
4230        super();
4231      }
4232
4233    /**
4234     * Constructor
4235     */
4236      public DetailAdjudicationComponent(Coding category) {
4237        super();
4238        this.category = category;
4239      }
4240
4241        /**
4242         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4243         */
4244        public Coding getCategory() { 
4245          if (this.category == null)
4246            if (Configuration.errorOnAutoCreate())
4247              throw new Error("Attempt to auto-create DetailAdjudicationComponent.category");
4248            else if (Configuration.doAutoCreate())
4249              this.category = new Coding(); // cc
4250          return this.category;
4251        }
4252
4253        public boolean hasCategory() { 
4254          return this.category != null && !this.category.isEmpty();
4255        }
4256
4257        /**
4258         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
4259         */
4260        public DetailAdjudicationComponent setCategory(Coding value) { 
4261          this.category = value;
4262          return this;
4263        }
4264
4265        /**
4266         * @return {@link #reason} (Adjudication reason such as limit reached.)
4267         */
4268        public Coding getReason() { 
4269          if (this.reason == null)
4270            if (Configuration.errorOnAutoCreate())
4271              throw new Error("Attempt to auto-create DetailAdjudicationComponent.reason");
4272            else if (Configuration.doAutoCreate())
4273              this.reason = new Coding(); // cc
4274          return this.reason;
4275        }
4276
4277        public boolean hasReason() { 
4278          return this.reason != null && !this.reason.isEmpty();
4279        }
4280
4281        /**
4282         * @param value {@link #reason} (Adjudication reason such as limit reached.)
4283         */
4284        public DetailAdjudicationComponent setReason(Coding value) { 
4285          this.reason = value;
4286          return this;
4287        }
4288
4289        /**
4290         * @return {@link #amount} (Monitory amount associated with the code.)
4291         */
4292        public Money getAmount() { 
4293          if (this.amount == null)
4294            if (Configuration.errorOnAutoCreate())
4295              throw new Error("Attempt to auto-create DetailAdjudicationComponent.amount");
4296            else if (Configuration.doAutoCreate())
4297              this.amount = new Money(); // cc
4298          return this.amount;
4299        }
4300
4301        public boolean hasAmount() { 
4302          return this.amount != null && !this.amount.isEmpty();
4303        }
4304
4305        /**
4306         * @param value {@link #amount} (Monitory amount associated with the code.)
4307         */
4308        public DetailAdjudicationComponent setAmount(Money value) { 
4309          this.amount = value;
4310          return this;
4311        }
4312
4313        /**
4314         * @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
4315         */
4316        public DecimalType getValueElement() { 
4317          if (this.value == null)
4318            if (Configuration.errorOnAutoCreate())
4319              throw new Error("Attempt to auto-create DetailAdjudicationComponent.value");
4320            else if (Configuration.doAutoCreate())
4321              this.value = new DecimalType(); // bb
4322          return this.value;
4323        }
4324
4325        public boolean hasValueElement() { 
4326          return this.value != null && !this.value.isEmpty();
4327        }
4328
4329        public boolean hasValue() { 
4330          return this.value != null && !this.value.isEmpty();
4331        }
4332
4333        /**
4334         * @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
4335         */
4336        public DetailAdjudicationComponent setValueElement(DecimalType value) { 
4337          this.value = value;
4338          return this;
4339        }
4340
4341        /**
4342         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4343         */
4344        public BigDecimal getValue() { 
4345          return this.value == null ? null : this.value.getValue();
4346        }
4347
4348        /**
4349         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4350         */
4351        public DetailAdjudicationComponent setValue(BigDecimal value) { 
4352          if (value == null)
4353            this.value = null;
4354          else {
4355            if (this.value == null)
4356              this.value = new DecimalType();
4357            this.value.setValue(value);
4358          }
4359          return this;
4360        }
4361
4362        /**
4363         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4364         */
4365        public DetailAdjudicationComponent setValue(long value) { 
4366              this.value = new DecimalType();
4367            this.value.setValue(value);
4368          return this;
4369        }
4370
4371        /**
4372         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
4373         */
4374        public DetailAdjudicationComponent setValue(double value) { 
4375              this.value = new DecimalType();
4376            this.value.setValue(value);
4377          return this;
4378        }
4379
4380        protected void listChildren(List<Property> childrenList) {
4381          super.listChildren(childrenList);
4382          childrenList.add(new Property("category", "Coding", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
4383          childrenList.add(new Property("reason", "Coding", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
4384          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
4385          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));
4386        }
4387
4388      @Override
4389      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4390        switch (hash) {
4391        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
4392        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
4393        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
4394        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
4395        default: return super.getProperty(hash, name, checkValid);
4396        }
4397
4398      }
4399
4400      @Override
4401      public void setProperty(int hash, String name, Base value) throws FHIRException {
4402        switch (hash) {
4403        case 50511102: // category
4404          this.category = castToCoding(value); // Coding
4405          break;
4406        case -934964668: // reason
4407          this.reason = castToCoding(value); // Coding
4408          break;
4409        case -1413853096: // amount
4410          this.amount = castToMoney(value); // Money
4411          break;
4412        case 111972721: // value
4413          this.value = castToDecimal(value); // DecimalType
4414          break;
4415        default: super.setProperty(hash, name, value);
4416        }
4417
4418      }
4419
4420      @Override
4421      public void setProperty(String name, Base value) throws FHIRException {
4422        if (name.equals("category"))
4423          this.category = castToCoding(value); // Coding
4424        else if (name.equals("reason"))
4425          this.reason = castToCoding(value); // Coding
4426        else if (name.equals("amount"))
4427          this.amount = castToMoney(value); // Money
4428        else if (name.equals("value"))
4429          this.value = castToDecimal(value); // DecimalType
4430        else
4431          super.setProperty(name, value);
4432      }
4433
4434      @Override
4435      public Base makeProperty(int hash, String name) throws FHIRException {
4436        switch (hash) {
4437        case 50511102:  return getCategory(); // Coding
4438        case -934964668:  return getReason(); // Coding
4439        case -1413853096:  return getAmount(); // Money
4440        case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // DecimalType
4441        default: return super.makeProperty(hash, name);
4442        }
4443
4444      }
4445
4446      @Override
4447      public Base addChild(String name) throws FHIRException {
4448        if (name.equals("category")) {
4449          this.category = new Coding();
4450          return this.category;
4451        }
4452        else if (name.equals("reason")) {
4453          this.reason = new Coding();
4454          return this.reason;
4455        }
4456        else if (name.equals("amount")) {
4457          this.amount = new Money();
4458          return this.amount;
4459        }
4460        else if (name.equals("value")) {
4461          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
4462        }
4463        else
4464          return super.addChild(name);
4465      }
4466
4467      public DetailAdjudicationComponent copy() {
4468        DetailAdjudicationComponent dst = new DetailAdjudicationComponent();
4469        copyValues(dst);
4470        dst.category = category == null ? null : category.copy();
4471        dst.reason = reason == null ? null : reason.copy();
4472        dst.amount = amount == null ? null : amount.copy();
4473        dst.value = value == null ? null : value.copy();
4474        return dst;
4475      }
4476
4477      @Override
4478      public boolean equalsDeep(Base other) {
4479        if (!super.equalsDeep(other))
4480          return false;
4481        if (!(other instanceof DetailAdjudicationComponent))
4482          return false;
4483        DetailAdjudicationComponent o = (DetailAdjudicationComponent) other;
4484        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
4485           && compareDeep(value, o.value, true);
4486      }
4487
4488      @Override
4489      public boolean equalsShallow(Base other) {
4490        if (!super.equalsShallow(other))
4491          return false;
4492        if (!(other instanceof DetailAdjudicationComponent))
4493          return false;
4494        DetailAdjudicationComponent o = (DetailAdjudicationComponent) other;
4495        return compareValues(value, o.value, true);
4496      }
4497
4498      public boolean isEmpty() {
4499        return super.isEmpty() && (category == null || category.isEmpty()) && (reason == null || reason.isEmpty())
4500           && (amount == null || amount.isEmpty()) && (value == null || value.isEmpty());
4501      }
4502
4503  public String fhirType() {
4504    return "ExplanationOfBenefit.item.detail.adjudication";
4505
4506  }
4507
4508  }
4509
4510    @Block()
4511    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
4512        /**
4513         * A service line number.
4514         */
4515        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4516        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
4517        protected PositiveIntType sequence;
4518
4519        /**
4520         * The type of product or service.
4521         */
4522        @Child(name = "type", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
4523        @Description(shortDefinition="Type of product or service", formalDefinition="The type of product or service." )
4524        protected Coding type;
4525
4526        /**
4527         * The fee for an addittional service or product or charge.
4528         */
4529        @Child(name = "service", type = {Coding.class}, order=3, min=1, max=1, modifier=false, summary=true)
4530        @Description(shortDefinition="Additional item codes", formalDefinition="The fee for an addittional service or product or charge." )
4531        protected Coding service;
4532
4533        /**
4534         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
4535         */
4536        @Child(name = "programCode", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4537        @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." )
4538        protected List<Coding> programCode;
4539
4540        /**
4541         * The number of repetitions of a service or product.
4542         */
4543        @Child(name = "quantity", type = {SimpleQuantity.class}, order=5, min=0, max=1, modifier=false, summary=true)
4544        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
4545        protected SimpleQuantity quantity;
4546
4547        /**
4548         * The fee for an addittional service or product or charge.
4549         */
4550        @Child(name = "unitPrice", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=true)
4551        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="The fee for an addittional service or product or charge." )
4552        protected Money unitPrice;
4553
4554        /**
4555         * 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         */
4557        @Child(name = "factor", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=true)
4558        @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." )
4559        protected DecimalType factor;
4560
4561        /**
4562         * 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         */
4564        @Child(name = "points", type = {DecimalType.class}, order=8, min=0, max=1, modifier=false, summary=true)
4565        @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." )
4566        protected DecimalType points;
4567
4568        /**
4569         * 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         */
4571        @Child(name = "net", type = {Money.class}, order=9, min=0, max=1, modifier=false, summary=true)
4572        @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." )
4573        protected Money net;
4574
4575        /**
4576         * List of Unique Device Identifiers associated with this line item.
4577         */
4578        @Child(name = "udi", type = {Device.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4579        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
4580        protected List<Reference> udi;
4581        /**
4582         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
4583         */
4584        protected List<Device> udiTarget;
4585
4586
4587        /**
4588         * The adjudications results.
4589         */
4590        @Child(name = "adjudication", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4591        @Description(shortDefinition="SubDetail adjudication", formalDefinition="The adjudications results." )
4592        protected List<SubDetailAdjudicationComponent> adjudication;
4593
4594        private static final long serialVersionUID = -1690477905L;
4595
4596    /**
4597     * Constructor
4598     */
4599      public SubDetailComponent() {
4600        super();
4601      }
4602
4603    /**
4604     * Constructor
4605     */
4606      public SubDetailComponent(PositiveIntType sequence, Coding type, Coding service) {
4607        super();
4608        this.sequence = sequence;
4609        this.type = type;
4610        this.service = service;
4611      }
4612
4613        /**
4614         * @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
4615         */
4616        public PositiveIntType getSequenceElement() { 
4617          if (this.sequence == null)
4618            if (Configuration.errorOnAutoCreate())
4619              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
4620            else if (Configuration.doAutoCreate())
4621              this.sequence = new PositiveIntType(); // bb
4622          return this.sequence;
4623        }
4624
4625        public boolean hasSequenceElement() { 
4626          return this.sequence != null && !this.sequence.isEmpty();
4627        }
4628
4629        public boolean hasSequence() { 
4630          return this.sequence != null && !this.sequence.isEmpty();
4631        }
4632
4633        /**
4634         * @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
4635         */
4636        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
4637          this.sequence = value;
4638          return this;
4639        }
4640
4641        /**
4642         * @return A service line number.
4643         */
4644        public int getSequence() { 
4645          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
4646        }
4647
4648        /**
4649         * @param value A service line number.
4650         */
4651        public SubDetailComponent setSequence(int value) { 
4652            if (this.sequence == null)
4653              this.sequence = new PositiveIntType();
4654            this.sequence.setValue(value);
4655          return this;
4656        }
4657
4658        /**
4659         * @return {@link #type} (The type of product or service.)
4660         */
4661        public Coding getType() { 
4662          if (this.type == null)
4663            if (Configuration.errorOnAutoCreate())
4664              throw new Error("Attempt to auto-create SubDetailComponent.type");
4665            else if (Configuration.doAutoCreate())
4666              this.type = new Coding(); // cc
4667          return this.type;
4668        }
4669
4670        public boolean hasType() { 
4671          return this.type != null && !this.type.isEmpty();
4672        }
4673
4674        /**
4675         * @param value {@link #type} (The type of product or service.)
4676         */
4677        public SubDetailComponent setType(Coding value) { 
4678          this.type = value;
4679          return this;
4680        }
4681
4682        /**
4683         * @return {@link #service} (The fee for an addittional service or product or charge.)
4684         */
4685        public Coding getService() { 
4686          if (this.service == null)
4687            if (Configuration.errorOnAutoCreate())
4688              throw new Error("Attempt to auto-create SubDetailComponent.service");
4689            else if (Configuration.doAutoCreate())
4690              this.service = new Coding(); // cc
4691          return this.service;
4692        }
4693
4694        public boolean hasService() { 
4695          return this.service != null && !this.service.isEmpty();
4696        }
4697
4698        /**
4699         * @param value {@link #service} (The fee for an addittional service or product or charge.)
4700         */
4701        public SubDetailComponent setService(Coding value) { 
4702          this.service = value;
4703          return this;
4704        }
4705
4706        /**
4707         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
4708         */
4709        public List<Coding> getProgramCode() { 
4710          if (this.programCode == null)
4711            this.programCode = new ArrayList<Coding>();
4712          return this.programCode;
4713        }
4714
4715        public boolean hasProgramCode() { 
4716          if (this.programCode == null)
4717            return false;
4718          for (Coding item : this.programCode)
4719            if (!item.isEmpty())
4720              return true;
4721          return false;
4722        }
4723
4724        /**
4725         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
4726         */
4727    // syntactic sugar
4728        public Coding addProgramCode() { //3
4729          Coding t = new Coding();
4730          if (this.programCode == null)
4731            this.programCode = new ArrayList<Coding>();
4732          this.programCode.add(t);
4733          return t;
4734        }
4735
4736    // syntactic sugar
4737        public SubDetailComponent addProgramCode(Coding t) { //3
4738          if (t == null)
4739            return this;
4740          if (this.programCode == null)
4741            this.programCode = new ArrayList<Coding>();
4742          this.programCode.add(t);
4743          return this;
4744        }
4745
4746        /**
4747         * @return {@link #quantity} (The number of repetitions of a service or product.)
4748         */
4749        public SimpleQuantity getQuantity() { 
4750          if (this.quantity == null)
4751            if (Configuration.errorOnAutoCreate())
4752              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
4753            else if (Configuration.doAutoCreate())
4754              this.quantity = new SimpleQuantity(); // cc
4755          return this.quantity;
4756        }
4757
4758        public boolean hasQuantity() { 
4759          return this.quantity != null && !this.quantity.isEmpty();
4760        }
4761
4762        /**
4763         * @param value {@link #quantity} (The number of repetitions of a service or product.)
4764         */
4765        public SubDetailComponent setQuantity(SimpleQuantity value) { 
4766          this.quantity = value;
4767          return this;
4768        }
4769
4770        /**
4771         * @return {@link #unitPrice} (The fee for an addittional service or product or charge.)
4772         */
4773        public Money getUnitPrice() { 
4774          if (this.unitPrice == null)
4775            if (Configuration.errorOnAutoCreate())
4776              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
4777            else if (Configuration.doAutoCreate())
4778              this.unitPrice = new Money(); // cc
4779          return this.unitPrice;
4780        }
4781
4782        public boolean hasUnitPrice() { 
4783          return this.unitPrice != null && !this.unitPrice.isEmpty();
4784        }
4785
4786        /**
4787         * @param value {@link #unitPrice} (The fee for an addittional service or product or charge.)
4788         */
4789        public SubDetailComponent setUnitPrice(Money value) { 
4790          this.unitPrice = value;
4791          return this;
4792        }
4793
4794        /**
4795         * @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
4796         */
4797        public DecimalType getFactorElement() { 
4798          if (this.factor == null)
4799            if (Configuration.errorOnAutoCreate())
4800              throw new Error("Attempt to auto-create SubDetailComponent.factor");
4801            else if (Configuration.doAutoCreate())
4802              this.factor = new DecimalType(); // bb
4803          return this.factor;
4804        }
4805
4806        public boolean hasFactorElement() { 
4807          return this.factor != null && !this.factor.isEmpty();
4808        }
4809
4810        public boolean hasFactor() { 
4811          return this.factor != null && !this.factor.isEmpty();
4812        }
4813
4814        /**
4815         * @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
4816         */
4817        public SubDetailComponent setFactorElement(DecimalType value) { 
4818          this.factor = value;
4819          return this;
4820        }
4821
4822        /**
4823         * @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.
4824         */
4825        public BigDecimal getFactor() { 
4826          return this.factor == null ? null : this.factor.getValue();
4827        }
4828
4829        /**
4830         * @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.
4831         */
4832        public SubDetailComponent setFactor(BigDecimal value) { 
4833          if (value == null)
4834            this.factor = null;
4835          else {
4836            if (this.factor == null)
4837              this.factor = new DecimalType();
4838            this.factor.setValue(value);
4839          }
4840          return this;
4841        }
4842
4843        /**
4844         * @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.
4845         */
4846        public SubDetailComponent setFactor(long value) { 
4847              this.factor = new DecimalType();
4848            this.factor.setValue(value);
4849          return this;
4850        }
4851
4852        /**
4853         * @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.
4854         */
4855        public SubDetailComponent setFactor(double value) { 
4856              this.factor = new DecimalType();
4857            this.factor.setValue(value);
4858          return this;
4859        }
4860
4861        /**
4862         * @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
4863         */
4864        public DecimalType getPointsElement() { 
4865          if (this.points == null)
4866            if (Configuration.errorOnAutoCreate())
4867              throw new Error("Attempt to auto-create SubDetailComponent.points");
4868            else if (Configuration.doAutoCreate())
4869              this.points = new DecimalType(); // bb
4870          return this.points;
4871        }
4872
4873        public boolean hasPointsElement() { 
4874          return this.points != null && !this.points.isEmpty();
4875        }
4876
4877        public boolean hasPoints() { 
4878          return this.points != null && !this.points.isEmpty();
4879        }
4880
4881        /**
4882         * @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
4883         */
4884        public SubDetailComponent setPointsElement(DecimalType value) { 
4885          this.points = value;
4886          return this;
4887        }
4888
4889        /**
4890         * @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.
4891         */
4892        public BigDecimal getPoints() { 
4893          return this.points == null ? null : this.points.getValue();
4894        }
4895
4896        /**
4897         * @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.
4898         */
4899        public SubDetailComponent setPoints(BigDecimal value) { 
4900          if (value == null)
4901            this.points = null;
4902          else {
4903            if (this.points == null)
4904              this.points = new DecimalType();
4905            this.points.setValue(value);
4906          }
4907          return this;
4908        }
4909
4910        /**
4911         * @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.
4912         */
4913        public SubDetailComponent setPoints(long value) { 
4914              this.points = new DecimalType();
4915            this.points.setValue(value);
4916          return this;
4917        }
4918
4919        /**
4920         * @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.
4921         */
4922        public SubDetailComponent setPoints(double value) { 
4923              this.points = new DecimalType();
4924            this.points.setValue(value);
4925          return this;
4926        }
4927
4928        /**
4929         * @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.)
4930         */
4931        public Money getNet() { 
4932          if (this.net == null)
4933            if (Configuration.errorOnAutoCreate())
4934              throw new Error("Attempt to auto-create SubDetailComponent.net");
4935            else if (Configuration.doAutoCreate())
4936              this.net = new Money(); // cc
4937          return this.net;
4938        }
4939
4940        public boolean hasNet() { 
4941          return this.net != null && !this.net.isEmpty();
4942        }
4943
4944        /**
4945         * @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.)
4946         */
4947        public SubDetailComponent setNet(Money value) { 
4948          this.net = value;
4949          return this;
4950        }
4951
4952        /**
4953         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
4954         */
4955        public List<Reference> getUdi() { 
4956          if (this.udi == null)
4957            this.udi = new ArrayList<Reference>();
4958          return this.udi;
4959        }
4960
4961        public boolean hasUdi() { 
4962          if (this.udi == null)
4963            return false;
4964          for (Reference item : this.udi)
4965            if (!item.isEmpty())
4966              return true;
4967          return false;
4968        }
4969
4970        /**
4971         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
4972         */
4973    // syntactic sugar
4974        public Reference addUdi() { //3
4975          Reference t = new Reference();
4976          if (this.udi == null)
4977            this.udi = new ArrayList<Reference>();
4978          this.udi.add(t);
4979          return t;
4980        }
4981
4982    // syntactic sugar
4983        public SubDetailComponent addUdi(Reference t) { //3
4984          if (t == null)
4985            return this;
4986          if (this.udi == null)
4987            this.udi = new ArrayList<Reference>();
4988          this.udi.add(t);
4989          return this;
4990        }
4991
4992        /**
4993         * @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.)
4994         */
4995        public List<Device> getUdiTarget() { 
4996          if (this.udiTarget == null)
4997            this.udiTarget = new ArrayList<Device>();
4998          return this.udiTarget;
4999        }
5000
5001    // syntactic sugar
5002        /**
5003         * @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.)
5004         */
5005        public Device addUdiTarget() { 
5006          Device r = new Device();
5007          if (this.udiTarget == null)
5008            this.udiTarget = new ArrayList<Device>();
5009          this.udiTarget.add(r);
5010          return r;
5011        }
5012
5013        /**
5014         * @return {@link #adjudication} (The adjudications results.)
5015         */
5016        public List<SubDetailAdjudicationComponent> getAdjudication() { 
5017          if (this.adjudication == null)
5018            this.adjudication = new ArrayList<SubDetailAdjudicationComponent>();
5019          return this.adjudication;
5020        }
5021
5022        public boolean hasAdjudication() { 
5023          if (this.adjudication == null)
5024            return false;
5025          for (SubDetailAdjudicationComponent item : this.adjudication)
5026            if (!item.isEmpty())
5027              return true;
5028          return false;
5029        }
5030
5031        /**
5032         * @return {@link #adjudication} (The adjudications results.)
5033         */
5034    // syntactic sugar
5035        public SubDetailAdjudicationComponent addAdjudication() { //3
5036          SubDetailAdjudicationComponent t = new SubDetailAdjudicationComponent();
5037          if (this.adjudication == null)
5038            this.adjudication = new ArrayList<SubDetailAdjudicationComponent>();
5039          this.adjudication.add(t);
5040          return t;
5041        }
5042
5043    // syntactic sugar
5044        public SubDetailComponent addAdjudication(SubDetailAdjudicationComponent t) { //3
5045          if (t == null)
5046            return this;
5047          if (this.adjudication == null)
5048            this.adjudication = new ArrayList<SubDetailAdjudicationComponent>();
5049          this.adjudication.add(t);
5050          return this;
5051        }
5052
5053        protected void listChildren(List<Property> childrenList) {
5054          super.listChildren(childrenList);
5055          childrenList.add(new Property("sequence", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequence));
5056          childrenList.add(new Property("type", "Coding", "The type of product or service.", 0, java.lang.Integer.MAX_VALUE, type));
5057          childrenList.add(new Property("service", "Coding", "The fee for an addittional service or product or charge.", 0, java.lang.Integer.MAX_VALUE, service));
5058          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));
5059          childrenList.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, java.lang.Integer.MAX_VALUE, quantity));
5060          childrenList.add(new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, java.lang.Integer.MAX_VALUE, unitPrice));
5061          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));
5062          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));
5063          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));
5064          childrenList.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
5065          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
5066        }
5067
5068      @Override
5069      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5070        switch (hash) {
5071        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
5072        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
5073        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // Coding
5074        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // Coding
5075        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
5076        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
5077        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
5078        case -982754077: /*points*/ return this.points == null ? new Base[0] : new Base[] {this.points}; // DecimalType
5079        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
5080        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5081        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // SubDetailAdjudicationComponent
5082        default: return super.getProperty(hash, name, checkValid);
5083        }
5084
5085      }
5086
5087      @Override
5088      public void setProperty(int hash, String name, Base value) throws FHIRException {
5089        switch (hash) {
5090        case 1349547969: // sequence
5091          this.sequence = castToPositiveInt(value); // PositiveIntType
5092          break;
5093        case 3575610: // type
5094          this.type = castToCoding(value); // Coding
5095          break;
5096        case 1984153269: // service
5097          this.service = castToCoding(value); // Coding
5098          break;
5099        case 1010065041: // programCode
5100          this.getProgramCode().add(castToCoding(value)); // Coding
5101          break;
5102        case -1285004149: // quantity
5103          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
5104          break;
5105        case -486196699: // unitPrice
5106          this.unitPrice = castToMoney(value); // Money
5107          break;
5108        case -1282148017: // factor
5109          this.factor = castToDecimal(value); // DecimalType
5110          break;
5111        case -982754077: // points
5112          this.points = castToDecimal(value); // DecimalType
5113          break;
5114        case 108957: // net
5115          this.net = castToMoney(value); // Money
5116          break;
5117        case 115642: // udi
5118          this.getUdi().add(castToReference(value)); // Reference
5119          break;
5120        case -231349275: // adjudication
5121          this.getAdjudication().add((SubDetailAdjudicationComponent) value); // SubDetailAdjudicationComponent
5122          break;
5123        default: super.setProperty(hash, name, value);
5124        }
5125
5126      }
5127
5128      @Override
5129      public void setProperty(String name, Base value) throws FHIRException {
5130        if (name.equals("sequence"))
5131          this.sequence = castToPositiveInt(value); // PositiveIntType
5132        else if (name.equals("type"))
5133          this.type = castToCoding(value); // Coding
5134        else if (name.equals("service"))
5135          this.service = castToCoding(value); // Coding
5136        else if (name.equals("programCode"))
5137          this.getProgramCode().add(castToCoding(value));
5138        else if (name.equals("quantity"))
5139          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
5140        else if (name.equals("unitPrice"))
5141          this.unitPrice = castToMoney(value); // Money
5142        else if (name.equals("factor"))
5143          this.factor = castToDecimal(value); // DecimalType
5144        else if (name.equals("points"))
5145          this.points = castToDecimal(value); // DecimalType
5146        else if (name.equals("net"))
5147          this.net = castToMoney(value); // Money
5148        else if (name.equals("udi"))
5149          this.getUdi().add(castToReference(value));
5150        else if (name.equals("adjudication"))
5151          this.getAdjudication().add((SubDetailAdjudicationComponent) value);
5152        else
5153          super.setProperty(name, value);
5154      }
5155
5156      @Override
5157      public Base makeProperty(int hash, String name) throws FHIRException {
5158        switch (hash) {
5159        case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // PositiveIntType
5160        case 3575610:  return getType(); // Coding
5161        case 1984153269:  return getService(); // Coding
5162        case 1010065041:  return addProgramCode(); // Coding
5163        case -1285004149:  return getQuantity(); // SimpleQuantity
5164        case -486196699:  return getUnitPrice(); // Money
5165        case -1282148017: throw new FHIRException("Cannot make property factor as it is not a complex type"); // DecimalType
5166        case -982754077: throw new FHIRException("Cannot make property points as it is not a complex type"); // DecimalType
5167        case 108957:  return getNet(); // Money
5168        case 115642:  return addUdi(); // Reference
5169        case -231349275:  return addAdjudication(); // SubDetailAdjudicationComponent
5170        default: return super.makeProperty(hash, name);
5171        }
5172
5173      }
5174
5175      @Override
5176      public Base addChild(String name) throws FHIRException {
5177        if (name.equals("sequence")) {
5178          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
5179        }
5180        else if (name.equals("type")) {
5181          this.type = new Coding();
5182          return this.type;
5183        }
5184        else if (name.equals("service")) {
5185          this.service = new Coding();
5186          return this.service;
5187        }
5188        else if (name.equals("programCode")) {
5189          return addProgramCode();
5190        }
5191        else if (name.equals("quantity")) {
5192          this.quantity = new SimpleQuantity();
5193          return this.quantity;
5194        }
5195        else if (name.equals("unitPrice")) {
5196          this.unitPrice = new Money();
5197          return this.unitPrice;
5198        }
5199        else if (name.equals("factor")) {
5200          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
5201        }
5202        else if (name.equals("points")) {
5203          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.points");
5204        }
5205        else if (name.equals("net")) {
5206          this.net = new Money();
5207          return this.net;
5208        }
5209        else if (name.equals("udi")) {
5210          return addUdi();
5211        }
5212        else if (name.equals("adjudication")) {
5213          return addAdjudication();
5214        }
5215        else
5216          return super.addChild(name);
5217      }
5218
5219      public SubDetailComponent copy() {
5220        SubDetailComponent dst = new SubDetailComponent();
5221        copyValues(dst);
5222        dst.sequence = sequence == null ? null : sequence.copy();
5223        dst.type = type == null ? null : type.copy();
5224        dst.service = service == null ? null : service.copy();
5225        if (programCode != null) {
5226          dst.programCode = new ArrayList<Coding>();
5227          for (Coding i : programCode)
5228            dst.programCode.add(i.copy());
5229        };
5230        dst.quantity = quantity == null ? null : quantity.copy();
5231        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
5232        dst.factor = factor == null ? null : factor.copy();
5233        dst.points = points == null ? null : points.copy();
5234        dst.net = net == null ? null : net.copy();
5235        if (udi != null) {
5236          dst.udi = new ArrayList<Reference>();
5237          for (Reference i : udi)
5238            dst.udi.add(i.copy());
5239        };
5240        if (adjudication != null) {
5241          dst.adjudication = new ArrayList<SubDetailAdjudicationComponent>();
5242          for (SubDetailAdjudicationComponent i : adjudication)
5243            dst.adjudication.add(i.copy());
5244        };
5245        return dst;
5246      }
5247
5248      @Override
5249      public boolean equalsDeep(Base other) {
5250        if (!super.equalsDeep(other))
5251          return false;
5252        if (!(other instanceof SubDetailComponent))
5253          return false;
5254        SubDetailComponent o = (SubDetailComponent) other;
5255        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(service, o.service, true)
5256           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
5257           && compareDeep(factor, o.factor, true) && compareDeep(points, o.points, true) && compareDeep(net, o.net, true)
5258           && compareDeep(udi, o.udi, true) && compareDeep(adjudication, o.adjudication, true);
5259      }
5260
5261      @Override
5262      public boolean equalsShallow(Base other) {
5263        if (!super.equalsShallow(other))
5264          return false;
5265        if (!(other instanceof SubDetailComponent))
5266          return false;
5267        SubDetailComponent o = (SubDetailComponent) other;
5268        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(points, o.points, true)
5269          ;
5270      }
5271
5272      public boolean isEmpty() {
5273        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (type == null || type.isEmpty())
5274           && (service == null || service.isEmpty()) && (programCode == null || programCode.isEmpty())
5275           && (quantity == null || quantity.isEmpty()) && (unitPrice == null || unitPrice.isEmpty())
5276           && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty()) && (net == null || net.isEmpty())
5277           && (udi == null || udi.isEmpty()) && (adjudication == null || adjudication.isEmpty());
5278      }
5279
5280  public String fhirType() {
5281    return "ExplanationOfBenefit.item.detail.subDetail";
5282
5283  }
5284
5285  }
5286
5287    @Block()
5288    public static class SubDetailAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5289        /**
5290         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
5291         */
5292        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
5293        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
5294        protected Coding category;
5295
5296        /**
5297         * Adjudication reason such as limit reached.
5298         */
5299        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
5300        @Description(shortDefinition="Adjudication reason", formalDefinition="Adjudication reason such as limit reached." )
5301        protected Coding reason;
5302
5303        /**
5304         * Monitory amount associated with the code.
5305         */
5306        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
5307        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
5308        protected Money amount;
5309
5310        /**
5311         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5312         */
5313        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
5314        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
5315        protected DecimalType value;
5316
5317        private static final long serialVersionUID = -1926987562L;
5318
5319    /**
5320     * Constructor
5321     */
5322      public SubDetailAdjudicationComponent() {
5323        super();
5324      }
5325
5326    /**
5327     * Constructor
5328     */
5329      public SubDetailAdjudicationComponent(Coding category) {
5330        super();
5331        this.category = category;
5332      }
5333
5334        /**
5335         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
5336         */
5337        public Coding getCategory() { 
5338          if (this.category == null)
5339            if (Configuration.errorOnAutoCreate())
5340              throw new Error("Attempt to auto-create SubDetailAdjudicationComponent.category");
5341            else if (Configuration.doAutoCreate())
5342              this.category = new Coding(); // cc
5343          return this.category;
5344        }
5345
5346        public boolean hasCategory() { 
5347          return this.category != null && !this.category.isEmpty();
5348        }
5349
5350        /**
5351         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
5352         */
5353        public SubDetailAdjudicationComponent setCategory(Coding value) { 
5354          this.category = value;
5355          return this;
5356        }
5357
5358        /**
5359         * @return {@link #reason} (Adjudication reason such as limit reached.)
5360         */
5361        public Coding getReason() { 
5362          if (this.reason == null)
5363            if (Configuration.errorOnAutoCreate())
5364              throw new Error("Attempt to auto-create SubDetailAdjudicationComponent.reason");
5365            else if (Configuration.doAutoCreate())
5366              this.reason = new Coding(); // cc
5367          return this.reason;
5368        }
5369
5370        public boolean hasReason() { 
5371          return this.reason != null && !this.reason.isEmpty();
5372        }
5373
5374        /**
5375         * @param value {@link #reason} (Adjudication reason such as limit reached.)
5376         */
5377        public SubDetailAdjudicationComponent setReason(Coding value) { 
5378          this.reason = value;
5379          return this;
5380        }
5381
5382        /**
5383         * @return {@link #amount} (Monitory amount associated with the code.)
5384         */
5385        public Money getAmount() { 
5386          if (this.amount == null)
5387            if (Configuration.errorOnAutoCreate())
5388              throw new Error("Attempt to auto-create SubDetailAdjudicationComponent.amount");
5389            else if (Configuration.doAutoCreate())
5390              this.amount = new Money(); // cc
5391          return this.amount;
5392        }
5393
5394        public boolean hasAmount() { 
5395          return this.amount != null && !this.amount.isEmpty();
5396        }
5397
5398        /**
5399         * @param value {@link #amount} (Monitory amount associated with the code.)
5400         */
5401        public SubDetailAdjudicationComponent setAmount(Money value) { 
5402          this.amount = value;
5403          return this;
5404        }
5405
5406        /**
5407         * @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
5408         */
5409        public DecimalType getValueElement() { 
5410          if (this.value == null)
5411            if (Configuration.errorOnAutoCreate())
5412              throw new Error("Attempt to auto-create SubDetailAdjudicationComponent.value");
5413            else if (Configuration.doAutoCreate())
5414              this.value = new DecimalType(); // bb
5415          return this.value;
5416        }
5417
5418        public boolean hasValueElement() { 
5419          return this.value != null && !this.value.isEmpty();
5420        }
5421
5422        public boolean hasValue() { 
5423          return this.value != null && !this.value.isEmpty();
5424        }
5425
5426        /**
5427         * @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
5428         */
5429        public SubDetailAdjudicationComponent setValueElement(DecimalType value) { 
5430          this.value = value;
5431          return this;
5432        }
5433
5434        /**
5435         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5436         */
5437        public BigDecimal getValue() { 
5438          return this.value == null ? null : this.value.getValue();
5439        }
5440
5441        /**
5442         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5443         */
5444        public SubDetailAdjudicationComponent setValue(BigDecimal value) { 
5445          if (value == null)
5446            this.value = null;
5447          else {
5448            if (this.value == null)
5449              this.value = new DecimalType();
5450            this.value.setValue(value);
5451          }
5452          return this;
5453        }
5454
5455        /**
5456         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5457         */
5458        public SubDetailAdjudicationComponent setValue(long value) { 
5459              this.value = new DecimalType();
5460            this.value.setValue(value);
5461          return this;
5462        }
5463
5464        /**
5465         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5466         */
5467        public SubDetailAdjudicationComponent setValue(double value) { 
5468              this.value = new DecimalType();
5469            this.value.setValue(value);
5470          return this;
5471        }
5472
5473        protected void listChildren(List<Property> childrenList) {
5474          super.listChildren(childrenList);
5475          childrenList.add(new Property("category", "Coding", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
5476          childrenList.add(new Property("reason", "Coding", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
5477          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
5478          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));
5479        }
5480
5481      @Override
5482      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5483        switch (hash) {
5484        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
5485        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
5486        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5487        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5488        default: return super.getProperty(hash, name, checkValid);
5489        }
5490
5491      }
5492
5493      @Override
5494      public void setProperty(int hash, String name, Base value) throws FHIRException {
5495        switch (hash) {
5496        case 50511102: // category
5497          this.category = castToCoding(value); // Coding
5498          break;
5499        case -934964668: // reason
5500          this.reason = castToCoding(value); // Coding
5501          break;
5502        case -1413853096: // amount
5503          this.amount = castToMoney(value); // Money
5504          break;
5505        case 111972721: // value
5506          this.value = castToDecimal(value); // DecimalType
5507          break;
5508        default: super.setProperty(hash, name, value);
5509        }
5510
5511      }
5512
5513      @Override
5514      public void setProperty(String name, Base value) throws FHIRException {
5515        if (name.equals("category"))
5516          this.category = castToCoding(value); // Coding
5517        else if (name.equals("reason"))
5518          this.reason = castToCoding(value); // Coding
5519        else if (name.equals("amount"))
5520          this.amount = castToMoney(value); // Money
5521        else if (name.equals("value"))
5522          this.value = castToDecimal(value); // DecimalType
5523        else
5524          super.setProperty(name, value);
5525      }
5526
5527      @Override
5528      public Base makeProperty(int hash, String name) throws FHIRException {
5529        switch (hash) {
5530        case 50511102:  return getCategory(); // Coding
5531        case -934964668:  return getReason(); // Coding
5532        case -1413853096:  return getAmount(); // Money
5533        case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // DecimalType
5534        default: return super.makeProperty(hash, name);
5535        }
5536
5537      }
5538
5539      @Override
5540      public Base addChild(String name) throws FHIRException {
5541        if (name.equals("category")) {
5542          this.category = new Coding();
5543          return this.category;
5544        }
5545        else if (name.equals("reason")) {
5546          this.reason = new Coding();
5547          return this.reason;
5548        }
5549        else if (name.equals("amount")) {
5550          this.amount = new Money();
5551          return this.amount;
5552        }
5553        else if (name.equals("value")) {
5554          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5555        }
5556        else
5557          return super.addChild(name);
5558      }
5559
5560      public SubDetailAdjudicationComponent copy() {
5561        SubDetailAdjudicationComponent dst = new SubDetailAdjudicationComponent();
5562        copyValues(dst);
5563        dst.category = category == null ? null : category.copy();
5564        dst.reason = reason == null ? null : reason.copy();
5565        dst.amount = amount == null ? null : amount.copy();
5566        dst.value = value == null ? null : value.copy();
5567        return dst;
5568      }
5569
5570      @Override
5571      public boolean equalsDeep(Base other) {
5572        if (!super.equalsDeep(other))
5573          return false;
5574        if (!(other instanceof SubDetailAdjudicationComponent))
5575          return false;
5576        SubDetailAdjudicationComponent o = (SubDetailAdjudicationComponent) other;
5577        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5578           && compareDeep(value, o.value, true);
5579      }
5580
5581      @Override
5582      public boolean equalsShallow(Base other) {
5583        if (!super.equalsShallow(other))
5584          return false;
5585        if (!(other instanceof SubDetailAdjudicationComponent))
5586          return false;
5587        SubDetailAdjudicationComponent o = (SubDetailAdjudicationComponent) other;
5588        return compareValues(value, o.value, true);
5589      }
5590
5591      public boolean isEmpty() {
5592        return super.isEmpty() && (category == null || category.isEmpty()) && (reason == null || reason.isEmpty())
5593           && (amount == null || amount.isEmpty()) && (value == null || value.isEmpty());
5594      }
5595
5596  public String fhirType() {
5597    return "ExplanationOfBenefit.item.detail.subDetail.adjudication";
5598
5599  }
5600
5601  }
5602
5603    @Block()
5604    public static class ProsthesisComponent extends BackboneElement implements IBaseBackboneElement {
5605        /**
5606         * Indicates whether this is the initial placement of a fixed prosthesis.
5607         */
5608        @Child(name = "initial", type = {BooleanType.class}, order=1, min=0, max=1, modifier=false, summary=true)
5609        @Description(shortDefinition="Is this the initial service", formalDefinition="Indicates whether this is the initial placement of a fixed prosthesis." )
5610        protected BooleanType initial;
5611
5612        /**
5613         * Date of the initial placement.
5614         */
5615        @Child(name = "priorDate", type = {DateType.class}, order=2, min=0, max=1, modifier=false, summary=true)
5616        @Description(shortDefinition="Initial service Date", formalDefinition="Date of the initial placement." )
5617        protected DateType priorDate;
5618
5619        /**
5620         * Material of the prior denture or bridge prosthesis. (Oral).
5621         */
5622        @Child(name = "priorMaterial", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
5623        @Description(shortDefinition="Prosthetic Material", formalDefinition="Material of the prior denture or bridge prosthesis. (Oral)." )
5624        protected Coding priorMaterial;
5625
5626        private static final long serialVersionUID = 1739349641L;
5627
5628    /**
5629     * Constructor
5630     */
5631      public ProsthesisComponent() {
5632        super();
5633      }
5634
5635        /**
5636         * @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
5637         */
5638        public BooleanType getInitialElement() { 
5639          if (this.initial == null)
5640            if (Configuration.errorOnAutoCreate())
5641              throw new Error("Attempt to auto-create ProsthesisComponent.initial");
5642            else if (Configuration.doAutoCreate())
5643              this.initial = new BooleanType(); // bb
5644          return this.initial;
5645        }
5646
5647        public boolean hasInitialElement() { 
5648          return this.initial != null && !this.initial.isEmpty();
5649        }
5650
5651        public boolean hasInitial() { 
5652          return this.initial != null && !this.initial.isEmpty();
5653        }
5654
5655        /**
5656         * @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
5657         */
5658        public ProsthesisComponent setInitialElement(BooleanType value) { 
5659          this.initial = value;
5660          return this;
5661        }
5662
5663        /**
5664         * @return Indicates whether this is the initial placement of a fixed prosthesis.
5665         */
5666        public boolean getInitial() { 
5667          return this.initial == null || this.initial.isEmpty() ? false : this.initial.getValue();
5668        }
5669
5670        /**
5671         * @param value Indicates whether this is the initial placement of a fixed prosthesis.
5672         */
5673        public ProsthesisComponent setInitial(boolean value) { 
5674            if (this.initial == null)
5675              this.initial = new BooleanType();
5676            this.initial.setValue(value);
5677          return this;
5678        }
5679
5680        /**
5681         * @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
5682         */
5683        public DateType getPriorDateElement() { 
5684          if (this.priorDate == null)
5685            if (Configuration.errorOnAutoCreate())
5686              throw new Error("Attempt to auto-create ProsthesisComponent.priorDate");
5687            else if (Configuration.doAutoCreate())
5688              this.priorDate = new DateType(); // bb
5689          return this.priorDate;
5690        }
5691
5692        public boolean hasPriorDateElement() { 
5693          return this.priorDate != null && !this.priorDate.isEmpty();
5694        }
5695
5696        public boolean hasPriorDate() { 
5697          return this.priorDate != null && !this.priorDate.isEmpty();
5698        }
5699
5700        /**
5701         * @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
5702         */
5703        public ProsthesisComponent setPriorDateElement(DateType value) { 
5704          this.priorDate = value;
5705          return this;
5706        }
5707
5708        /**
5709         * @return Date of the initial placement.
5710         */
5711        public Date getPriorDate() { 
5712          return this.priorDate == null ? null : this.priorDate.getValue();
5713        }
5714
5715        /**
5716         * @param value Date of the initial placement.
5717         */
5718        public ProsthesisComponent setPriorDate(Date value) { 
5719          if (value == null)
5720            this.priorDate = null;
5721          else {
5722            if (this.priorDate == null)
5723              this.priorDate = new DateType();
5724            this.priorDate.setValue(value);
5725          }
5726          return this;
5727        }
5728
5729        /**
5730         * @return {@link #priorMaterial} (Material of the prior denture or bridge prosthesis. (Oral).)
5731         */
5732        public Coding getPriorMaterial() { 
5733          if (this.priorMaterial == null)
5734            if (Configuration.errorOnAutoCreate())
5735              throw new Error("Attempt to auto-create ProsthesisComponent.priorMaterial");
5736            else if (Configuration.doAutoCreate())
5737              this.priorMaterial = new Coding(); // cc
5738          return this.priorMaterial;
5739        }
5740
5741        public boolean hasPriorMaterial() { 
5742          return this.priorMaterial != null && !this.priorMaterial.isEmpty();
5743        }
5744
5745        /**
5746         * @param value {@link #priorMaterial} (Material of the prior denture or bridge prosthesis. (Oral).)
5747         */
5748        public ProsthesisComponent setPriorMaterial(Coding value) { 
5749          this.priorMaterial = value;
5750          return this;
5751        }
5752
5753        protected void listChildren(List<Property> childrenList) {
5754          super.listChildren(childrenList);
5755          childrenList.add(new Property("initial", "boolean", "Indicates whether this is the initial placement of a fixed prosthesis.", 0, java.lang.Integer.MAX_VALUE, initial));
5756          childrenList.add(new Property("priorDate", "date", "Date of the initial placement.", 0, java.lang.Integer.MAX_VALUE, priorDate));
5757          childrenList.add(new Property("priorMaterial", "Coding", "Material of the prior denture or bridge prosthesis. (Oral).", 0, java.lang.Integer.MAX_VALUE, priorMaterial));
5758        }
5759
5760      @Override
5761      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5762        switch (hash) {
5763        case 1948342084: /*initial*/ return this.initial == null ? new Base[0] : new Base[] {this.initial}; // BooleanType
5764        case -1770675816: /*priorDate*/ return this.priorDate == null ? new Base[0] : new Base[] {this.priorDate}; // DateType
5765        case -532999663: /*priorMaterial*/ return this.priorMaterial == null ? new Base[0] : new Base[] {this.priorMaterial}; // Coding
5766        default: return super.getProperty(hash, name, checkValid);
5767        }
5768
5769      }
5770
5771      @Override
5772      public void setProperty(int hash, String name, Base value) throws FHIRException {
5773        switch (hash) {
5774        case 1948342084: // initial
5775          this.initial = castToBoolean(value); // BooleanType
5776          break;
5777        case -1770675816: // priorDate
5778          this.priorDate = castToDate(value); // DateType
5779          break;
5780        case -532999663: // priorMaterial
5781          this.priorMaterial = castToCoding(value); // Coding
5782          break;
5783        default: super.setProperty(hash, name, value);
5784        }
5785
5786      }
5787
5788      @Override
5789      public void setProperty(String name, Base value) throws FHIRException {
5790        if (name.equals("initial"))
5791          this.initial = castToBoolean(value); // BooleanType
5792        else if (name.equals("priorDate"))
5793          this.priorDate = castToDate(value); // DateType
5794        else if (name.equals("priorMaterial"))
5795          this.priorMaterial = castToCoding(value); // Coding
5796        else
5797          super.setProperty(name, value);
5798      }
5799
5800      @Override
5801      public Base makeProperty(int hash, String name) throws FHIRException {
5802        switch (hash) {
5803        case 1948342084: throw new FHIRException("Cannot make property initial as it is not a complex type"); // BooleanType
5804        case -1770675816: throw new FHIRException("Cannot make property priorDate as it is not a complex type"); // DateType
5805        case -532999663:  return getPriorMaterial(); // Coding
5806        default: return super.makeProperty(hash, name);
5807        }
5808
5809      }
5810
5811      @Override
5812      public Base addChild(String name) throws FHIRException {
5813        if (name.equals("initial")) {
5814          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.initial");
5815        }
5816        else if (name.equals("priorDate")) {
5817          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.priorDate");
5818        }
5819        else if (name.equals("priorMaterial")) {
5820          this.priorMaterial = new Coding();
5821          return this.priorMaterial;
5822        }
5823        else
5824          return super.addChild(name);
5825      }
5826
5827      public ProsthesisComponent copy() {
5828        ProsthesisComponent dst = new ProsthesisComponent();
5829        copyValues(dst);
5830        dst.initial = initial == null ? null : initial.copy();
5831        dst.priorDate = priorDate == null ? null : priorDate.copy();
5832        dst.priorMaterial = priorMaterial == null ? null : priorMaterial.copy();
5833        return dst;
5834      }
5835
5836      @Override
5837      public boolean equalsDeep(Base other) {
5838        if (!super.equalsDeep(other))
5839          return false;
5840        if (!(other instanceof ProsthesisComponent))
5841          return false;
5842        ProsthesisComponent o = (ProsthesisComponent) other;
5843        return compareDeep(initial, o.initial, true) && compareDeep(priorDate, o.priorDate, true) && compareDeep(priorMaterial, o.priorMaterial, true)
5844          ;
5845      }
5846
5847      @Override
5848      public boolean equalsShallow(Base other) {
5849        if (!super.equalsShallow(other))
5850          return false;
5851        if (!(other instanceof ProsthesisComponent))
5852          return false;
5853        ProsthesisComponent o = (ProsthesisComponent) other;
5854        return compareValues(initial, o.initial, true) && compareValues(priorDate, o.priorDate, true);
5855      }
5856
5857      public boolean isEmpty() {
5858        return super.isEmpty() && (initial == null || initial.isEmpty()) && (priorDate == null || priorDate.isEmpty())
5859           && (priorMaterial == null || priorMaterial.isEmpty());
5860      }
5861
5862  public String fhirType() {
5863    return "ExplanationOfBenefit.item.prosthesis";
5864
5865  }
5866
5867  }
5868
5869    @Block()
5870    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
5871        /**
5872         * List of input service items which this service line is intended to replace.
5873         */
5874        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5875        @Description(shortDefinition="Service instances", formalDefinition="List of input service items which this service line is intended to replace." )
5876        protected List<PositiveIntType> sequenceLinkId;
5877
5878        /**
5879         * A code to indicate the Professional Service or Product supplied.
5880         */
5881        @Child(name = "service", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
5882        @Description(shortDefinition="Group, Service or Product", formalDefinition="A code to indicate the Professional Service or Product supplied." )
5883        protected Coding service;
5884
5885        /**
5886         * The fee charged for the professional service or product..
5887         */
5888        @Child(name = "fee", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
5889        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product.." )
5890        protected Money fee;
5891
5892        /**
5893         * A list of note references to the notes provided below.
5894         */
5895        @Child(name = "noteNumberLinkId", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5896        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
5897        protected List<PositiveIntType> noteNumberLinkId;
5898
5899        /**
5900         * The adjudications results.
5901         */
5902        @Child(name = "adjudication", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5903        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudications results." )
5904        protected List<AddedItemAdjudicationComponent> adjudication;
5905
5906        /**
5907         * The second tier service adjudications for payor added services.
5908         */
5909        @Child(name = "detail", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5910        @Description(shortDefinition="Added items details", formalDefinition="The second tier service adjudications for payor added services." )
5911        protected List<AddedItemsDetailComponent> detail;
5912
5913        private static final long serialVersionUID = -1675935854L;
5914
5915    /**
5916     * Constructor
5917     */
5918      public AddedItemComponent() {
5919        super();
5920      }
5921
5922    /**
5923     * Constructor
5924     */
5925      public AddedItemComponent(Coding service) {
5926        super();
5927        this.service = service;
5928      }
5929
5930        /**
5931         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
5932         */
5933        public List<PositiveIntType> getSequenceLinkId() { 
5934          if (this.sequenceLinkId == null)
5935            this.sequenceLinkId = new ArrayList<PositiveIntType>();
5936          return this.sequenceLinkId;
5937        }
5938
5939        public boolean hasSequenceLinkId() { 
5940          if (this.sequenceLinkId == null)
5941            return false;
5942          for (PositiveIntType item : this.sequenceLinkId)
5943            if (!item.isEmpty())
5944              return true;
5945          return false;
5946        }
5947
5948        /**
5949         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
5950         */
5951    // syntactic sugar
5952        public PositiveIntType addSequenceLinkIdElement() {//2 
5953          PositiveIntType t = new PositiveIntType();
5954          if (this.sequenceLinkId == null)
5955            this.sequenceLinkId = new ArrayList<PositiveIntType>();
5956          this.sequenceLinkId.add(t);
5957          return t;
5958        }
5959
5960        /**
5961         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
5962         */
5963        public AddedItemComponent addSequenceLinkId(int value) { //1
5964          PositiveIntType t = new PositiveIntType();
5965          t.setValue(value);
5966          if (this.sequenceLinkId == null)
5967            this.sequenceLinkId = new ArrayList<PositiveIntType>();
5968          this.sequenceLinkId.add(t);
5969          return this;
5970        }
5971
5972        /**
5973         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
5974         */
5975        public boolean hasSequenceLinkId(int value) { 
5976          if (this.sequenceLinkId == null)
5977            return false;
5978          for (PositiveIntType v : this.sequenceLinkId)
5979            if (v.equals(value)) // positiveInt
5980              return true;
5981          return false;
5982        }
5983
5984        /**
5985         * @return {@link #service} (A code to indicate the Professional Service or Product supplied.)
5986         */
5987        public Coding getService() { 
5988          if (this.service == null)
5989            if (Configuration.errorOnAutoCreate())
5990              throw new Error("Attempt to auto-create AddedItemComponent.service");
5991            else if (Configuration.doAutoCreate())
5992              this.service = new Coding(); // cc
5993          return this.service;
5994        }
5995
5996        public boolean hasService() { 
5997          return this.service != null && !this.service.isEmpty();
5998        }
5999
6000        /**
6001         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied.)
6002         */
6003        public AddedItemComponent setService(Coding value) { 
6004          this.service = value;
6005          return this;
6006        }
6007
6008        /**
6009         * @return {@link #fee} (The fee charged for the professional service or product..)
6010         */
6011        public Money getFee() { 
6012          if (this.fee == null)
6013            if (Configuration.errorOnAutoCreate())
6014              throw new Error("Attempt to auto-create AddedItemComponent.fee");
6015            else if (Configuration.doAutoCreate())
6016              this.fee = new Money(); // cc
6017          return this.fee;
6018        }
6019
6020        public boolean hasFee() { 
6021          return this.fee != null && !this.fee.isEmpty();
6022        }
6023
6024        /**
6025         * @param value {@link #fee} (The fee charged for the professional service or product..)
6026         */
6027        public AddedItemComponent setFee(Money value) { 
6028          this.fee = value;
6029          return this;
6030        }
6031
6032        /**
6033         * @return {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
6034         */
6035        public List<PositiveIntType> getNoteNumberLinkId() { 
6036          if (this.noteNumberLinkId == null)
6037            this.noteNumberLinkId = new ArrayList<PositiveIntType>();
6038          return this.noteNumberLinkId;
6039        }
6040
6041        public boolean hasNoteNumberLinkId() { 
6042          if (this.noteNumberLinkId == null)
6043            return false;
6044          for (PositiveIntType item : this.noteNumberLinkId)
6045            if (!item.isEmpty())
6046              return true;
6047          return false;
6048        }
6049
6050        /**
6051         * @return {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
6052         */
6053    // syntactic sugar
6054        public PositiveIntType addNoteNumberLinkIdElement() {//2 
6055          PositiveIntType t = new PositiveIntType();
6056          if (this.noteNumberLinkId == null)
6057            this.noteNumberLinkId = new ArrayList<PositiveIntType>();
6058          this.noteNumberLinkId.add(t);
6059          return t;
6060        }
6061
6062        /**
6063         * @param value {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
6064         */
6065        public AddedItemComponent addNoteNumberLinkId(int value) { //1
6066          PositiveIntType t = new PositiveIntType();
6067          t.setValue(value);
6068          if (this.noteNumberLinkId == null)
6069            this.noteNumberLinkId = new ArrayList<PositiveIntType>();
6070          this.noteNumberLinkId.add(t);
6071          return this;
6072        }
6073
6074        /**
6075         * @param value {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
6076         */
6077        public boolean hasNoteNumberLinkId(int value) { 
6078          if (this.noteNumberLinkId == null)
6079            return false;
6080          for (PositiveIntType v : this.noteNumberLinkId)
6081            if (v.equals(value)) // positiveInt
6082              return true;
6083          return false;
6084        }
6085
6086        /**
6087         * @return {@link #adjudication} (The adjudications results.)
6088         */
6089        public List<AddedItemAdjudicationComponent> getAdjudication() { 
6090          if (this.adjudication == null)
6091            this.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
6092          return this.adjudication;
6093        }
6094
6095        public boolean hasAdjudication() { 
6096          if (this.adjudication == null)
6097            return false;
6098          for (AddedItemAdjudicationComponent item : this.adjudication)
6099            if (!item.isEmpty())
6100              return true;
6101          return false;
6102        }
6103
6104        /**
6105         * @return {@link #adjudication} (The adjudications results.)
6106         */
6107    // syntactic sugar
6108        public AddedItemAdjudicationComponent addAdjudication() { //3
6109          AddedItemAdjudicationComponent t = new AddedItemAdjudicationComponent();
6110          if (this.adjudication == null)
6111            this.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
6112          this.adjudication.add(t);
6113          return t;
6114        }
6115
6116    // syntactic sugar
6117        public AddedItemComponent addAdjudication(AddedItemAdjudicationComponent t) { //3
6118          if (t == null)
6119            return this;
6120          if (this.adjudication == null)
6121            this.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
6122          this.adjudication.add(t);
6123          return this;
6124        }
6125
6126        /**
6127         * @return {@link #detail} (The second tier service adjudications for payor added services.)
6128         */
6129        public List<AddedItemsDetailComponent> getDetail() { 
6130          if (this.detail == null)
6131            this.detail = new ArrayList<AddedItemsDetailComponent>();
6132          return this.detail;
6133        }
6134
6135        public boolean hasDetail() { 
6136          if (this.detail == null)
6137            return false;
6138          for (AddedItemsDetailComponent item : this.detail)
6139            if (!item.isEmpty())
6140              return true;
6141          return false;
6142        }
6143
6144        /**
6145         * @return {@link #detail} (The second tier service adjudications for payor added services.)
6146         */
6147    // syntactic sugar
6148        public AddedItemsDetailComponent addDetail() { //3
6149          AddedItemsDetailComponent t = new AddedItemsDetailComponent();
6150          if (this.detail == null)
6151            this.detail = new ArrayList<AddedItemsDetailComponent>();
6152          this.detail.add(t);
6153          return t;
6154        }
6155
6156    // syntactic sugar
6157        public AddedItemComponent addDetail(AddedItemsDetailComponent t) { //3
6158          if (t == null)
6159            return this;
6160          if (this.detail == null)
6161            this.detail = new ArrayList<AddedItemsDetailComponent>();
6162          this.detail.add(t);
6163          return this;
6164        }
6165
6166        protected void listChildren(List<Property> childrenList) {
6167          super.listChildren(childrenList);
6168          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));
6169          childrenList.add(new Property("service", "Coding", "A code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
6170          childrenList.add(new Property("fee", "Money", "The fee charged for the professional service or product..", 0, java.lang.Integer.MAX_VALUE, fee));
6171          childrenList.add(new Property("noteNumberLinkId", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumberLinkId));
6172          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6173          childrenList.add(new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
6174        }
6175
6176      @Override
6177      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6178        switch (hash) {
6179        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : this.sequenceLinkId.toArray(new Base[this.sequenceLinkId.size()]); // PositiveIntType
6180        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // Coding
6181        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
6182        case -1859667856: /*noteNumberLinkId*/ return this.noteNumberLinkId == null ? new Base[0] : this.noteNumberLinkId.toArray(new Base[this.noteNumberLinkId.size()]); // PositiveIntType
6183        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AddedItemAdjudicationComponent
6184        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemsDetailComponent
6185        default: return super.getProperty(hash, name, checkValid);
6186        }
6187
6188      }
6189
6190      @Override
6191      public void setProperty(int hash, String name, Base value) throws FHIRException {
6192        switch (hash) {
6193        case -1422298666: // sequenceLinkId
6194          this.getSequenceLinkId().add(castToPositiveInt(value)); // PositiveIntType
6195          break;
6196        case 1984153269: // service
6197          this.service = castToCoding(value); // Coding
6198          break;
6199        case 101254: // fee
6200          this.fee = castToMoney(value); // Money
6201          break;
6202        case -1859667856: // noteNumberLinkId
6203          this.getNoteNumberLinkId().add(castToPositiveInt(value)); // PositiveIntType
6204          break;
6205        case -231349275: // adjudication
6206          this.getAdjudication().add((AddedItemAdjudicationComponent) value); // AddedItemAdjudicationComponent
6207          break;
6208        case -1335224239: // detail
6209          this.getDetail().add((AddedItemsDetailComponent) value); // AddedItemsDetailComponent
6210          break;
6211        default: super.setProperty(hash, name, value);
6212        }
6213
6214      }
6215
6216      @Override
6217      public void setProperty(String name, Base value) throws FHIRException {
6218        if (name.equals("sequenceLinkId"))
6219          this.getSequenceLinkId().add(castToPositiveInt(value));
6220        else if (name.equals("service"))
6221          this.service = castToCoding(value); // Coding
6222        else if (name.equals("fee"))
6223          this.fee = castToMoney(value); // Money
6224        else if (name.equals("noteNumberLinkId"))
6225          this.getNoteNumberLinkId().add(castToPositiveInt(value));
6226        else if (name.equals("adjudication"))
6227          this.getAdjudication().add((AddedItemAdjudicationComponent) value);
6228        else if (name.equals("detail"))
6229          this.getDetail().add((AddedItemsDetailComponent) value);
6230        else
6231          super.setProperty(name, value);
6232      }
6233
6234      @Override
6235      public Base makeProperty(int hash, String name) throws FHIRException {
6236        switch (hash) {
6237        case -1422298666: throw new FHIRException("Cannot make property sequenceLinkId as it is not a complex type"); // PositiveIntType
6238        case 1984153269:  return getService(); // Coding
6239        case 101254:  return getFee(); // Money
6240        case -1859667856: throw new FHIRException("Cannot make property noteNumberLinkId as it is not a complex type"); // PositiveIntType
6241        case -231349275:  return addAdjudication(); // AddedItemAdjudicationComponent
6242        case -1335224239:  return addDetail(); // AddedItemsDetailComponent
6243        default: return super.makeProperty(hash, name);
6244        }
6245
6246      }
6247
6248      @Override
6249      public Base addChild(String name) throws FHIRException {
6250        if (name.equals("sequenceLinkId")) {
6251          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequenceLinkId");
6252        }
6253        else if (name.equals("service")) {
6254          this.service = new Coding();
6255          return this.service;
6256        }
6257        else if (name.equals("fee")) {
6258          this.fee = new Money();
6259          return this.fee;
6260        }
6261        else if (name.equals("noteNumberLinkId")) {
6262          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumberLinkId");
6263        }
6264        else if (name.equals("adjudication")) {
6265          return addAdjudication();
6266        }
6267        else if (name.equals("detail")) {
6268          return addDetail();
6269        }
6270        else
6271          return super.addChild(name);
6272      }
6273
6274      public AddedItemComponent copy() {
6275        AddedItemComponent dst = new AddedItemComponent();
6276        copyValues(dst);
6277        if (sequenceLinkId != null) {
6278          dst.sequenceLinkId = new ArrayList<PositiveIntType>();
6279          for (PositiveIntType i : sequenceLinkId)
6280            dst.sequenceLinkId.add(i.copy());
6281        };
6282        dst.service = service == null ? null : service.copy();
6283        dst.fee = fee == null ? null : fee.copy();
6284        if (noteNumberLinkId != null) {
6285          dst.noteNumberLinkId = new ArrayList<PositiveIntType>();
6286          for (PositiveIntType i : noteNumberLinkId)
6287            dst.noteNumberLinkId.add(i.copy());
6288        };
6289        if (adjudication != null) {
6290          dst.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
6291          for (AddedItemAdjudicationComponent i : adjudication)
6292            dst.adjudication.add(i.copy());
6293        };
6294        if (detail != null) {
6295          dst.detail = new ArrayList<AddedItemsDetailComponent>();
6296          for (AddedItemsDetailComponent i : detail)
6297            dst.detail.add(i.copy());
6298        };
6299        return dst;
6300      }
6301
6302      @Override
6303      public boolean equalsDeep(Base other) {
6304        if (!super.equalsDeep(other))
6305          return false;
6306        if (!(other instanceof AddedItemComponent))
6307          return false;
6308        AddedItemComponent o = (AddedItemComponent) other;
6309        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(service, o.service, true)
6310           && compareDeep(fee, o.fee, true) && compareDeep(noteNumberLinkId, o.noteNumberLinkId, true) && compareDeep(adjudication, o.adjudication, true)
6311           && compareDeep(detail, o.detail, true);
6312      }
6313
6314      @Override
6315      public boolean equalsShallow(Base other) {
6316        if (!super.equalsShallow(other))
6317          return false;
6318        if (!(other instanceof AddedItemComponent))
6319          return false;
6320        AddedItemComponent o = (AddedItemComponent) other;
6321        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumberLinkId, o.noteNumberLinkId, true)
6322          ;
6323      }
6324
6325      public boolean isEmpty() {
6326        return super.isEmpty() && (sequenceLinkId == null || sequenceLinkId.isEmpty()) && (service == null || service.isEmpty())
6327           && (fee == null || fee.isEmpty()) && (noteNumberLinkId == null || noteNumberLinkId.isEmpty())
6328           && (adjudication == null || adjudication.isEmpty()) && (detail == null || detail.isEmpty())
6329          ;
6330      }
6331
6332  public String fhirType() {
6333    return "ExplanationOfBenefit.addItem";
6334
6335  }
6336
6337  }
6338
6339    @Block()
6340    public static class AddedItemAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
6341        /**
6342         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
6343         */
6344        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
6345        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
6346        protected Coding category;
6347
6348        /**
6349         * Adjudication reason such as limit reached.
6350         */
6351        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
6352        @Description(shortDefinition="Adjudication reason", formalDefinition="Adjudication reason such as limit reached." )
6353        protected Coding reason;
6354
6355        /**
6356         * Monitory amount associated with the code.
6357         */
6358        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
6359        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
6360        protected Money amount;
6361
6362        /**
6363         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6364         */
6365        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
6366        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
6367        protected DecimalType value;
6368
6369        private static final long serialVersionUID = -1926987562L;
6370
6371    /**
6372     * Constructor
6373     */
6374      public AddedItemAdjudicationComponent() {
6375        super();
6376      }
6377
6378    /**
6379     * Constructor
6380     */
6381      public AddedItemAdjudicationComponent(Coding category) {
6382        super();
6383        this.category = category;
6384      }
6385
6386        /**
6387         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
6388         */
6389        public Coding getCategory() { 
6390          if (this.category == null)
6391            if (Configuration.errorOnAutoCreate())
6392              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.category");
6393            else if (Configuration.doAutoCreate())
6394              this.category = new Coding(); // cc
6395          return this.category;
6396        }
6397
6398        public boolean hasCategory() { 
6399          return this.category != null && !this.category.isEmpty();
6400        }
6401
6402        /**
6403         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
6404         */
6405        public AddedItemAdjudicationComponent setCategory(Coding value) { 
6406          this.category = value;
6407          return this;
6408        }
6409
6410        /**
6411         * @return {@link #reason} (Adjudication reason such as limit reached.)
6412         */
6413        public Coding getReason() { 
6414          if (this.reason == null)
6415            if (Configuration.errorOnAutoCreate())
6416              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.reason");
6417            else if (Configuration.doAutoCreate())
6418              this.reason = new Coding(); // cc
6419          return this.reason;
6420        }
6421
6422        public boolean hasReason() { 
6423          return this.reason != null && !this.reason.isEmpty();
6424        }
6425
6426        /**
6427         * @param value {@link #reason} (Adjudication reason such as limit reached.)
6428         */
6429        public AddedItemAdjudicationComponent setReason(Coding value) { 
6430          this.reason = value;
6431          return this;
6432        }
6433
6434        /**
6435         * @return {@link #amount} (Monitory amount associated with the code.)
6436         */
6437        public Money getAmount() { 
6438          if (this.amount == null)
6439            if (Configuration.errorOnAutoCreate())
6440              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.amount");
6441            else if (Configuration.doAutoCreate())
6442              this.amount = new Money(); // cc
6443          return this.amount;
6444        }
6445
6446        public boolean hasAmount() { 
6447          return this.amount != null && !this.amount.isEmpty();
6448        }
6449
6450        /**
6451         * @param value {@link #amount} (Monitory amount associated with the code.)
6452         */
6453        public AddedItemAdjudicationComponent setAmount(Money value) { 
6454          this.amount = value;
6455          return this;
6456        }
6457
6458        /**
6459         * @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
6460         */
6461        public DecimalType getValueElement() { 
6462          if (this.value == null)
6463            if (Configuration.errorOnAutoCreate())
6464              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.value");
6465            else if (Configuration.doAutoCreate())
6466              this.value = new DecimalType(); // bb
6467          return this.value;
6468        }
6469
6470        public boolean hasValueElement() { 
6471          return this.value != null && !this.value.isEmpty();
6472        }
6473
6474        public boolean hasValue() { 
6475          return this.value != null && !this.value.isEmpty();
6476        }
6477
6478        /**
6479         * @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
6480         */
6481        public AddedItemAdjudicationComponent setValueElement(DecimalType value) { 
6482          this.value = value;
6483          return this;
6484        }
6485
6486        /**
6487         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6488         */
6489        public BigDecimal getValue() { 
6490          return this.value == null ? null : this.value.getValue();
6491        }
6492
6493        /**
6494         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6495         */
6496        public AddedItemAdjudicationComponent setValue(BigDecimal value) { 
6497          if (value == null)
6498            this.value = null;
6499          else {
6500            if (this.value == null)
6501              this.value = new DecimalType();
6502            this.value.setValue(value);
6503          }
6504          return this;
6505        }
6506
6507        /**
6508         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6509         */
6510        public AddedItemAdjudicationComponent setValue(long value) { 
6511              this.value = new DecimalType();
6512            this.value.setValue(value);
6513          return this;
6514        }
6515
6516        /**
6517         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6518         */
6519        public AddedItemAdjudicationComponent setValue(double value) { 
6520              this.value = new DecimalType();
6521            this.value.setValue(value);
6522          return this;
6523        }
6524
6525        protected void listChildren(List<Property> childrenList) {
6526          super.listChildren(childrenList);
6527          childrenList.add(new Property("category", "Coding", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
6528          childrenList.add(new Property("reason", "Coding", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
6529          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
6530          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));
6531        }
6532
6533      @Override
6534      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6535        switch (hash) {
6536        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
6537        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
6538        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
6539        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
6540        default: return super.getProperty(hash, name, checkValid);
6541        }
6542
6543      }
6544
6545      @Override
6546      public void setProperty(int hash, String name, Base value) throws FHIRException {
6547        switch (hash) {
6548        case 50511102: // category
6549          this.category = castToCoding(value); // Coding
6550          break;
6551        case -934964668: // reason
6552          this.reason = castToCoding(value); // Coding
6553          break;
6554        case -1413853096: // amount
6555          this.amount = castToMoney(value); // Money
6556          break;
6557        case 111972721: // value
6558          this.value = castToDecimal(value); // DecimalType
6559          break;
6560        default: super.setProperty(hash, name, value);
6561        }
6562
6563      }
6564
6565      @Override
6566      public void setProperty(String name, Base value) throws FHIRException {
6567        if (name.equals("category"))
6568          this.category = castToCoding(value); // Coding
6569        else if (name.equals("reason"))
6570          this.reason = castToCoding(value); // Coding
6571        else if (name.equals("amount"))
6572          this.amount = castToMoney(value); // Money
6573        else if (name.equals("value"))
6574          this.value = castToDecimal(value); // DecimalType
6575        else
6576          super.setProperty(name, value);
6577      }
6578
6579      @Override
6580      public Base makeProperty(int hash, String name) throws FHIRException {
6581        switch (hash) {
6582        case 50511102:  return getCategory(); // Coding
6583        case -934964668:  return getReason(); // Coding
6584        case -1413853096:  return getAmount(); // Money
6585        case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // DecimalType
6586        default: return super.makeProperty(hash, name);
6587        }
6588
6589      }
6590
6591      @Override
6592      public Base addChild(String name) throws FHIRException {
6593        if (name.equals("category")) {
6594          this.category = new Coding();
6595          return this.category;
6596        }
6597        else if (name.equals("reason")) {
6598          this.reason = new Coding();
6599          return this.reason;
6600        }
6601        else if (name.equals("amount")) {
6602          this.amount = new Money();
6603          return this.amount;
6604        }
6605        else if (name.equals("value")) {
6606          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
6607        }
6608        else
6609          return super.addChild(name);
6610      }
6611
6612      public AddedItemAdjudicationComponent copy() {
6613        AddedItemAdjudicationComponent dst = new AddedItemAdjudicationComponent();
6614        copyValues(dst);
6615        dst.category = category == null ? null : category.copy();
6616        dst.reason = reason == null ? null : reason.copy();
6617        dst.amount = amount == null ? null : amount.copy();
6618        dst.value = value == null ? null : value.copy();
6619        return dst;
6620      }
6621
6622      @Override
6623      public boolean equalsDeep(Base other) {
6624        if (!super.equalsDeep(other))
6625          return false;
6626        if (!(other instanceof AddedItemAdjudicationComponent))
6627          return false;
6628        AddedItemAdjudicationComponent o = (AddedItemAdjudicationComponent) other;
6629        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
6630           && compareDeep(value, o.value, true);
6631      }
6632
6633      @Override
6634      public boolean equalsShallow(Base other) {
6635        if (!super.equalsShallow(other))
6636          return false;
6637        if (!(other instanceof AddedItemAdjudicationComponent))
6638          return false;
6639        AddedItemAdjudicationComponent o = (AddedItemAdjudicationComponent) other;
6640        return compareValues(value, o.value, true);
6641      }
6642
6643      public boolean isEmpty() {
6644        return super.isEmpty() && (category == null || category.isEmpty()) && (reason == null || reason.isEmpty())
6645           && (amount == null || amount.isEmpty()) && (value == null || value.isEmpty());
6646      }
6647
6648  public String fhirType() {
6649    return "ExplanationOfBenefit.addItem.adjudication";
6650
6651  }
6652
6653  }
6654
6655    @Block()
6656    public static class AddedItemsDetailComponent extends BackboneElement implements IBaseBackboneElement {
6657        /**
6658         * A code to indicate the Professional Service or Product supplied.
6659         */
6660        @Child(name = "service", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
6661        @Description(shortDefinition="Service or Product", formalDefinition="A code to indicate the Professional Service or Product supplied." )
6662        protected Coding service;
6663
6664        /**
6665         * The fee charged for the professional service or product..
6666         */
6667        @Child(name = "fee", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=true)
6668        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product.." )
6669        protected Money fee;
6670
6671        /**
6672         * The adjudications results.
6673         */
6674        @Child(name = "adjudication", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6675        @Description(shortDefinition="Added items detail adjudication", formalDefinition="The adjudications results." )
6676        protected List<AddedItemDetailAdjudicationComponent> adjudication;
6677
6678        private static final long serialVersionUID = -2104242020L;
6679
6680    /**
6681     * Constructor
6682     */
6683      public AddedItemsDetailComponent() {
6684        super();
6685      }
6686
6687    /**
6688     * Constructor
6689     */
6690      public AddedItemsDetailComponent(Coding service) {
6691        super();
6692        this.service = service;
6693      }
6694
6695        /**
6696         * @return {@link #service} (A code to indicate the Professional Service or Product supplied.)
6697         */
6698        public Coding getService() { 
6699          if (this.service == null)
6700            if (Configuration.errorOnAutoCreate())
6701              throw new Error("Attempt to auto-create AddedItemsDetailComponent.service");
6702            else if (Configuration.doAutoCreate())
6703              this.service = new Coding(); // cc
6704          return this.service;
6705        }
6706
6707        public boolean hasService() { 
6708          return this.service != null && !this.service.isEmpty();
6709        }
6710
6711        /**
6712         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied.)
6713         */
6714        public AddedItemsDetailComponent setService(Coding value) { 
6715          this.service = value;
6716          return this;
6717        }
6718
6719        /**
6720         * @return {@link #fee} (The fee charged for the professional service or product..)
6721         */
6722        public Money getFee() { 
6723          if (this.fee == null)
6724            if (Configuration.errorOnAutoCreate())
6725              throw new Error("Attempt to auto-create AddedItemsDetailComponent.fee");
6726            else if (Configuration.doAutoCreate())
6727              this.fee = new Money(); // cc
6728          return this.fee;
6729        }
6730
6731        public boolean hasFee() { 
6732          return this.fee != null && !this.fee.isEmpty();
6733        }
6734
6735        /**
6736         * @param value {@link #fee} (The fee charged for the professional service or product..)
6737         */
6738        public AddedItemsDetailComponent setFee(Money value) { 
6739          this.fee = value;
6740          return this;
6741        }
6742
6743        /**
6744         * @return {@link #adjudication} (The adjudications results.)
6745         */
6746        public List<AddedItemDetailAdjudicationComponent> getAdjudication() { 
6747          if (this.adjudication == null)
6748            this.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
6749          return this.adjudication;
6750        }
6751
6752        public boolean hasAdjudication() { 
6753          if (this.adjudication == null)
6754            return false;
6755          for (AddedItemDetailAdjudicationComponent item : this.adjudication)
6756            if (!item.isEmpty())
6757              return true;
6758          return false;
6759        }
6760
6761        /**
6762         * @return {@link #adjudication} (The adjudications results.)
6763         */
6764    // syntactic sugar
6765        public AddedItemDetailAdjudicationComponent addAdjudication() { //3
6766          AddedItemDetailAdjudicationComponent t = new AddedItemDetailAdjudicationComponent();
6767          if (this.adjudication == null)
6768            this.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
6769          this.adjudication.add(t);
6770          return t;
6771        }
6772
6773    // syntactic sugar
6774        public AddedItemsDetailComponent addAdjudication(AddedItemDetailAdjudicationComponent t) { //3
6775          if (t == null)
6776            return this;
6777          if (this.adjudication == null)
6778            this.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
6779          this.adjudication.add(t);
6780          return this;
6781        }
6782
6783        protected void listChildren(List<Property> childrenList) {
6784          super.listChildren(childrenList);
6785          childrenList.add(new Property("service", "Coding", "A code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
6786          childrenList.add(new Property("fee", "Money", "The fee charged for the professional service or product..", 0, java.lang.Integer.MAX_VALUE, fee));
6787          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6788        }
6789
6790      @Override
6791      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6792        switch (hash) {
6793        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // Coding
6794        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
6795        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AddedItemDetailAdjudicationComponent
6796        default: return super.getProperty(hash, name, checkValid);
6797        }
6798
6799      }
6800
6801      @Override
6802      public void setProperty(int hash, String name, Base value) throws FHIRException {
6803        switch (hash) {
6804        case 1984153269: // service
6805          this.service = castToCoding(value); // Coding
6806          break;
6807        case 101254: // fee
6808          this.fee = castToMoney(value); // Money
6809          break;
6810        case -231349275: // adjudication
6811          this.getAdjudication().add((AddedItemDetailAdjudicationComponent) value); // AddedItemDetailAdjudicationComponent
6812          break;
6813        default: super.setProperty(hash, name, value);
6814        }
6815
6816      }
6817
6818      @Override
6819      public void setProperty(String name, Base value) throws FHIRException {
6820        if (name.equals("service"))
6821          this.service = castToCoding(value); // Coding
6822        else if (name.equals("fee"))
6823          this.fee = castToMoney(value); // Money
6824        else if (name.equals("adjudication"))
6825          this.getAdjudication().add((AddedItemDetailAdjudicationComponent) value);
6826        else
6827          super.setProperty(name, value);
6828      }
6829
6830      @Override
6831      public Base makeProperty(int hash, String name) throws FHIRException {
6832        switch (hash) {
6833        case 1984153269:  return getService(); // Coding
6834        case 101254:  return getFee(); // Money
6835        case -231349275:  return addAdjudication(); // AddedItemDetailAdjudicationComponent
6836        default: return super.makeProperty(hash, name);
6837        }
6838
6839      }
6840
6841      @Override
6842      public Base addChild(String name) throws FHIRException {
6843        if (name.equals("service")) {
6844          this.service = new Coding();
6845          return this.service;
6846        }
6847        else if (name.equals("fee")) {
6848          this.fee = new Money();
6849          return this.fee;
6850        }
6851        else if (name.equals("adjudication")) {
6852          return addAdjudication();
6853        }
6854        else
6855          return super.addChild(name);
6856      }
6857
6858      public AddedItemsDetailComponent copy() {
6859        AddedItemsDetailComponent dst = new AddedItemsDetailComponent();
6860        copyValues(dst);
6861        dst.service = service == null ? null : service.copy();
6862        dst.fee = fee == null ? null : fee.copy();
6863        if (adjudication != null) {
6864          dst.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
6865          for (AddedItemDetailAdjudicationComponent i : adjudication)
6866            dst.adjudication.add(i.copy());
6867        };
6868        return dst;
6869      }
6870
6871      @Override
6872      public boolean equalsDeep(Base other) {
6873        if (!super.equalsDeep(other))
6874          return false;
6875        if (!(other instanceof AddedItemsDetailComponent))
6876          return false;
6877        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other;
6878        return compareDeep(service, o.service, true) && compareDeep(fee, o.fee, true) && compareDeep(adjudication, o.adjudication, true)
6879          ;
6880      }
6881
6882      @Override
6883      public boolean equalsShallow(Base other) {
6884        if (!super.equalsShallow(other))
6885          return false;
6886        if (!(other instanceof AddedItemsDetailComponent))
6887          return false;
6888        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other;
6889        return true;
6890      }
6891
6892      public boolean isEmpty() {
6893        return super.isEmpty() && (service == null || service.isEmpty()) && (fee == null || fee.isEmpty())
6894           && (adjudication == null || adjudication.isEmpty());
6895      }
6896
6897  public String fhirType() {
6898    return "ExplanationOfBenefit.addItem.detail";
6899
6900  }
6901
6902  }
6903
6904    @Block()
6905    public static class AddedItemDetailAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
6906        /**
6907         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
6908         */
6909        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
6910        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
6911        protected Coding category;
6912
6913        /**
6914         * Adjudication reason such as limit reached.
6915         */
6916        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
6917        @Description(shortDefinition="Adjudication reason", formalDefinition="Adjudication reason such as limit reached." )
6918        protected Coding reason;
6919
6920        /**
6921         * Monitory amount associated with the code.
6922         */
6923        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
6924        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
6925        protected Money amount;
6926
6927        /**
6928         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
6929         */
6930        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
6931        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
6932        protected DecimalType value;
6933
6934        private static final long serialVersionUID = -1926987562L;
6935
6936    /**
6937     * Constructor
6938     */
6939      public AddedItemDetailAdjudicationComponent() {
6940        super();
6941      }
6942
6943    /**
6944     * Constructor
6945     */
6946      public AddedItemDetailAdjudicationComponent(Coding category) {
6947        super();
6948        this.category = category;
6949      }
6950
6951        /**
6952         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
6953         */
6954        public Coding getCategory() { 
6955          if (this.category == null)
6956            if (Configuration.errorOnAutoCreate())
6957              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.category");
6958            else if (Configuration.doAutoCreate())
6959              this.category = new Coding(); // cc
6960          return this.category;
6961        }
6962
6963        public boolean hasCategory() { 
6964          return this.category != null && !this.category.isEmpty();
6965        }
6966
6967        /**
6968         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
6969         */
6970        public AddedItemDetailAdjudicationComponent setCategory(Coding value) { 
6971          this.category = value;
6972          return this;
6973        }
6974
6975        /**
6976         * @return {@link #reason} (Adjudication reason such as limit reached.)
6977         */
6978        public Coding getReason() { 
6979          if (this.reason == null)
6980            if (Configuration.errorOnAutoCreate())
6981              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.reason");
6982            else if (Configuration.doAutoCreate())
6983              this.reason = new Coding(); // cc
6984          return this.reason;
6985        }
6986
6987        public boolean hasReason() { 
6988          return this.reason != null && !this.reason.isEmpty();
6989        }
6990
6991        /**
6992         * @param value {@link #reason} (Adjudication reason such as limit reached.)
6993         */
6994        public AddedItemDetailAdjudicationComponent setReason(Coding value) { 
6995          this.reason = value;
6996          return this;
6997        }
6998
6999        /**
7000         * @return {@link #amount} (Monitory amount associated with the code.)
7001         */
7002        public Money getAmount() { 
7003          if (this.amount == null)
7004            if (Configuration.errorOnAutoCreate())
7005              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.amount");
7006            else if (Configuration.doAutoCreate())
7007              this.amount = new Money(); // cc
7008          return this.amount;
7009        }
7010
7011        public boolean hasAmount() { 
7012          return this.amount != null && !this.amount.isEmpty();
7013        }
7014
7015        /**
7016         * @param value {@link #amount} (Monitory amount associated with the code.)
7017         */
7018        public AddedItemDetailAdjudicationComponent setAmount(Money value) { 
7019          this.amount = value;
7020          return this;
7021        }
7022
7023        /**
7024         * @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
7025         */
7026        public DecimalType getValueElement() { 
7027          if (this.value == null)
7028            if (Configuration.errorOnAutoCreate())
7029              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.value");
7030            else if (Configuration.doAutoCreate())
7031              this.value = new DecimalType(); // bb
7032          return this.value;
7033        }
7034
7035        public boolean hasValueElement() { 
7036          return this.value != null && !this.value.isEmpty();
7037        }
7038
7039        public boolean hasValue() { 
7040          return this.value != null && !this.value.isEmpty();
7041        }
7042
7043        /**
7044         * @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
7045         */
7046        public AddedItemDetailAdjudicationComponent setValueElement(DecimalType value) { 
7047          this.value = value;
7048          return this;
7049        }
7050
7051        /**
7052         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
7053         */
7054        public BigDecimal getValue() { 
7055          return this.value == null ? null : this.value.getValue();
7056        }
7057
7058        /**
7059         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
7060         */
7061        public AddedItemDetailAdjudicationComponent setValue(BigDecimal value) { 
7062          if (value == null)
7063            this.value = null;
7064          else {
7065            if (this.value == null)
7066              this.value = new DecimalType();
7067            this.value.setValue(value);
7068          }
7069          return this;
7070        }
7071
7072        /**
7073         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
7074         */
7075        public AddedItemDetailAdjudicationComponent setValue(long value) { 
7076              this.value = new DecimalType();
7077            this.value.setValue(value);
7078          return this;
7079        }
7080
7081        /**
7082         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
7083         */
7084        public AddedItemDetailAdjudicationComponent setValue(double value) { 
7085              this.value = new DecimalType();
7086            this.value.setValue(value);
7087          return this;
7088        }
7089
7090        protected void listChildren(List<Property> childrenList) {
7091          super.listChildren(childrenList);
7092          childrenList.add(new Property("category", "Coding", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
7093          childrenList.add(new Property("reason", "Coding", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
7094          childrenList.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
7095          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));
7096        }
7097
7098      @Override
7099      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7100        switch (hash) {
7101        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
7102        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
7103        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
7104        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
7105        default: return super.getProperty(hash, name, checkValid);
7106        }
7107
7108      }
7109
7110      @Override
7111      public void setProperty(int hash, String name, Base value) throws FHIRException {
7112        switch (hash) {
7113        case 50511102: // category
7114          this.category = castToCoding(value); // Coding
7115          break;
7116        case -934964668: // reason
7117          this.reason = castToCoding(value); // Coding
7118          break;
7119        case -1413853096: // amount
7120          this.amount = castToMoney(value); // Money
7121          break;
7122        case 111972721: // value
7123          this.value = castToDecimal(value); // DecimalType
7124          break;
7125        default: super.setProperty(hash, name, value);
7126        }
7127
7128      }
7129
7130      @Override
7131      public void setProperty(String name, Base value) throws FHIRException {
7132        if (name.equals("category"))
7133          this.category = castToCoding(value); // Coding
7134        else if (name.equals("reason"))
7135          this.reason = castToCoding(value); // Coding
7136        else if (name.equals("amount"))
7137          this.amount = castToMoney(value); // Money
7138        else if (name.equals("value"))
7139          this.value = castToDecimal(value); // DecimalType
7140        else
7141          super.setProperty(name, value);
7142      }
7143
7144      @Override
7145      public Base makeProperty(int hash, String name) throws FHIRException {
7146        switch (hash) {
7147        case 50511102:  return getCategory(); // Coding
7148        case -934964668:  return getReason(); // Coding
7149        case -1413853096:  return getAmount(); // Money
7150        case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // DecimalType
7151        default: return super.makeProperty(hash, name);
7152        }
7153
7154      }
7155
7156      @Override
7157      public Base addChild(String name) throws FHIRException {
7158        if (name.equals("category")) {
7159          this.category = new Coding();
7160          return this.category;
7161        }
7162        else if (name.equals("reason")) {
7163          this.reason = new Coding();
7164          return this.reason;
7165        }
7166        else if (name.equals("amount")) {
7167          this.amount = new Money();
7168          return this.amount;
7169        }
7170        else if (name.equals("value")) {
7171          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
7172        }
7173        else
7174          return super.addChild(name);
7175      }
7176
7177      public AddedItemDetailAdjudicationComponent copy() {
7178        AddedItemDetailAdjudicationComponent dst = new AddedItemDetailAdjudicationComponent();
7179        copyValues(dst);
7180        dst.category = category == null ? null : category.copy();
7181        dst.reason = reason == null ? null : reason.copy();
7182        dst.amount = amount == null ? null : amount.copy();
7183        dst.value = value == null ? null : value.copy();
7184        return dst;
7185      }
7186
7187      @Override
7188      public boolean equalsDeep(Base other) {
7189        if (!super.equalsDeep(other))
7190          return false;
7191        if (!(other instanceof AddedItemDetailAdjudicationComponent))
7192          return false;
7193        AddedItemDetailAdjudicationComponent o = (AddedItemDetailAdjudicationComponent) other;
7194        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
7195           && compareDeep(value, o.value, true);
7196      }
7197
7198      @Override
7199      public boolean equalsShallow(Base other) {
7200        if (!super.equalsShallow(other))
7201          return false;
7202        if (!(other instanceof AddedItemDetailAdjudicationComponent))
7203          return false;
7204        AddedItemDetailAdjudicationComponent o = (AddedItemDetailAdjudicationComponent) other;
7205        return compareValues(value, o.value, true);
7206      }
7207
7208      public boolean isEmpty() {
7209        return super.isEmpty() && (category == null || category.isEmpty()) && (reason == null || reason.isEmpty())
7210           && (amount == null || amount.isEmpty()) && (value == null || value.isEmpty());
7211      }
7212
7213  public String fhirType() {
7214    return "ExplanationOfBenefit.addItem.detail.adjudication";
7215
7216  }
7217
7218  }
7219
7220    @Block()
7221    public static class MissingTeethComponent extends BackboneElement implements IBaseBackboneElement {
7222        /**
7223         * The code identifying which tooth is missing.
7224         */
7225        @Child(name = "tooth", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
7226        @Description(shortDefinition="Tooth Code", formalDefinition="The code identifying which tooth is missing." )
7227        protected Coding tooth;
7228
7229        /**
7230         * Missing reason may be: E-extraction, O-other.
7231         */
7232        @Child(name = "reason", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
7233        @Description(shortDefinition="Reason for missing", formalDefinition="Missing reason may be: E-extraction, O-other." )
7234        protected Coding reason;
7235
7236        /**
7237         * The date of the extraction either known from records or patient reported estimate.
7238         */
7239        @Child(name = "extractionDate", type = {DateType.class}, order=3, min=0, max=1, modifier=false, summary=true)
7240        @Description(shortDefinition="Date of Extraction", formalDefinition="The date of the extraction either known from records or patient reported estimate." )
7241        protected DateType extractionDate;
7242
7243        private static final long serialVersionUID = 352913313L;
7244
7245    /**
7246     * Constructor
7247     */
7248      public MissingTeethComponent() {
7249        super();
7250      }
7251
7252    /**
7253     * Constructor
7254     */
7255      public MissingTeethComponent(Coding tooth) {
7256        super();
7257        this.tooth = tooth;
7258      }
7259
7260        /**
7261         * @return {@link #tooth} (The code identifying which tooth is missing.)
7262         */
7263        public Coding getTooth() { 
7264          if (this.tooth == null)
7265            if (Configuration.errorOnAutoCreate())
7266              throw new Error("Attempt to auto-create MissingTeethComponent.tooth");
7267            else if (Configuration.doAutoCreate())
7268              this.tooth = new Coding(); // cc
7269          return this.tooth;
7270        }
7271
7272        public boolean hasTooth() { 
7273          return this.tooth != null && !this.tooth.isEmpty();
7274        }
7275
7276        /**
7277         * @param value {@link #tooth} (The code identifying which tooth is missing.)
7278         */
7279        public MissingTeethComponent setTooth(Coding value) { 
7280          this.tooth = value;
7281          return this;
7282        }
7283
7284        /**
7285         * @return {@link #reason} (Missing reason may be: E-extraction, O-other.)
7286         */
7287        public Coding getReason() { 
7288          if (this.reason == null)
7289            if (Configuration.errorOnAutoCreate())
7290              throw new Error("Attempt to auto-create MissingTeethComponent.reason");
7291            else if (Configuration.doAutoCreate())
7292              this.reason = new Coding(); // cc
7293          return this.reason;
7294        }
7295
7296        public boolean hasReason() { 
7297          return this.reason != null && !this.reason.isEmpty();
7298        }
7299
7300        /**
7301         * @param value {@link #reason} (Missing reason may be: E-extraction, O-other.)
7302         */
7303        public MissingTeethComponent setReason(Coding value) { 
7304          this.reason = value;
7305          return this;
7306        }
7307
7308        /**
7309         * @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
7310         */
7311        public DateType getExtractionDateElement() { 
7312          if (this.extractionDate == null)
7313            if (Configuration.errorOnAutoCreate())
7314              throw new Error("Attempt to auto-create MissingTeethComponent.extractionDate");
7315            else if (Configuration.doAutoCreate())
7316              this.extractionDate = new DateType(); // bb
7317          return this.extractionDate;
7318        }
7319
7320        public boolean hasExtractionDateElement() { 
7321          return this.extractionDate != null && !this.extractionDate.isEmpty();
7322        }
7323
7324        public boolean hasExtractionDate() { 
7325          return this.extractionDate != null && !this.extractionDate.isEmpty();
7326        }
7327
7328        /**
7329         * @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
7330         */
7331        public MissingTeethComponent setExtractionDateElement(DateType value) { 
7332          this.extractionDate = value;
7333          return this;
7334        }
7335
7336        /**
7337         * @return The date of the extraction either known from records or patient reported estimate.
7338         */
7339        public Date getExtractionDate() { 
7340          return this.extractionDate == null ? null : this.extractionDate.getValue();
7341        }
7342
7343        /**
7344         * @param value The date of the extraction either known from records or patient reported estimate.
7345         */
7346        public MissingTeethComponent setExtractionDate(Date value) { 
7347          if (value == null)
7348            this.extractionDate = null;
7349          else {
7350            if (this.extractionDate == null)
7351              this.extractionDate = new DateType();
7352            this.extractionDate.setValue(value);
7353          }
7354          return this;
7355        }
7356
7357        protected void listChildren(List<Property> childrenList) {
7358          super.listChildren(childrenList);
7359          childrenList.add(new Property("tooth", "Coding", "The code identifying which tooth is missing.", 0, java.lang.Integer.MAX_VALUE, tooth));
7360          childrenList.add(new Property("reason", "Coding", "Missing reason may be: E-extraction, O-other.", 0, java.lang.Integer.MAX_VALUE, reason));
7361          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));
7362        }
7363
7364      @Override
7365      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7366        switch (hash) {
7367        case 110545608: /*tooth*/ return this.tooth == null ? new Base[0] : new Base[] {this.tooth}; // Coding
7368        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
7369        case 580646965: /*extractionDate*/ return this.extractionDate == null ? new Base[0] : new Base[] {this.extractionDate}; // DateType
7370        default: return super.getProperty(hash, name, checkValid);
7371        }
7372
7373      }
7374
7375      @Override
7376      public void setProperty(int hash, String name, Base value) throws FHIRException {
7377        switch (hash) {
7378        case 110545608: // tooth
7379          this.tooth = castToCoding(value); // Coding
7380          break;
7381        case -934964668: // reason
7382          this.reason = castToCoding(value); // Coding
7383          break;
7384        case 580646965: // extractionDate
7385          this.extractionDate = castToDate(value); // DateType
7386          break;
7387        default: super.setProperty(hash, name, value);
7388        }
7389
7390      }
7391
7392      @Override
7393      public void setProperty(String name, Base value) throws FHIRException {
7394        if (name.equals("tooth"))
7395          this.tooth = castToCoding(value); // Coding
7396        else if (name.equals("reason"))
7397          this.reason = castToCoding(value); // Coding
7398        else if (name.equals("extractionDate"))
7399          this.extractionDate = castToDate(value); // DateType
7400        else
7401          super.setProperty(name, value);
7402      }
7403
7404      @Override
7405      public Base makeProperty(int hash, String name) throws FHIRException {
7406        switch (hash) {
7407        case 110545608:  return getTooth(); // Coding
7408        case -934964668:  return getReason(); // Coding
7409        case 580646965: throw new FHIRException("Cannot make property extractionDate as it is not a complex type"); // DateType
7410        default: return super.makeProperty(hash, name);
7411        }
7412
7413      }
7414
7415      @Override
7416      public Base addChild(String name) throws FHIRException {
7417        if (name.equals("tooth")) {
7418          this.tooth = new Coding();
7419          return this.tooth;
7420        }
7421        else if (name.equals("reason")) {
7422          this.reason = new Coding();
7423          return this.reason;
7424        }
7425        else if (name.equals("extractionDate")) {
7426          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.extractionDate");
7427        }
7428        else
7429          return super.addChild(name);
7430      }
7431
7432      public MissingTeethComponent copy() {
7433        MissingTeethComponent dst = new MissingTeethComponent();
7434        copyValues(dst);
7435        dst.tooth = tooth == null ? null : tooth.copy();
7436        dst.reason = reason == null ? null : reason.copy();
7437        dst.extractionDate = extractionDate == null ? null : extractionDate.copy();
7438        return dst;
7439      }
7440
7441      @Override
7442      public boolean equalsDeep(Base other) {
7443        if (!super.equalsDeep(other))
7444          return false;
7445        if (!(other instanceof MissingTeethComponent))
7446          return false;
7447        MissingTeethComponent o = (MissingTeethComponent) other;
7448        return compareDeep(tooth, o.tooth, true) && compareDeep(reason, o.reason, true) && compareDeep(extractionDate, o.extractionDate, true)
7449          ;
7450      }
7451
7452      @Override
7453      public boolean equalsShallow(Base other) {
7454        if (!super.equalsShallow(other))
7455          return false;
7456        if (!(other instanceof MissingTeethComponent))
7457          return false;
7458        MissingTeethComponent o = (MissingTeethComponent) other;
7459        return compareValues(extractionDate, o.extractionDate, true);
7460      }
7461
7462      public boolean isEmpty() {
7463        return super.isEmpty() && (tooth == null || tooth.isEmpty()) && (reason == null || reason.isEmpty())
7464           && (extractionDate == null || extractionDate.isEmpty());
7465      }
7466
7467  public String fhirType() {
7468    return "ExplanationOfBenefit.missingTeeth";
7469
7470  }
7471
7472  }
7473
7474    @Block()
7475    public static class NotesComponent extends BackboneElement implements IBaseBackboneElement {
7476        /**
7477         * An integer associated with each note which may be referred to from each service line item.
7478         */
7479        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=true)
7480        @Description(shortDefinition="Note Number for this note", formalDefinition="An integer associated with each note which may be referred to from each service line item." )
7481        protected PositiveIntType number;
7482
7483        /**
7484         * The note purpose: Print/Display.
7485         */
7486        @Child(name = "type", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
7487        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
7488        protected Coding type;
7489
7490        /**
7491         * The note text.
7492         */
7493        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
7494        @Description(shortDefinition="Note explanitory text", formalDefinition="The note text." )
7495        protected StringType text;
7496
7497        private static final long serialVersionUID = 1768923951L;
7498
7499    /**
7500     * Constructor
7501     */
7502      public NotesComponent() {
7503        super();
7504      }
7505
7506        /**
7507         * @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
7508         */
7509        public PositiveIntType getNumberElement() { 
7510          if (this.number == null)
7511            if (Configuration.errorOnAutoCreate())
7512              throw new Error("Attempt to auto-create NotesComponent.number");
7513            else if (Configuration.doAutoCreate())
7514              this.number = new PositiveIntType(); // bb
7515          return this.number;
7516        }
7517
7518        public boolean hasNumberElement() { 
7519          return this.number != null && !this.number.isEmpty();
7520        }
7521
7522        public boolean hasNumber() { 
7523          return this.number != null && !this.number.isEmpty();
7524        }
7525
7526        /**
7527         * @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
7528         */
7529        public NotesComponent setNumberElement(PositiveIntType value) { 
7530          this.number = value;
7531          return this;
7532        }
7533
7534        /**
7535         * @return An integer associated with each note which may be referred to from each service line item.
7536         */
7537        public int getNumber() { 
7538          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
7539        }
7540
7541        /**
7542         * @param value An integer associated with each note which may be referred to from each service line item.
7543         */
7544        public NotesComponent setNumber(int value) { 
7545            if (this.number == null)
7546              this.number = new PositiveIntType();
7547            this.number.setValue(value);
7548          return this;
7549        }
7550
7551        /**
7552         * @return {@link #type} (The note purpose: Print/Display.)
7553         */
7554        public Coding getType() { 
7555          if (this.type == null)
7556            if (Configuration.errorOnAutoCreate())
7557              throw new Error("Attempt to auto-create NotesComponent.type");
7558            else if (Configuration.doAutoCreate())
7559              this.type = new Coding(); // cc
7560          return this.type;
7561        }
7562
7563        public boolean hasType() { 
7564          return this.type != null && !this.type.isEmpty();
7565        }
7566
7567        /**
7568         * @param value {@link #type} (The note purpose: Print/Display.)
7569         */
7570        public NotesComponent setType(Coding value) { 
7571          this.type = value;
7572          return this;
7573        }
7574
7575        /**
7576         * @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
7577         */
7578        public StringType getTextElement() { 
7579          if (this.text == null)
7580            if (Configuration.errorOnAutoCreate())
7581              throw new Error("Attempt to auto-create NotesComponent.text");
7582            else if (Configuration.doAutoCreate())
7583              this.text = new StringType(); // bb
7584          return this.text;
7585        }
7586
7587        public boolean hasTextElement() { 
7588          return this.text != null && !this.text.isEmpty();
7589        }
7590
7591        public boolean hasText() { 
7592          return this.text != null && !this.text.isEmpty();
7593        }
7594
7595        /**
7596         * @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
7597         */
7598        public NotesComponent setTextElement(StringType value) { 
7599          this.text = value;
7600          return this;
7601        }
7602
7603        /**
7604         * @return The note text.
7605         */
7606        public String getText() { 
7607          return this.text == null ? null : this.text.getValue();
7608        }
7609
7610        /**
7611         * @param value The note text.
7612         */
7613        public NotesComponent setText(String value) { 
7614          if (Utilities.noString(value))
7615            this.text = null;
7616          else {
7617            if (this.text == null)
7618              this.text = new StringType();
7619            this.text.setValue(value);
7620          }
7621          return this;
7622        }
7623
7624        protected void listChildren(List<Property> childrenList) {
7625          super.listChildren(childrenList);
7626          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));
7627          childrenList.add(new Property("type", "Coding", "The note purpose: Print/Display.", 0, java.lang.Integer.MAX_VALUE, type));
7628          childrenList.add(new Property("text", "string", "The note text.", 0, java.lang.Integer.MAX_VALUE, text));
7629        }
7630
7631      @Override
7632      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7633        switch (hash) {
7634        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
7635        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
7636        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
7637        default: return super.getProperty(hash, name, checkValid);
7638        }
7639
7640      }
7641
7642      @Override
7643      public void setProperty(int hash, String name, Base value) throws FHIRException {
7644        switch (hash) {
7645        case -1034364087: // number
7646          this.number = castToPositiveInt(value); // PositiveIntType
7647          break;
7648        case 3575610: // type
7649          this.type = castToCoding(value); // Coding
7650          break;
7651        case 3556653: // text
7652          this.text = castToString(value); // StringType
7653          break;
7654        default: super.setProperty(hash, name, value);
7655        }
7656
7657      }
7658
7659      @Override
7660      public void setProperty(String name, Base value) throws FHIRException {
7661        if (name.equals("number"))
7662          this.number = castToPositiveInt(value); // PositiveIntType
7663        else if (name.equals("type"))
7664          this.type = castToCoding(value); // Coding
7665        else if (name.equals("text"))
7666          this.text = castToString(value); // StringType
7667        else
7668          super.setProperty(name, value);
7669      }
7670
7671      @Override
7672      public Base makeProperty(int hash, String name) throws FHIRException {
7673        switch (hash) {
7674        case -1034364087: throw new FHIRException("Cannot make property number as it is not a complex type"); // PositiveIntType
7675        case 3575610:  return getType(); // Coding
7676        case 3556653: throw new FHIRException("Cannot make property text as it is not a complex type"); // StringType
7677        default: return super.makeProperty(hash, name);
7678        }
7679
7680      }
7681
7682      @Override
7683      public Base addChild(String name) throws FHIRException {
7684        if (name.equals("number")) {
7685          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
7686        }
7687        else if (name.equals("type")) {
7688          this.type = new Coding();
7689          return this.type;
7690        }
7691        else if (name.equals("text")) {
7692          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
7693        }
7694        else
7695          return super.addChild(name);
7696      }
7697
7698      public NotesComponent copy() {
7699        NotesComponent dst = new NotesComponent();
7700        copyValues(dst);
7701        dst.number = number == null ? null : number.copy();
7702        dst.type = type == null ? null : type.copy();
7703        dst.text = text == null ? null : text.copy();
7704        return dst;
7705      }
7706
7707      @Override
7708      public boolean equalsDeep(Base other) {
7709        if (!super.equalsDeep(other))
7710          return false;
7711        if (!(other instanceof NotesComponent))
7712          return false;
7713        NotesComponent o = (NotesComponent) other;
7714        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
7715          ;
7716      }
7717
7718      @Override
7719      public boolean equalsShallow(Base other) {
7720        if (!super.equalsShallow(other))
7721          return false;
7722        if (!(other instanceof NotesComponent))
7723          return false;
7724        NotesComponent o = (NotesComponent) other;
7725        return compareValues(number, o.number, true) && compareValues(text, o.text, true);
7726      }
7727
7728      public boolean isEmpty() {
7729        return super.isEmpty() && (number == null || number.isEmpty()) && (type == null || type.isEmpty())
7730           && (text == null || text.isEmpty());
7731      }
7732
7733  public String fhirType() {
7734    return "ExplanationOfBenefit.note";
7735
7736  }
7737
7738  }
7739
7740    @Block()
7741    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
7742        /**
7743         * Dental, Vision, Medical, Pharmacy, Rehab etc.
7744         */
7745        @Child(name = "category", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
7746        @Description(shortDefinition="Benefit Category", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
7747        protected Coding category;
7748
7749        /**
7750         * Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.
7751         */
7752        @Child(name = "subCategory", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
7753        @Description(shortDefinition="Benefit SubCategory", formalDefinition="Dental: basic, major, ortho; Vision exam, glasses, contacts; etc." )
7754        protected Coding subCategory;
7755
7756        /**
7757         * Network designation.
7758         */
7759        @Child(name = "network", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
7760        @Description(shortDefinition="In or out of network", formalDefinition="Network designation." )
7761        protected Coding network;
7762
7763        /**
7764         * Unit designation: individual or family.
7765         */
7766        @Child(name = "unit", type = {Coding.class}, order=4, min=0, max=1, modifier=false, summary=true)
7767        @Description(shortDefinition="Individual or family", formalDefinition="Unit designation: individual or family." )
7768        protected Coding unit;
7769
7770        /**
7771         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.
7772         */
7773        @Child(name = "term", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
7774        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'." )
7775        protected Coding term;
7776
7777        /**
7778         * Benefits Used to date.
7779         */
7780        @Child(name = "financial", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
7781        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
7782        protected List<BenefitComponent> financial;
7783
7784        private static final long serialVersionUID = 1708176773L;
7785
7786    /**
7787     * Constructor
7788     */
7789      public BenefitBalanceComponent() {
7790        super();
7791      }
7792
7793    /**
7794     * Constructor
7795     */
7796      public BenefitBalanceComponent(Coding category) {
7797        super();
7798        this.category = category;
7799      }
7800
7801        /**
7802         * @return {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
7803         */
7804        public Coding getCategory() { 
7805          if (this.category == null)
7806            if (Configuration.errorOnAutoCreate())
7807              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
7808            else if (Configuration.doAutoCreate())
7809              this.category = new Coding(); // cc
7810          return this.category;
7811        }
7812
7813        public boolean hasCategory() { 
7814          return this.category != null && !this.category.isEmpty();
7815        }
7816
7817        /**
7818         * @param value {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
7819         */
7820        public BenefitBalanceComponent setCategory(Coding value) { 
7821          this.category = value;
7822          return this;
7823        }
7824
7825        /**
7826         * @return {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
7827         */
7828        public Coding getSubCategory() { 
7829          if (this.subCategory == null)
7830            if (Configuration.errorOnAutoCreate())
7831              throw new Error("Attempt to auto-create BenefitBalanceComponent.subCategory");
7832            else if (Configuration.doAutoCreate())
7833              this.subCategory = new Coding(); // cc
7834          return this.subCategory;
7835        }
7836
7837        public boolean hasSubCategory() { 
7838          return this.subCategory != null && !this.subCategory.isEmpty();
7839        }
7840
7841        /**
7842         * @param value {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
7843         */
7844        public BenefitBalanceComponent setSubCategory(Coding value) { 
7845          this.subCategory = value;
7846          return this;
7847        }
7848
7849        /**
7850         * @return {@link #network} (Network designation.)
7851         */
7852        public Coding getNetwork() { 
7853          if (this.network == null)
7854            if (Configuration.errorOnAutoCreate())
7855              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
7856            else if (Configuration.doAutoCreate())
7857              this.network = new Coding(); // cc
7858          return this.network;
7859        }
7860
7861        public boolean hasNetwork() { 
7862          return this.network != null && !this.network.isEmpty();
7863        }
7864
7865        /**
7866         * @param value {@link #network} (Network designation.)
7867         */
7868        public BenefitBalanceComponent setNetwork(Coding value) { 
7869          this.network = value;
7870          return this;
7871        }
7872
7873        /**
7874         * @return {@link #unit} (Unit designation: individual or family.)
7875         */
7876        public Coding getUnit() { 
7877          if (this.unit == null)
7878            if (Configuration.errorOnAutoCreate())
7879              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
7880            else if (Configuration.doAutoCreate())
7881              this.unit = new Coding(); // cc
7882          return this.unit;
7883        }
7884
7885        public boolean hasUnit() { 
7886          return this.unit != null && !this.unit.isEmpty();
7887        }
7888
7889        /**
7890         * @param value {@link #unit} (Unit designation: individual or family.)
7891         */
7892        public BenefitBalanceComponent setUnit(Coding value) { 
7893          this.unit = value;
7894          return this;
7895        }
7896
7897        /**
7898         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
7899         */
7900        public Coding getTerm() { 
7901          if (this.term == null)
7902            if (Configuration.errorOnAutoCreate())
7903              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
7904            else if (Configuration.doAutoCreate())
7905              this.term = new Coding(); // cc
7906          return this.term;
7907        }
7908
7909        public boolean hasTerm() { 
7910          return this.term != null && !this.term.isEmpty();
7911        }
7912
7913        /**
7914         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
7915         */
7916        public BenefitBalanceComponent setTerm(Coding value) { 
7917          this.term = value;
7918          return this;
7919        }
7920
7921        /**
7922         * @return {@link #financial} (Benefits Used to date.)
7923         */
7924        public List<BenefitComponent> getFinancial() { 
7925          if (this.financial == null)
7926            this.financial = new ArrayList<BenefitComponent>();
7927          return this.financial;
7928        }
7929
7930        public boolean hasFinancial() { 
7931          if (this.financial == null)
7932            return false;
7933          for (BenefitComponent item : this.financial)
7934            if (!item.isEmpty())
7935              return true;
7936          return false;
7937        }
7938
7939        /**
7940         * @return {@link #financial} (Benefits Used to date.)
7941         */
7942    // syntactic sugar
7943        public BenefitComponent addFinancial() { //3
7944          BenefitComponent t = new BenefitComponent();
7945          if (this.financial == null)
7946            this.financial = new ArrayList<BenefitComponent>();
7947          this.financial.add(t);
7948          return t;
7949        }
7950
7951    // syntactic sugar
7952        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
7953          if (t == null)
7954            return this;
7955          if (this.financial == null)
7956            this.financial = new ArrayList<BenefitComponent>();
7957          this.financial.add(t);
7958          return this;
7959        }
7960
7961        protected void listChildren(List<Property> childrenList) {
7962          super.listChildren(childrenList);
7963          childrenList.add(new Property("category", "Coding", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, java.lang.Integer.MAX_VALUE, category));
7964          childrenList.add(new Property("subCategory", "Coding", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, java.lang.Integer.MAX_VALUE, subCategory));
7965          childrenList.add(new Property("network", "Coding", "Network designation.", 0, java.lang.Integer.MAX_VALUE, network));
7966          childrenList.add(new Property("unit", "Coding", "Unit designation: individual or family.", 0, java.lang.Integer.MAX_VALUE, unit));
7967          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));
7968          childrenList.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
7969        }
7970
7971      @Override
7972      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7973        switch (hash) {
7974        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Coding
7975        case 1365024606: /*subCategory*/ return this.subCategory == null ? new Base[0] : new Base[] {this.subCategory}; // Coding
7976        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // Coding
7977        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // Coding
7978        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // Coding
7979        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
7980        default: return super.getProperty(hash, name, checkValid);
7981        }
7982
7983      }
7984
7985      @Override
7986      public void setProperty(int hash, String name, Base value) throws FHIRException {
7987        switch (hash) {
7988        case 50511102: // category
7989          this.category = castToCoding(value); // Coding
7990          break;
7991        case 1365024606: // subCategory
7992          this.subCategory = castToCoding(value); // Coding
7993          break;
7994        case 1843485230: // network
7995          this.network = castToCoding(value); // Coding
7996          break;
7997        case 3594628: // unit
7998          this.unit = castToCoding(value); // Coding
7999          break;
8000        case 3556460: // term
8001          this.term = castToCoding(value); // Coding
8002          break;
8003        case 357555337: // financial
8004          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
8005          break;
8006        default: super.setProperty(hash, name, value);
8007        }
8008
8009      }
8010
8011      @Override
8012      public void setProperty(String name, Base value) throws FHIRException {
8013        if (name.equals("category"))
8014          this.category = castToCoding(value); // Coding
8015        else if (name.equals("subCategory"))
8016          this.subCategory = castToCoding(value); // Coding
8017        else if (name.equals("network"))
8018          this.network = castToCoding(value); // Coding
8019        else if (name.equals("unit"))
8020          this.unit = castToCoding(value); // Coding
8021        else if (name.equals("term"))
8022          this.term = castToCoding(value); // Coding
8023        else if (name.equals("financial"))
8024          this.getFinancial().add((BenefitComponent) value);
8025        else
8026          super.setProperty(name, value);
8027      }
8028
8029      @Override
8030      public Base makeProperty(int hash, String name) throws FHIRException {
8031        switch (hash) {
8032        case 50511102:  return getCategory(); // Coding
8033        case 1365024606:  return getSubCategory(); // Coding
8034        case 1843485230:  return getNetwork(); // Coding
8035        case 3594628:  return getUnit(); // Coding
8036        case 3556460:  return getTerm(); // Coding
8037        case 357555337:  return addFinancial(); // BenefitComponent
8038        default: return super.makeProperty(hash, name);
8039        }
8040
8041      }
8042
8043      @Override
8044      public Base addChild(String name) throws FHIRException {
8045        if (name.equals("category")) {
8046          this.category = new Coding();
8047          return this.category;
8048        }
8049        else if (name.equals("subCategory")) {
8050          this.subCategory = new Coding();
8051          return this.subCategory;
8052        }
8053        else if (name.equals("network")) {
8054          this.network = new Coding();
8055          return this.network;
8056        }
8057        else if (name.equals("unit")) {
8058          this.unit = new Coding();
8059          return this.unit;
8060        }
8061        else if (name.equals("term")) {
8062          this.term = new Coding();
8063          return this.term;
8064        }
8065        else if (name.equals("financial")) {
8066          return addFinancial();
8067        }
8068        else
8069          return super.addChild(name);
8070      }
8071
8072      public BenefitBalanceComponent copy() {
8073        BenefitBalanceComponent dst = new BenefitBalanceComponent();
8074        copyValues(dst);
8075        dst.category = category == null ? null : category.copy();
8076        dst.subCategory = subCategory == null ? null : subCategory.copy();
8077        dst.network = network == null ? null : network.copy();
8078        dst.unit = unit == null ? null : unit.copy();
8079        dst.term = term == null ? null : term.copy();
8080        if (financial != null) {
8081          dst.financial = new ArrayList<BenefitComponent>();
8082          for (BenefitComponent i : financial)
8083            dst.financial.add(i.copy());
8084        };
8085        return dst;
8086      }
8087
8088      @Override
8089      public boolean equalsDeep(Base other) {
8090        if (!super.equalsDeep(other))
8091          return false;
8092        if (!(other instanceof BenefitBalanceComponent))
8093          return false;
8094        BenefitBalanceComponent o = (BenefitBalanceComponent) other;
8095        return compareDeep(category, o.category, true) && compareDeep(subCategory, o.subCategory, true)
8096           && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
8097           && compareDeep(financial, o.financial, true);
8098      }
8099
8100      @Override
8101      public boolean equalsShallow(Base other) {
8102        if (!super.equalsShallow(other))
8103          return false;
8104        if (!(other instanceof BenefitBalanceComponent))
8105          return false;
8106        BenefitBalanceComponent o = (BenefitBalanceComponent) other;
8107        return true;
8108      }
8109
8110      public boolean isEmpty() {
8111        return super.isEmpty() && (category == null || category.isEmpty()) && (subCategory == null || subCategory.isEmpty())
8112           && (network == null || network.isEmpty()) && (unit == null || unit.isEmpty()) && (term == null || term.isEmpty())
8113           && (financial == null || financial.isEmpty());
8114      }
8115
8116  public String fhirType() {
8117    return "ExplanationOfBenefit.benefitBalance";
8118
8119  }
8120
8121  }
8122
8123    @Block()
8124    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
8125        /**
8126         * Deductable, visits, benefit amount.
8127         */
8128        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
8129        @Description(shortDefinition="Deductable, visits, benefit amount", formalDefinition="Deductable, visits, benefit amount." )
8130        protected Coding type;
8131
8132        /**
8133         * Benefits allowed.
8134         */
8135        @Child(name = "benefit", type = {UnsignedIntType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=true)
8136        @Description(shortDefinition="Benefits allowed", formalDefinition="Benefits allowed." )
8137        protected Type benefit;
8138
8139        /**
8140         * Benefits used.
8141         */
8142        @Child(name = "benefitUsed", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
8143        @Description(shortDefinition="Benefits used", formalDefinition="Benefits used." )
8144        protected Type benefitUsed;
8145
8146        private static final long serialVersionUID = 1742418909L;
8147
8148    /**
8149     * Constructor
8150     */
8151      public BenefitComponent() {
8152        super();
8153      }
8154
8155    /**
8156     * Constructor
8157     */
8158      public BenefitComponent(Coding type) {
8159        super();
8160        this.type = type;
8161      }
8162
8163        /**
8164         * @return {@link #type} (Deductable, visits, benefit amount.)
8165         */
8166        public Coding getType() { 
8167          if (this.type == null)
8168            if (Configuration.errorOnAutoCreate())
8169              throw new Error("Attempt to auto-create BenefitComponent.type");
8170            else if (Configuration.doAutoCreate())
8171              this.type = new Coding(); // cc
8172          return this.type;
8173        }
8174
8175        public boolean hasType() { 
8176          return this.type != null && !this.type.isEmpty();
8177        }
8178
8179        /**
8180         * @param value {@link #type} (Deductable, visits, benefit amount.)
8181         */
8182        public BenefitComponent setType(Coding value) { 
8183          this.type = value;
8184          return this;
8185        }
8186
8187        /**
8188         * @return {@link #benefit} (Benefits allowed.)
8189         */
8190        public Type getBenefit() { 
8191          return this.benefit;
8192        }
8193
8194        /**
8195         * @return {@link #benefit} (Benefits allowed.)
8196         */
8197        public UnsignedIntType getBenefitUnsignedIntType() throws FHIRException { 
8198          if (!(this.benefit instanceof UnsignedIntType))
8199            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.benefit.getClass().getName()+" was encountered");
8200          return (UnsignedIntType) this.benefit;
8201        }
8202
8203        public boolean hasBenefitUnsignedIntType() { 
8204          return this.benefit instanceof UnsignedIntType;
8205        }
8206
8207        /**
8208         * @return {@link #benefit} (Benefits allowed.)
8209         */
8210        public Money getBenefitMoney() throws FHIRException { 
8211          if (!(this.benefit instanceof Money))
8212            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.benefit.getClass().getName()+" was encountered");
8213          return (Money) this.benefit;
8214        }
8215
8216        public boolean hasBenefitMoney() { 
8217          return this.benefit instanceof Money;
8218        }
8219
8220        public boolean hasBenefit() { 
8221          return this.benefit != null && !this.benefit.isEmpty();
8222        }
8223
8224        /**
8225         * @param value {@link #benefit} (Benefits allowed.)
8226         */
8227        public BenefitComponent setBenefit(Type value) { 
8228          this.benefit = value;
8229          return this;
8230        }
8231
8232        /**
8233         * @return {@link #benefitUsed} (Benefits used.)
8234         */
8235        public Type getBenefitUsed() { 
8236          return this.benefitUsed;
8237        }
8238
8239        /**
8240         * @return {@link #benefitUsed} (Benefits used.)
8241         */
8242        public UnsignedIntType getBenefitUsedUnsignedIntType() throws FHIRException { 
8243          if (!(this.benefitUsed instanceof UnsignedIntType))
8244            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.benefitUsed.getClass().getName()+" was encountered");
8245          return (UnsignedIntType) this.benefitUsed;
8246        }
8247
8248        public boolean hasBenefitUsedUnsignedIntType() { 
8249          return this.benefitUsed instanceof UnsignedIntType;
8250        }
8251
8252        /**
8253         * @return {@link #benefitUsed} (Benefits used.)
8254         */
8255        public Money getBenefitUsedMoney() throws FHIRException { 
8256          if (!(this.benefitUsed instanceof Money))
8257            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.benefitUsed.getClass().getName()+" was encountered");
8258          return (Money) this.benefitUsed;
8259        }
8260
8261        public boolean hasBenefitUsedMoney() { 
8262          return this.benefitUsed instanceof Money;
8263        }
8264
8265        public boolean hasBenefitUsed() { 
8266          return this.benefitUsed != null && !this.benefitUsed.isEmpty();
8267        }
8268
8269        /**
8270         * @param value {@link #benefitUsed} (Benefits used.)
8271         */
8272        public BenefitComponent setBenefitUsed(Type value) { 
8273          this.benefitUsed = value;
8274          return this;
8275        }
8276
8277        protected void listChildren(List<Property> childrenList) {
8278          super.listChildren(childrenList);
8279          childrenList.add(new Property("type", "Coding", "Deductable, visits, benefit amount.", 0, java.lang.Integer.MAX_VALUE, type));
8280          childrenList.add(new Property("benefit[x]", "unsignedInt|Money", "Benefits allowed.", 0, java.lang.Integer.MAX_VALUE, benefit));
8281          childrenList.add(new Property("benefitUsed[x]", "unsignedInt|Money", "Benefits used.", 0, java.lang.Integer.MAX_VALUE, benefitUsed));
8282        }
8283
8284      @Override
8285      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8286        switch (hash) {
8287        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
8288        case -222710633: /*benefit*/ return this.benefit == null ? new Base[0] : new Base[] {this.benefit}; // Type
8289        case -549981964: /*benefitUsed*/ return this.benefitUsed == null ? new Base[0] : new Base[] {this.benefitUsed}; // Type
8290        default: return super.getProperty(hash, name, checkValid);
8291        }
8292
8293      }
8294
8295      @Override
8296      public void setProperty(int hash, String name, Base value) throws FHIRException {
8297        switch (hash) {
8298        case 3575610: // type
8299          this.type = castToCoding(value); // Coding
8300          break;
8301        case -222710633: // benefit
8302          this.benefit = (Type) value; // Type
8303          break;
8304        case -549981964: // benefitUsed
8305          this.benefitUsed = (Type) value; // Type
8306          break;
8307        default: super.setProperty(hash, name, value);
8308        }
8309
8310      }
8311
8312      @Override
8313      public void setProperty(String name, Base value) throws FHIRException {
8314        if (name.equals("type"))
8315          this.type = castToCoding(value); // Coding
8316        else if (name.equals("benefit[x]"))
8317          this.benefit = (Type) value; // Type
8318        else if (name.equals("benefitUsed[x]"))
8319          this.benefitUsed = (Type) value; // Type
8320        else
8321          super.setProperty(name, value);
8322      }
8323
8324      @Override
8325      public Base makeProperty(int hash, String name) throws FHIRException {
8326        switch (hash) {
8327        case 3575610:  return getType(); // Coding
8328        case 952095881:  return getBenefit(); // Type
8329        case 787635980:  return getBenefitUsed(); // Type
8330        default: return super.makeProperty(hash, name);
8331        }
8332
8333      }
8334
8335      @Override
8336      public Base addChild(String name) throws FHIRException {
8337        if (name.equals("type")) {
8338          this.type = new Coding();
8339          return this.type;
8340        }
8341        else if (name.equals("benefitUnsignedInt")) {
8342          this.benefit = new UnsignedIntType();
8343          return this.benefit;
8344        }
8345        else if (name.equals("benefitMoney")) {
8346          this.benefit = new Money();
8347          return this.benefit;
8348        }
8349        else if (name.equals("benefitUsedUnsignedInt")) {
8350          this.benefitUsed = new UnsignedIntType();
8351          return this.benefitUsed;
8352        }
8353        else if (name.equals("benefitUsedMoney")) {
8354          this.benefitUsed = new Money();
8355          return this.benefitUsed;
8356        }
8357        else
8358          return super.addChild(name);
8359      }
8360
8361      public BenefitComponent copy() {
8362        BenefitComponent dst = new BenefitComponent();
8363        copyValues(dst);
8364        dst.type = type == null ? null : type.copy();
8365        dst.benefit = benefit == null ? null : benefit.copy();
8366        dst.benefitUsed = benefitUsed == null ? null : benefitUsed.copy();
8367        return dst;
8368      }
8369
8370      @Override
8371      public boolean equalsDeep(Base other) {
8372        if (!super.equalsDeep(other))
8373          return false;
8374        if (!(other instanceof BenefitComponent))
8375          return false;
8376        BenefitComponent o = (BenefitComponent) other;
8377        return compareDeep(type, o.type, true) && compareDeep(benefit, o.benefit, true) && compareDeep(benefitUsed, o.benefitUsed, true)
8378          ;
8379      }
8380
8381      @Override
8382      public boolean equalsShallow(Base other) {
8383        if (!super.equalsShallow(other))
8384          return false;
8385        if (!(other instanceof BenefitComponent))
8386          return false;
8387        BenefitComponent o = (BenefitComponent) other;
8388        return true;
8389      }
8390
8391      public boolean isEmpty() {
8392        return super.isEmpty() && (type == null || type.isEmpty()) && (benefit == null || benefit.isEmpty())
8393           && (benefitUsed == null || benefitUsed.isEmpty());
8394      }
8395
8396  public String fhirType() {
8397    return "ExplanationOfBenefit.benefitBalance.financial";
8398
8399  }
8400
8401  }
8402
8403    /**
8404     * The Response Business Identifier.
8405     */
8406    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8407    @Description(shortDefinition="Business Identifier", formalDefinition="The Response Business Identifier." )
8408    protected List<Identifier> identifier;
8409
8410    /**
8411     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
8412     */
8413    @Child(name = "claim", type = {Identifier.class, Claim.class}, order=1, min=0, max=1, modifier=false, summary=true)
8414    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
8415    protected Type claim;
8416
8417    /**
8418     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
8419     */
8420    @Child(name = "claimResponse", type = {Identifier.class, ClaimResponse.class}, order=2, min=0, max=1, modifier=false, summary=true)
8421    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
8422    protected Type claimResponse;
8423
8424    /**
8425     * 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     */
8427    @Child(name = "subType", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8428    @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." )
8429    protected List<Coding> subType;
8430
8431    /**
8432     * The version of the specification on which this instance relies.
8433     */
8434    @Child(name = "ruleset", type = {Coding.class}, order=4, min=0, max=1, modifier=false, summary=true)
8435    @Description(shortDefinition="Current specification followed", formalDefinition="The version of the specification on which this instance relies." )
8436    protected Coding ruleset;
8437
8438    /**
8439     * The version of the specification from which the original instance was created.
8440     */
8441    @Child(name = "originalRuleset", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
8442    @Description(shortDefinition="Original specification followed", formalDefinition="The version of the specification from which the original instance was created." )
8443    protected Coding originalRuleset;
8444
8445    /**
8446     * The date when the EOB was created.
8447     */
8448    @Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
8449    @Description(shortDefinition="Creation date", formalDefinition="The date when the EOB was created." )
8450    protected DateTimeType created;
8451
8452    /**
8453     * The billable period for which charges are being submitted.
8454     */
8455    @Child(name = "billablePeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
8456    @Description(shortDefinition="Period for charge submission", formalDefinition="The billable period for which charges are being submitted." )
8457    protected Period billablePeriod;
8458
8459    /**
8460     * A description of the status of the adjudication.
8461     */
8462    @Child(name = "disposition", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
8463    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
8464    protected StringType disposition;
8465
8466    /**
8467     * The provider which is responsible for the claim.
8468     */
8469    @Child(name = "provider", type = {Identifier.class, Practitioner.class}, order=9, min=0, max=1, modifier=false, summary=true)
8470    @Description(shortDefinition="Responsible provider for the claim", formalDefinition="The provider which is responsible for the claim." )
8471    protected Type provider;
8472
8473    /**
8474     * The provider which is responsible for the claim.
8475     */
8476    @Child(name = "organization", type = {Identifier.class, Organization.class}, order=10, min=0, max=1, modifier=false, summary=true)
8477    @Description(shortDefinition="Responsible organization for the claim", formalDefinition="The provider which is responsible for the claim." )
8478    protected Type organization;
8479
8480    /**
8481     * Facility where the services were provided.
8482     */
8483    @Child(name = "facility", type = {Identifier.class, Location.class}, order=11, min=0, max=1, modifier=false, summary=true)
8484    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
8485    protected Type facility;
8486
8487    /**
8488     * Other claims which are related to this claim such as prior claim versions or for related services.
8489     */
8490    @Child(name = "related", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8491    @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." )
8492    protected List<RelatedClaimsComponent> related;
8493
8494    /**
8495     * Prescription to support the dispensing of Pharmacy or Vision products.
8496     */
8497    @Child(name = "prescription", type = {Identifier.class, MedicationOrder.class, VisionPrescription.class}, order=13, min=0, max=1, modifier=false, summary=true)
8498    @Description(shortDefinition="Prescription", formalDefinition="Prescription to support the dispensing of Pharmacy or Vision products." )
8499    protected Type prescription;
8500
8501    /**
8502     * Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.
8503     */
8504    @Child(name = "originalPrescription", type = {Identifier.class, MedicationOrder.class}, order=14, min=0, max=1, modifier=false, summary=true)
8505    @Description(shortDefinition="Original Prescription", formalDefinition="Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products." )
8506    protected Type originalPrescription;
8507
8508    /**
8509     * The party to be reimbursed for the services.
8510     */
8511    @Child(name = "payee", type = {}, order=15, min=0, max=1, modifier=false, summary=true)
8512    @Description(shortDefinition="Payee", formalDefinition="The party to be reimbursed for the services." )
8513    protected PayeeComponent payee;
8514
8515    /**
8516     * The referral resource which lists the date, practitioner, reason and other supporting information.
8517     */
8518    @Child(name = "referral", type = {Identifier.class, ReferralRequest.class}, order=16, min=0, max=1, modifier=false, summary=true)
8519    @Description(shortDefinition="Treatment Referral", formalDefinition="The referral resource which lists the date, practitioner, reason and other supporting information." )
8520    protected Type referral;
8521
8522    /**
8523     * **Insert definition of Occurrence codes.
8524     */
8525    @Child(name = "occurrenceCode", type = {Coding.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8526    @Description(shortDefinition="Occurrence Codes", formalDefinition="**Insert definition of Occurrence codes." )
8527    protected List<Coding> occurrenceCode;
8528
8529    /**
8530     * **Insert definition of Occurrence Span codes.
8531     */
8532    @Child(name = "occurenceSpanCode", type = {Coding.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8533    @Description(shortDefinition="Occurrence Span Codes", formalDefinition="**Insert definition of Occurrence Span codes." )
8534    protected List<Coding> occurenceSpanCode;
8535
8536    /**
8537     * **Insert definition of Value codes.
8538     */
8539    @Child(name = "valueCode", type = {Coding.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8540    @Description(shortDefinition="Value Codes", formalDefinition="**Insert definition of Value codes." )
8541    protected List<Coding> valueCode;
8542
8543    /**
8544     * Ordered list of patient diagnosis for which care is sought.
8545     */
8546    @Child(name = "diagnosis", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8547    @Description(shortDefinition="Diagnosis", formalDefinition="Ordered list of patient diagnosis for which care is sought." )
8548    protected List<DiagnosisComponent> diagnosis;
8549
8550    /**
8551     * Ordered list of patient procedures performed to support the adjudication.
8552     */
8553    @Child(name = "procedure", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8554    @Description(shortDefinition="Procedures performed", formalDefinition="Ordered list of patient procedures performed to support the adjudication." )
8555    protected List<ProcedureComponent> procedure;
8556
8557    /**
8558     * List of special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.
8559     */
8560    @Child(name = "specialCondition", type = {Coding.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8561    @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." )
8562    protected List<Coding> specialCondition;
8563
8564    /**
8565     * Patient Resource.
8566     */
8567    @Child(name = "patient", type = {Identifier.class, Patient.class}, order=23, min=1, max=1, modifier=false, summary=true)
8568    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
8569    protected Type patient;
8570
8571    /**
8572     * Precedence (primary, secondary, etc.).
8573     */
8574    @Child(name = "precedence", type = {PositiveIntType.class}, order=24, min=0, max=1, modifier=false, summary=true)
8575    @Description(shortDefinition="Precedence (primary, secondary, etc.)", formalDefinition="Precedence (primary, secondary, etc.)." )
8576    protected PositiveIntType precedence;
8577
8578    /**
8579     * Financial instrument by which payment information for health care.
8580     */
8581    @Child(name = "coverage", type = {}, order=25, min=1, max=1, modifier=false, summary=true)
8582    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
8583    protected CoverageComponent coverage;
8584
8585    /**
8586     * Date of an accident which these services are addressing.
8587     */
8588    @Child(name = "accidentDate", type = {DateType.class}, order=26, min=0, max=1, modifier=false, summary=true)
8589    @Description(shortDefinition="When the accident occurred", formalDefinition="Date of an accident which these services are addressing." )
8590    protected DateType accidentDate;
8591
8592    /**
8593     * Type of accident: work, auto, etc.
8594     */
8595    @Child(name = "accidentType", type = {Coding.class}, order=27, min=0, max=1, modifier=false, summary=true)
8596    @Description(shortDefinition="The nature of the accident", formalDefinition="Type of accident: work, auto, etc." )
8597    protected Coding accidentType;
8598
8599    /**
8600     * Accident Place.
8601     */
8602    @Child(name = "accidentLocation", type = {Address.class, Location.class}, order=28, min=0, max=1, modifier=false, summary=true)
8603    @Description(shortDefinition="Accident Place", formalDefinition="Accident Place." )
8604    protected Type accidentLocation;
8605
8606    /**
8607     * A list of intervention and exception codes which may influence the adjudication of the claim.
8608     */
8609    @Child(name = "interventionException", type = {Coding.class}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8610    @Description(shortDefinition="Intervention and exception code (Pharma)", formalDefinition="A list of intervention and exception codes which may influence the adjudication of the claim." )
8611    protected List<Coding> interventionException;
8612
8613    /**
8614     * Period, start and last dates of aspects of the Condition or related services.
8615     */
8616    @Child(name = "onset", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8617    @Description(shortDefinition="Condition related Onset related dates and codes", formalDefinition="Period, start and last dates of aspects of the Condition or related services." )
8618    protected List<OnsetComponent> onset;
8619
8620    /**
8621     * The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).
8622     */
8623    @Child(name = "employmentImpacted", type = {Period.class}, order=31, min=0, max=1, modifier=false, summary=true)
8624    @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)." )
8625    protected Period employmentImpacted;
8626
8627    /**
8628     * The start and optional end dates of when the patient was confined to a treatment center.
8629     */
8630    @Child(name = "hospitalization", type = {Period.class}, order=32, min=0, max=1, modifier=false, summary=true)
8631    @Description(shortDefinition="Period in hospital", formalDefinition="The start and optional end dates of when the patient was confined to a treatment center." )
8632    protected Period hospitalization;
8633
8634    /**
8635     * First tier of goods and services.
8636     */
8637    @Child(name = "item", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8638    @Description(shortDefinition="Goods and Services", formalDefinition="First tier of goods and services." )
8639    protected List<ItemsComponent> item;
8640
8641    /**
8642     * The first tier service adjudications for payor added services.
8643     */
8644    @Child(name = "addItem", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8645    @Description(shortDefinition="Insurer added line items", formalDefinition="The first tier service adjudications for payor added services." )
8646    protected List<AddedItemComponent> addItem;
8647
8648    /**
8649     * A list of teeth which would be expected but are not found due to having been previously  extracted or for other reasons.
8650     */
8651    @Child(name = "missingTeeth", type = {}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8652    @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." )
8653    protected List<MissingTeethComponent> missingTeeth;
8654
8655    /**
8656     * The total cost of the services reported.
8657     */
8658    @Child(name = "totalCost", type = {Money.class}, order=36, min=0, max=1, modifier=false, summary=true)
8659    @Description(shortDefinition="Total Cost of service from the Claim", formalDefinition="The total cost of the services reported." )
8660    protected Money totalCost;
8661
8662    /**
8663     * The amount of deductable applied which was not allocated to any particular service line.
8664     */
8665    @Child(name = "unallocDeductable", type = {Money.class}, order=37, min=0, max=1, modifier=false, summary=true)
8666    @Description(shortDefinition="Unallocated deductable", formalDefinition="The amount of deductable applied which was not allocated to any particular service line." )
8667    protected Money unallocDeductable;
8668
8669    /**
8670     * Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).
8671     */
8672    @Child(name = "totalBenefit", type = {Money.class}, order=38, min=0, max=1, modifier=false, summary=true)
8673    @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)." )
8674    protected Money totalBenefit;
8675
8676    /**
8677     * Adjustment to the payment of this transaction which is not related to adjudication of this transaction.
8678     */
8679    @Child(name = "paymentAdjustment", type = {Money.class}, order=39, min=0, max=1, modifier=false, summary=true)
8680    @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." )
8681    protected Money paymentAdjustment;
8682
8683    /**
8684     * Reason for the payment adjustment.
8685     */
8686    @Child(name = "paymentAdjustmentReason", type = {Coding.class}, order=40, min=0, max=1, modifier=false, summary=true)
8687    @Description(shortDefinition="Reason for Payment adjustment", formalDefinition="Reason for the payment adjustment." )
8688    protected Coding paymentAdjustmentReason;
8689
8690    /**
8691     * Estimated payment data.
8692     */
8693    @Child(name = "paymentDate", type = {DateType.class}, order=41, min=0, max=1, modifier=false, summary=true)
8694    @Description(shortDefinition="Expected data of Payment", formalDefinition="Estimated payment data." )
8695    protected DateType paymentDate;
8696
8697    /**
8698     * Payable less any payment adjustment.
8699     */
8700    @Child(name = "paymentAmount", type = {Money.class}, order=42, min=0, max=1, modifier=false, summary=true)
8701    @Description(shortDefinition="Payment amount", formalDefinition="Payable less any payment adjustment." )
8702    protected Money paymentAmount;
8703
8704    /**
8705     * Payment identifer.
8706     */
8707    @Child(name = "paymentRef", type = {Identifier.class}, order=43, min=0, max=1, modifier=false, summary=true)
8708    @Description(shortDefinition="Payment identifier", formalDefinition="Payment identifer." )
8709    protected Identifier paymentRef;
8710
8711    /**
8712     * Status of funds reservation (For provider, for Patient, None).
8713     */
8714    @Child(name = "reserved", type = {Coding.class}, order=44, min=0, max=1, modifier=false, summary=true)
8715    @Description(shortDefinition="Funds reserved status", formalDefinition="Status of funds reservation (For provider, for Patient, None)." )
8716    protected Coding reserved;
8717
8718    /**
8719     * The form to be used for printing the content.
8720     */
8721    @Child(name = "form", type = {Coding.class}, order=45, min=0, max=1, modifier=false, summary=true)
8722    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
8723    protected Coding form;
8724
8725    /**
8726     * Note text.
8727     */
8728    @Child(name = "note", type = {}, order=46, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8729    @Description(shortDefinition="Processing notes", formalDefinition="Note text." )
8730    protected List<NotesComponent> note;
8731
8732    /**
8733     * Balance by Benefit Category.
8734     */
8735    @Child(name = "benefitBalance", type = {}, order=47, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
8736    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
8737    protected List<BenefitBalanceComponent> benefitBalance;
8738
8739    private static final long serialVersionUID = 1781852561L;
8740
8741  /**
8742   * Constructor
8743   */
8744    public ExplanationOfBenefit() {
8745      super();
8746    }
8747
8748  /**
8749   * Constructor
8750   */
8751    public ExplanationOfBenefit(Type patient, CoverageComponent coverage) {
8752      super();
8753      this.patient = patient;
8754      this.coverage = coverage;
8755    }
8756
8757    /**
8758     * @return {@link #identifier} (The Response Business Identifier.)
8759     */
8760    public List<Identifier> getIdentifier() { 
8761      if (this.identifier == null)
8762        this.identifier = new ArrayList<Identifier>();
8763      return this.identifier;
8764    }
8765
8766    public boolean hasIdentifier() { 
8767      if (this.identifier == null)
8768        return false;
8769      for (Identifier item : this.identifier)
8770        if (!item.isEmpty())
8771          return true;
8772      return false;
8773    }
8774
8775    /**
8776     * @return {@link #identifier} (The Response Business Identifier.)
8777     */
8778    // syntactic sugar
8779    public Identifier addIdentifier() { //3
8780      Identifier t = new Identifier();
8781      if (this.identifier == null)
8782        this.identifier = new ArrayList<Identifier>();
8783      this.identifier.add(t);
8784      return t;
8785    }
8786
8787    // syntactic sugar
8788    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
8789      if (t == null)
8790        return this;
8791      if (this.identifier == null)
8792        this.identifier = new ArrayList<Identifier>();
8793      this.identifier.add(t);
8794      return this;
8795    }
8796
8797    /**
8798     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8799     */
8800    public Type getClaim() { 
8801      return this.claim;
8802    }
8803
8804    /**
8805     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8806     */
8807    public Identifier getClaimIdentifier() throws FHIRException { 
8808      if (!(this.claim instanceof Identifier))
8809        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.claim.getClass().getName()+" was encountered");
8810      return (Identifier) this.claim;
8811    }
8812
8813    public boolean hasClaimIdentifier() { 
8814      return this.claim instanceof Identifier;
8815    }
8816
8817    /**
8818     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8819     */
8820    public Reference getClaimReference() throws FHIRException { 
8821      if (!(this.claim instanceof Reference))
8822        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.claim.getClass().getName()+" was encountered");
8823      return (Reference) this.claim;
8824    }
8825
8826    public boolean hasClaimReference() { 
8827      return this.claim instanceof Reference;
8828    }
8829
8830    public boolean hasClaim() { 
8831      return this.claim != null && !this.claim.isEmpty();
8832    }
8833
8834    /**
8835     * @param value {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8836     */
8837    public ExplanationOfBenefit setClaim(Type value) { 
8838      this.claim = value;
8839      return this;
8840    }
8841
8842    /**
8843     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8844     */
8845    public Type getClaimResponse() { 
8846      return this.claimResponse;
8847    }
8848
8849    /**
8850     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8851     */
8852    public Identifier getClaimResponseIdentifier() throws FHIRException { 
8853      if (!(this.claimResponse instanceof Identifier))
8854        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.claimResponse.getClass().getName()+" was encountered");
8855      return (Identifier) this.claimResponse;
8856    }
8857
8858    public boolean hasClaimResponseIdentifier() { 
8859      return this.claimResponse instanceof Identifier;
8860    }
8861
8862    /**
8863     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8864     */
8865    public Reference getClaimResponseReference() throws FHIRException { 
8866      if (!(this.claimResponse instanceof Reference))
8867        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.claimResponse.getClass().getName()+" was encountered");
8868      return (Reference) this.claimResponse;
8869    }
8870
8871    public boolean hasClaimResponseReference() { 
8872      return this.claimResponse instanceof Reference;
8873    }
8874
8875    public boolean hasClaimResponse() { 
8876      return this.claimResponse != null && !this.claimResponse.isEmpty();
8877    }
8878
8879    /**
8880     * @param value {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
8881     */
8882    public ExplanationOfBenefit setClaimResponse(Type value) { 
8883      this.claimResponse = value;
8884      return this;
8885    }
8886
8887    /**
8888     * @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.)
8889     */
8890    public List<Coding> getSubType() { 
8891      if (this.subType == null)
8892        this.subType = new ArrayList<Coding>();
8893      return this.subType;
8894    }
8895
8896    public boolean hasSubType() { 
8897      if (this.subType == null)
8898        return false;
8899      for (Coding item : this.subType)
8900        if (!item.isEmpty())
8901          return true;
8902      return false;
8903    }
8904
8905    /**
8906     * @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.)
8907     */
8908    // syntactic sugar
8909    public Coding addSubType() { //3
8910      Coding t = new Coding();
8911      if (this.subType == null)
8912        this.subType = new ArrayList<Coding>();
8913      this.subType.add(t);
8914      return t;
8915    }
8916
8917    // syntactic sugar
8918    public ExplanationOfBenefit addSubType(Coding t) { //3
8919      if (t == null)
8920        return this;
8921      if (this.subType == null)
8922        this.subType = new ArrayList<Coding>();
8923      this.subType.add(t);
8924      return this;
8925    }
8926
8927    /**
8928     * @return {@link #ruleset} (The version of the specification on which this instance relies.)
8929     */
8930    public Coding getRuleset() { 
8931      if (this.ruleset == null)
8932        if (Configuration.errorOnAutoCreate())
8933          throw new Error("Attempt to auto-create ExplanationOfBenefit.ruleset");
8934        else if (Configuration.doAutoCreate())
8935          this.ruleset = new Coding(); // cc
8936      return this.ruleset;
8937    }
8938
8939    public boolean hasRuleset() { 
8940      return this.ruleset != null && !this.ruleset.isEmpty();
8941    }
8942
8943    /**
8944     * @param value {@link #ruleset} (The version of the specification on which this instance relies.)
8945     */
8946    public ExplanationOfBenefit setRuleset(Coding value) { 
8947      this.ruleset = value;
8948      return this;
8949    }
8950
8951    /**
8952     * @return {@link #originalRuleset} (The version of the specification from which the original instance was created.)
8953     */
8954    public Coding getOriginalRuleset() { 
8955      if (this.originalRuleset == null)
8956        if (Configuration.errorOnAutoCreate())
8957          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalRuleset");
8958        else if (Configuration.doAutoCreate())
8959          this.originalRuleset = new Coding(); // cc
8960      return this.originalRuleset;
8961    }
8962
8963    public boolean hasOriginalRuleset() { 
8964      return this.originalRuleset != null && !this.originalRuleset.isEmpty();
8965    }
8966
8967    /**
8968     * @param value {@link #originalRuleset} (The version of the specification from which the original instance was created.)
8969     */
8970    public ExplanationOfBenefit setOriginalRuleset(Coding value) { 
8971      this.originalRuleset = value;
8972      return this;
8973    }
8974
8975    /**
8976     * @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
8977     */
8978    public DateTimeType getCreatedElement() { 
8979      if (this.created == null)
8980        if (Configuration.errorOnAutoCreate())
8981          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
8982        else if (Configuration.doAutoCreate())
8983          this.created = new DateTimeType(); // bb
8984      return this.created;
8985    }
8986
8987    public boolean hasCreatedElement() { 
8988      return this.created != null && !this.created.isEmpty();
8989    }
8990
8991    public boolean hasCreated() { 
8992      return this.created != null && !this.created.isEmpty();
8993    }
8994
8995    /**
8996     * @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
8997     */
8998    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
8999      this.created = value;
9000      return this;
9001    }
9002
9003    /**
9004     * @return The date when the EOB was created.
9005     */
9006    public Date getCreated() { 
9007      return this.created == null ? null : this.created.getValue();
9008    }
9009
9010    /**
9011     * @param value The date when the EOB was created.
9012     */
9013    public ExplanationOfBenefit setCreated(Date value) { 
9014      if (value == null)
9015        this.created = null;
9016      else {
9017        if (this.created == null)
9018          this.created = new DateTimeType();
9019        this.created.setValue(value);
9020      }
9021      return this;
9022    }
9023
9024    /**
9025     * @return {@link #billablePeriod} (The billable period for which charges are being submitted.)
9026     */
9027    public Period getBillablePeriod() { 
9028      if (this.billablePeriod == null)
9029        if (Configuration.errorOnAutoCreate())
9030          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
9031        else if (Configuration.doAutoCreate())
9032          this.billablePeriod = new Period(); // cc
9033      return this.billablePeriod;
9034    }
9035
9036    public boolean hasBillablePeriod() { 
9037      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
9038    }
9039
9040    /**
9041     * @param value {@link #billablePeriod} (The billable period for which charges are being submitted.)
9042     */
9043    public ExplanationOfBenefit setBillablePeriod(Period value) { 
9044      this.billablePeriod = value;
9045      return this;
9046    }
9047
9048    /**
9049     * @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
9050     */
9051    public StringType getDispositionElement() { 
9052      if (this.disposition == null)
9053        if (Configuration.errorOnAutoCreate())
9054          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
9055        else if (Configuration.doAutoCreate())
9056          this.disposition = new StringType(); // bb
9057      return this.disposition;
9058    }
9059
9060    public boolean hasDispositionElement() { 
9061      return this.disposition != null && !this.disposition.isEmpty();
9062    }
9063
9064    public boolean hasDisposition() { 
9065      return this.disposition != null && !this.disposition.isEmpty();
9066    }
9067
9068    /**
9069     * @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
9070     */
9071    public ExplanationOfBenefit setDispositionElement(StringType value) { 
9072      this.disposition = value;
9073      return this;
9074    }
9075
9076    /**
9077     * @return A description of the status of the adjudication.
9078     */
9079    public String getDisposition() { 
9080      return this.disposition == null ? null : this.disposition.getValue();
9081    }
9082
9083    /**
9084     * @param value A description of the status of the adjudication.
9085     */
9086    public ExplanationOfBenefit setDisposition(String value) { 
9087      if (Utilities.noString(value))
9088        this.disposition = null;
9089      else {
9090        if (this.disposition == null)
9091          this.disposition = new StringType();
9092        this.disposition.setValue(value);
9093      }
9094      return this;
9095    }
9096
9097    /**
9098     * @return {@link #provider} (The provider which is responsible for the claim.)
9099     */
9100    public Type getProvider() { 
9101      return this.provider;
9102    }
9103
9104    /**
9105     * @return {@link #provider} (The provider which is responsible for the claim.)
9106     */
9107    public Identifier getProviderIdentifier() throws FHIRException { 
9108      if (!(this.provider instanceof Identifier))
9109        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.provider.getClass().getName()+" was encountered");
9110      return (Identifier) this.provider;
9111    }
9112
9113    public boolean hasProviderIdentifier() { 
9114      return this.provider instanceof Identifier;
9115    }
9116
9117    /**
9118     * @return {@link #provider} (The provider which is responsible for the claim.)
9119     */
9120    public Reference getProviderReference() throws FHIRException { 
9121      if (!(this.provider instanceof Reference))
9122        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.provider.getClass().getName()+" was encountered");
9123      return (Reference) this.provider;
9124    }
9125
9126    public boolean hasProviderReference() { 
9127      return this.provider instanceof Reference;
9128    }
9129
9130    public boolean hasProvider() { 
9131      return this.provider != null && !this.provider.isEmpty();
9132    }
9133
9134    /**
9135     * @param value {@link #provider} (The provider which is responsible for the claim.)
9136     */
9137    public ExplanationOfBenefit setProvider(Type value) { 
9138      this.provider = value;
9139      return this;
9140    }
9141
9142    /**
9143     * @return {@link #organization} (The provider which is responsible for the claim.)
9144     */
9145    public Type getOrganization() { 
9146      return this.organization;
9147    }
9148
9149    /**
9150     * @return {@link #organization} (The provider which is responsible for the claim.)
9151     */
9152    public Identifier getOrganizationIdentifier() throws FHIRException { 
9153      if (!(this.organization instanceof Identifier))
9154        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.organization.getClass().getName()+" was encountered");
9155      return (Identifier) this.organization;
9156    }
9157
9158    public boolean hasOrganizationIdentifier() { 
9159      return this.organization instanceof Identifier;
9160    }
9161
9162    /**
9163     * @return {@link #organization} (The provider which is responsible for the claim.)
9164     */
9165    public Reference getOrganizationReference() throws FHIRException { 
9166      if (!(this.organization instanceof Reference))
9167        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.organization.getClass().getName()+" was encountered");
9168      return (Reference) this.organization;
9169    }
9170
9171    public boolean hasOrganizationReference() { 
9172      return this.organization instanceof Reference;
9173    }
9174
9175    public boolean hasOrganization() { 
9176      return this.organization != null && !this.organization.isEmpty();
9177    }
9178
9179    /**
9180     * @param value {@link #organization} (The provider which is responsible for the claim.)
9181     */
9182    public ExplanationOfBenefit setOrganization(Type value) { 
9183      this.organization = value;
9184      return this;
9185    }
9186
9187    /**
9188     * @return {@link #facility} (Facility where the services were provided.)
9189     */
9190    public Type getFacility() { 
9191      return this.facility;
9192    }
9193
9194    /**
9195     * @return {@link #facility} (Facility where the services were provided.)
9196     */
9197    public Identifier getFacilityIdentifier() throws FHIRException { 
9198      if (!(this.facility instanceof Identifier))
9199        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.facility.getClass().getName()+" was encountered");
9200      return (Identifier) this.facility;
9201    }
9202
9203    public boolean hasFacilityIdentifier() { 
9204      return this.facility instanceof Identifier;
9205    }
9206
9207    /**
9208     * @return {@link #facility} (Facility where the services were provided.)
9209     */
9210    public Reference getFacilityReference() throws FHIRException { 
9211      if (!(this.facility instanceof Reference))
9212        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.facility.getClass().getName()+" was encountered");
9213      return (Reference) this.facility;
9214    }
9215
9216    public boolean hasFacilityReference() { 
9217      return this.facility instanceof Reference;
9218    }
9219
9220    public boolean hasFacility() { 
9221      return this.facility != null && !this.facility.isEmpty();
9222    }
9223
9224    /**
9225     * @param value {@link #facility} (Facility where the services were provided.)
9226     */
9227    public ExplanationOfBenefit setFacility(Type value) { 
9228      this.facility = value;
9229      return this;
9230    }
9231
9232    /**
9233     * @return {@link #related} (Other claims which are related to this claim such as prior claim versions or for related services.)
9234     */
9235    public List<RelatedClaimsComponent> getRelated() { 
9236      if (this.related == null)
9237        this.related = new ArrayList<RelatedClaimsComponent>();
9238      return this.related;
9239    }
9240
9241    public boolean hasRelated() { 
9242      if (this.related == null)
9243        return false;
9244      for (RelatedClaimsComponent item : this.related)
9245        if (!item.isEmpty())
9246          return true;
9247      return false;
9248    }
9249
9250    /**
9251     * @return {@link #related} (Other claims which are related to this claim such as prior claim versions or for related services.)
9252     */
9253    // syntactic sugar
9254    public RelatedClaimsComponent addRelated() { //3
9255      RelatedClaimsComponent t = new RelatedClaimsComponent();
9256      if (this.related == null)
9257        this.related = new ArrayList<RelatedClaimsComponent>();
9258      this.related.add(t);
9259      return t;
9260    }
9261
9262    // syntactic sugar
9263    public ExplanationOfBenefit addRelated(RelatedClaimsComponent t) { //3
9264      if (t == null)
9265        return this;
9266      if (this.related == null)
9267        this.related = new ArrayList<RelatedClaimsComponent>();
9268      this.related.add(t);
9269      return this;
9270    }
9271
9272    /**
9273     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
9274     */
9275    public Type getPrescription() { 
9276      return this.prescription;
9277    }
9278
9279    /**
9280     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
9281     */
9282    public Identifier getPrescriptionIdentifier() throws FHIRException { 
9283      if (!(this.prescription instanceof Identifier))
9284        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.prescription.getClass().getName()+" was encountered");
9285      return (Identifier) this.prescription;
9286    }
9287
9288    public boolean hasPrescriptionIdentifier() { 
9289      return this.prescription instanceof Identifier;
9290    }
9291
9292    /**
9293     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
9294     */
9295    public Reference getPrescriptionReference() throws FHIRException { 
9296      if (!(this.prescription instanceof Reference))
9297        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.prescription.getClass().getName()+" was encountered");
9298      return (Reference) this.prescription;
9299    }
9300
9301    public boolean hasPrescriptionReference() { 
9302      return this.prescription instanceof Reference;
9303    }
9304
9305    public boolean hasPrescription() { 
9306      return this.prescription != null && !this.prescription.isEmpty();
9307    }
9308
9309    /**
9310     * @param value {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
9311     */
9312    public ExplanationOfBenefit setPrescription(Type value) { 
9313      this.prescription = value;
9314      return this;
9315    }
9316
9317    /**
9318     * @return {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.)
9319     */
9320    public Type getOriginalPrescription() { 
9321      return this.originalPrescription;
9322    }
9323
9324    /**
9325     * @return {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.)
9326     */
9327    public Identifier getOriginalPrescriptionIdentifier() throws FHIRException { 
9328      if (!(this.originalPrescription instanceof Identifier))
9329        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.originalPrescription.getClass().getName()+" was encountered");
9330      return (Identifier) this.originalPrescription;
9331    }
9332
9333    public boolean hasOriginalPrescriptionIdentifier() { 
9334      return this.originalPrescription instanceof Identifier;
9335    }
9336
9337    /**
9338     * @return {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.)
9339     */
9340    public Reference getOriginalPrescriptionReference() throws FHIRException { 
9341      if (!(this.originalPrescription instanceof Reference))
9342        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.originalPrescription.getClass().getName()+" was encountered");
9343      return (Reference) this.originalPrescription;
9344    }
9345
9346    public boolean hasOriginalPrescriptionReference() { 
9347      return this.originalPrescription instanceof Reference;
9348    }
9349
9350    public boolean hasOriginalPrescription() { 
9351      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
9352    }
9353
9354    /**
9355     * @param value {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products.)
9356     */
9357    public ExplanationOfBenefit setOriginalPrescription(Type value) { 
9358      this.originalPrescription = value;
9359      return this;
9360    }
9361
9362    /**
9363     * @return {@link #payee} (The party to be reimbursed for the services.)
9364     */
9365    public PayeeComponent getPayee() { 
9366      if (this.payee == null)
9367        if (Configuration.errorOnAutoCreate())
9368          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
9369        else if (Configuration.doAutoCreate())
9370          this.payee = new PayeeComponent(); // cc
9371      return this.payee;
9372    }
9373
9374    public boolean hasPayee() { 
9375      return this.payee != null && !this.payee.isEmpty();
9376    }
9377
9378    /**
9379     * @param value {@link #payee} (The party to be reimbursed for the services.)
9380     */
9381    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
9382      this.payee = value;
9383      return this;
9384    }
9385
9386    /**
9387     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
9388     */
9389    public Type getReferral() { 
9390      return this.referral;
9391    }
9392
9393    /**
9394     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
9395     */
9396    public Identifier getReferralIdentifier() throws FHIRException { 
9397      if (!(this.referral instanceof Identifier))
9398        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.referral.getClass().getName()+" was encountered");
9399      return (Identifier) this.referral;
9400    }
9401
9402    public boolean hasReferralIdentifier() { 
9403      return this.referral instanceof Identifier;
9404    }
9405
9406    /**
9407     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
9408     */
9409    public Reference getReferralReference() throws FHIRException { 
9410      if (!(this.referral instanceof Reference))
9411        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.referral.getClass().getName()+" was encountered");
9412      return (Reference) this.referral;
9413    }
9414
9415    public boolean hasReferralReference() { 
9416      return this.referral instanceof Reference;
9417    }
9418
9419    public boolean hasReferral() { 
9420      return this.referral != null && !this.referral.isEmpty();
9421    }
9422
9423    /**
9424     * @param value {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
9425     */
9426    public ExplanationOfBenefit setReferral(Type value) { 
9427      this.referral = value;
9428      return this;
9429    }
9430
9431    /**
9432     * @return {@link #occurrenceCode} (**Insert definition of Occurrence codes.)
9433     */
9434    public List<Coding> getOccurrenceCode() { 
9435      if (this.occurrenceCode == null)
9436        this.occurrenceCode = new ArrayList<Coding>();
9437      return this.occurrenceCode;
9438    }
9439
9440    public boolean hasOccurrenceCode() { 
9441      if (this.occurrenceCode == null)
9442        return false;
9443      for (Coding item : this.occurrenceCode)
9444        if (!item.isEmpty())
9445          return true;
9446      return false;
9447    }
9448
9449    /**
9450     * @return {@link #occurrenceCode} (**Insert definition of Occurrence codes.)
9451     */
9452    // syntactic sugar
9453    public Coding addOccurrenceCode() { //3
9454      Coding t = new Coding();
9455      if (this.occurrenceCode == null)
9456        this.occurrenceCode = new ArrayList<Coding>();
9457      this.occurrenceCode.add(t);
9458      return t;
9459    }
9460
9461    // syntactic sugar
9462    public ExplanationOfBenefit addOccurrenceCode(Coding t) { //3
9463      if (t == null)
9464        return this;
9465      if (this.occurrenceCode == null)
9466        this.occurrenceCode = new ArrayList<Coding>();
9467      this.occurrenceCode.add(t);
9468      return this;
9469    }
9470
9471    /**
9472     * @return {@link #occurenceSpanCode} (**Insert definition of Occurrence Span codes.)
9473     */
9474    public List<Coding> getOccurenceSpanCode() { 
9475      if (this.occurenceSpanCode == null)
9476        this.occurenceSpanCode = new ArrayList<Coding>();
9477      return this.occurenceSpanCode;
9478    }
9479
9480    public boolean hasOccurenceSpanCode() { 
9481      if (this.occurenceSpanCode == null)
9482        return false;
9483      for (Coding item : this.occurenceSpanCode)
9484        if (!item.isEmpty())
9485          return true;
9486      return false;
9487    }
9488
9489    /**
9490     * @return {@link #occurenceSpanCode} (**Insert definition of Occurrence Span codes.)
9491     */
9492    // syntactic sugar
9493    public Coding addOccurenceSpanCode() { //3
9494      Coding t = new Coding();
9495      if (this.occurenceSpanCode == null)
9496        this.occurenceSpanCode = new ArrayList<Coding>();
9497      this.occurenceSpanCode.add(t);
9498      return t;
9499    }
9500
9501    // syntactic sugar
9502    public ExplanationOfBenefit addOccurenceSpanCode(Coding t) { //3
9503      if (t == null)
9504        return this;
9505      if (this.occurenceSpanCode == null)
9506        this.occurenceSpanCode = new ArrayList<Coding>();
9507      this.occurenceSpanCode.add(t);
9508      return this;
9509    }
9510
9511    /**
9512     * @return {@link #valueCode} (**Insert definition of Value codes.)
9513     */
9514    public List<Coding> getValueCode() { 
9515      if (this.valueCode == null)
9516        this.valueCode = new ArrayList<Coding>();
9517      return this.valueCode;
9518    }
9519
9520    public boolean hasValueCode() { 
9521      if (this.valueCode == null)
9522        return false;
9523      for (Coding item : this.valueCode)
9524        if (!item.isEmpty())
9525          return true;
9526      return false;
9527    }
9528
9529    /**
9530     * @return {@link #valueCode} (**Insert definition of Value codes.)
9531     */
9532    // syntactic sugar
9533    public Coding addValueCode() { //3
9534      Coding t = new Coding();
9535      if (this.valueCode == null)
9536        this.valueCode = new ArrayList<Coding>();
9537      this.valueCode.add(t);
9538      return t;
9539    }
9540
9541    // syntactic sugar
9542    public ExplanationOfBenefit addValueCode(Coding t) { //3
9543      if (t == null)
9544        return this;
9545      if (this.valueCode == null)
9546        this.valueCode = new ArrayList<Coding>();
9547      this.valueCode.add(t);
9548      return this;
9549    }
9550
9551    /**
9552     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
9553     */
9554    public List<DiagnosisComponent> getDiagnosis() { 
9555      if (this.diagnosis == null)
9556        this.diagnosis = new ArrayList<DiagnosisComponent>();
9557      return this.diagnosis;
9558    }
9559
9560    public boolean hasDiagnosis() { 
9561      if (this.diagnosis == null)
9562        return false;
9563      for (DiagnosisComponent item : this.diagnosis)
9564        if (!item.isEmpty())
9565          return true;
9566      return false;
9567    }
9568
9569    /**
9570     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
9571     */
9572    // syntactic sugar
9573    public DiagnosisComponent addDiagnosis() { //3
9574      DiagnosisComponent t = new DiagnosisComponent();
9575      if (this.diagnosis == null)
9576        this.diagnosis = new ArrayList<DiagnosisComponent>();
9577      this.diagnosis.add(t);
9578      return t;
9579    }
9580
9581    // syntactic sugar
9582    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
9583      if (t == null)
9584        return this;
9585      if (this.diagnosis == null)
9586        this.diagnosis = new ArrayList<DiagnosisComponent>();
9587      this.diagnosis.add(t);
9588      return this;
9589    }
9590
9591    /**
9592     * @return {@link #procedure} (Ordered list of patient procedures performed to support the adjudication.)
9593     */
9594    public List<ProcedureComponent> getProcedure() { 
9595      if (this.procedure == null)
9596        this.procedure = new ArrayList<ProcedureComponent>();
9597      return this.procedure;
9598    }
9599
9600    public boolean hasProcedure() { 
9601      if (this.procedure == null)
9602        return false;
9603      for (ProcedureComponent item : this.procedure)
9604        if (!item.isEmpty())
9605          return true;
9606      return false;
9607    }
9608
9609    /**
9610     * @return {@link #procedure} (Ordered list of patient procedures performed to support the adjudication.)
9611     */
9612    // syntactic sugar
9613    public ProcedureComponent addProcedure() { //3
9614      ProcedureComponent t = new ProcedureComponent();
9615      if (this.procedure == null)
9616        this.procedure = new ArrayList<ProcedureComponent>();
9617      this.procedure.add(t);
9618      return t;
9619    }
9620
9621    // syntactic sugar
9622    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
9623      if (t == null)
9624        return this;
9625      if (this.procedure == null)
9626        this.procedure = new ArrayList<ProcedureComponent>();
9627      this.procedure.add(t);
9628      return this;
9629    }
9630
9631    /**
9632     * @return {@link #specialCondition} (List of special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.)
9633     */
9634    public List<Coding> getSpecialCondition() { 
9635      if (this.specialCondition == null)
9636        this.specialCondition = new ArrayList<Coding>();
9637      return this.specialCondition;
9638    }
9639
9640    public boolean hasSpecialCondition() { 
9641      if (this.specialCondition == null)
9642        return false;
9643      for (Coding item : this.specialCondition)
9644        if (!item.isEmpty())
9645          return true;
9646      return false;
9647    }
9648
9649    /**
9650     * @return {@link #specialCondition} (List of special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.)
9651     */
9652    // syntactic sugar
9653    public Coding addSpecialCondition() { //3
9654      Coding t = new Coding();
9655      if (this.specialCondition == null)
9656        this.specialCondition = new ArrayList<Coding>();
9657      this.specialCondition.add(t);
9658      return t;
9659    }
9660
9661    // syntactic sugar
9662    public ExplanationOfBenefit addSpecialCondition(Coding t) { //3
9663      if (t == null)
9664        return this;
9665      if (this.specialCondition == null)
9666        this.specialCondition = new ArrayList<Coding>();
9667      this.specialCondition.add(t);
9668      return this;
9669    }
9670
9671    /**
9672     * @return {@link #patient} (Patient Resource.)
9673     */
9674    public Type getPatient() { 
9675      return this.patient;
9676    }
9677
9678    /**
9679     * @return {@link #patient} (Patient Resource.)
9680     */
9681    public Identifier getPatientIdentifier() throws FHIRException { 
9682      if (!(this.patient instanceof Identifier))
9683        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.patient.getClass().getName()+" was encountered");
9684      return (Identifier) this.patient;
9685    }
9686
9687    public boolean hasPatientIdentifier() { 
9688      return this.patient instanceof Identifier;
9689    }
9690
9691    /**
9692     * @return {@link #patient} (Patient Resource.)
9693     */
9694    public Reference getPatientReference() throws FHIRException { 
9695      if (!(this.patient instanceof Reference))
9696        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.patient.getClass().getName()+" was encountered");
9697      return (Reference) this.patient;
9698    }
9699
9700    public boolean hasPatientReference() { 
9701      return this.patient instanceof Reference;
9702    }
9703
9704    public boolean hasPatient() { 
9705      return this.patient != null && !this.patient.isEmpty();
9706    }
9707
9708    /**
9709     * @param value {@link #patient} (Patient Resource.)
9710     */
9711    public ExplanationOfBenefit setPatient(Type value) { 
9712      this.patient = value;
9713      return this;
9714    }
9715
9716    /**
9717     * @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
9718     */
9719    public PositiveIntType getPrecedenceElement() { 
9720      if (this.precedence == null)
9721        if (Configuration.errorOnAutoCreate())
9722          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
9723        else if (Configuration.doAutoCreate())
9724          this.precedence = new PositiveIntType(); // bb
9725      return this.precedence;
9726    }
9727
9728    public boolean hasPrecedenceElement() { 
9729      return this.precedence != null && !this.precedence.isEmpty();
9730    }
9731
9732    public boolean hasPrecedence() { 
9733      return this.precedence != null && !this.precedence.isEmpty();
9734    }
9735
9736    /**
9737     * @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
9738     */
9739    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
9740      this.precedence = value;
9741      return this;
9742    }
9743
9744    /**
9745     * @return Precedence (primary, secondary, etc.).
9746     */
9747    public int getPrecedence() { 
9748      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
9749    }
9750
9751    /**
9752     * @param value Precedence (primary, secondary, etc.).
9753     */
9754    public ExplanationOfBenefit setPrecedence(int value) { 
9755        if (this.precedence == null)
9756          this.precedence = new PositiveIntType();
9757        this.precedence.setValue(value);
9758      return this;
9759    }
9760
9761    /**
9762     * @return {@link #coverage} (Financial instrument by which payment information for health care.)
9763     */
9764    public CoverageComponent getCoverage() { 
9765      if (this.coverage == null)
9766        if (Configuration.errorOnAutoCreate())
9767          throw new Error("Attempt to auto-create ExplanationOfBenefit.coverage");
9768        else if (Configuration.doAutoCreate())
9769          this.coverage = new CoverageComponent(); // cc
9770      return this.coverage;
9771    }
9772
9773    public boolean hasCoverage() { 
9774      return this.coverage != null && !this.coverage.isEmpty();
9775    }
9776
9777    /**
9778     * @param value {@link #coverage} (Financial instrument by which payment information for health care.)
9779     */
9780    public ExplanationOfBenefit setCoverage(CoverageComponent value) { 
9781      this.coverage = value;
9782      return this;
9783    }
9784
9785    /**
9786     * @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
9787     */
9788    public DateType getAccidentDateElement() { 
9789      if (this.accidentDate == null)
9790        if (Configuration.errorOnAutoCreate())
9791          throw new Error("Attempt to auto-create ExplanationOfBenefit.accidentDate");
9792        else if (Configuration.doAutoCreate())
9793          this.accidentDate = new DateType(); // bb
9794      return this.accidentDate;
9795    }
9796
9797    public boolean hasAccidentDateElement() { 
9798      return this.accidentDate != null && !this.accidentDate.isEmpty();
9799    }
9800
9801    public boolean hasAccidentDate() { 
9802      return this.accidentDate != null && !this.accidentDate.isEmpty();
9803    }
9804
9805    /**
9806     * @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
9807     */
9808    public ExplanationOfBenefit setAccidentDateElement(DateType value) { 
9809      this.accidentDate = value;
9810      return this;
9811    }
9812
9813    /**
9814     * @return Date of an accident which these services are addressing.
9815     */
9816    public Date getAccidentDate() { 
9817      return this.accidentDate == null ? null : this.accidentDate.getValue();
9818    }
9819
9820    /**
9821     * @param value Date of an accident which these services are addressing.
9822     */
9823    public ExplanationOfBenefit setAccidentDate(Date value) { 
9824      if (value == null)
9825        this.accidentDate = null;
9826      else {
9827        if (this.accidentDate == null)
9828          this.accidentDate = new DateType();
9829        this.accidentDate.setValue(value);
9830      }
9831      return this;
9832    }
9833
9834    /**
9835     * @return {@link #accidentType} (Type of accident: work, auto, etc.)
9836     */
9837    public Coding getAccidentType() { 
9838      if (this.accidentType == null)
9839        if (Configuration.errorOnAutoCreate())
9840          throw new Error("Attempt to auto-create ExplanationOfBenefit.accidentType");
9841        else if (Configuration.doAutoCreate())
9842          this.accidentType = new Coding(); // cc
9843      return this.accidentType;
9844    }
9845
9846    public boolean hasAccidentType() { 
9847      return this.accidentType != null && !this.accidentType.isEmpty();
9848    }
9849
9850    /**
9851     * @param value {@link #accidentType} (Type of accident: work, auto, etc.)
9852     */
9853    public ExplanationOfBenefit setAccidentType(Coding value) { 
9854      this.accidentType = value;
9855      return this;
9856    }
9857
9858    /**
9859     * @return {@link #accidentLocation} (Accident Place.)
9860     */
9861    public Type getAccidentLocation() { 
9862      return this.accidentLocation;
9863    }
9864
9865    /**
9866     * @return {@link #accidentLocation} (Accident Place.)
9867     */
9868    public Address getAccidentLocationAddress() throws FHIRException { 
9869      if (!(this.accidentLocation instanceof Address))
9870        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.accidentLocation.getClass().getName()+" was encountered");
9871      return (Address) this.accidentLocation;
9872    }
9873
9874    public boolean hasAccidentLocationAddress() { 
9875      return this.accidentLocation instanceof Address;
9876    }
9877
9878    /**
9879     * @return {@link #accidentLocation} (Accident Place.)
9880     */
9881    public Reference getAccidentLocationReference() throws FHIRException { 
9882      if (!(this.accidentLocation instanceof Reference))
9883        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.accidentLocation.getClass().getName()+" was encountered");
9884      return (Reference) this.accidentLocation;
9885    }
9886
9887    public boolean hasAccidentLocationReference() { 
9888      return this.accidentLocation instanceof Reference;
9889    }
9890
9891    public boolean hasAccidentLocation() { 
9892      return this.accidentLocation != null && !this.accidentLocation.isEmpty();
9893    }
9894
9895    /**
9896     * @param value {@link #accidentLocation} (Accident Place.)
9897     */
9898    public ExplanationOfBenefit setAccidentLocation(Type value) { 
9899      this.accidentLocation = value;
9900      return this;
9901    }
9902
9903    /**
9904     * @return {@link #interventionException} (A list of intervention and exception codes which may influence the adjudication of the claim.)
9905     */
9906    public List<Coding> getInterventionException() { 
9907      if (this.interventionException == null)
9908        this.interventionException = new ArrayList<Coding>();
9909      return this.interventionException;
9910    }
9911
9912    public boolean hasInterventionException() { 
9913      if (this.interventionException == null)
9914        return false;
9915      for (Coding item : this.interventionException)
9916        if (!item.isEmpty())
9917          return true;
9918      return false;
9919    }
9920
9921    /**
9922     * @return {@link #interventionException} (A list of intervention and exception codes which may influence the adjudication of the claim.)
9923     */
9924    // syntactic sugar
9925    public Coding addInterventionException() { //3
9926      Coding t = new Coding();
9927      if (this.interventionException == null)
9928        this.interventionException = new ArrayList<Coding>();
9929      this.interventionException.add(t);
9930      return t;
9931    }
9932
9933    // syntactic sugar
9934    public ExplanationOfBenefit addInterventionException(Coding t) { //3
9935      if (t == null)
9936        return this;
9937      if (this.interventionException == null)
9938        this.interventionException = new ArrayList<Coding>();
9939      this.interventionException.add(t);
9940      return this;
9941    }
9942
9943    /**
9944     * @return {@link #onset} (Period, start and last dates of aspects of the Condition or related services.)
9945     */
9946    public List<OnsetComponent> getOnset() { 
9947      if (this.onset == null)
9948        this.onset = new ArrayList<OnsetComponent>();
9949      return this.onset;
9950    }
9951
9952    public boolean hasOnset() { 
9953      if (this.onset == null)
9954        return false;
9955      for (OnsetComponent item : this.onset)
9956        if (!item.isEmpty())
9957          return true;
9958      return false;
9959    }
9960
9961    /**
9962     * @return {@link #onset} (Period, start and last dates of aspects of the Condition or related services.)
9963     */
9964    // syntactic sugar
9965    public OnsetComponent addOnset() { //3
9966      OnsetComponent t = new OnsetComponent();
9967      if (this.onset == null)
9968        this.onset = new ArrayList<OnsetComponent>();
9969      this.onset.add(t);
9970      return t;
9971    }
9972
9973    // syntactic sugar
9974    public ExplanationOfBenefit addOnset(OnsetComponent t) { //3
9975      if (t == null)
9976        return this;
9977      if (this.onset == null)
9978        this.onset = new ArrayList<OnsetComponent>();
9979      this.onset.add(t);
9980      return this;
9981    }
9982
9983    /**
9984     * @return {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
9985     */
9986    public Period getEmploymentImpacted() { 
9987      if (this.employmentImpacted == null)
9988        if (Configuration.errorOnAutoCreate())
9989          throw new Error("Attempt to auto-create ExplanationOfBenefit.employmentImpacted");
9990        else if (Configuration.doAutoCreate())
9991          this.employmentImpacted = new Period(); // cc
9992      return this.employmentImpacted;
9993    }
9994
9995    public boolean hasEmploymentImpacted() { 
9996      return this.employmentImpacted != null && !this.employmentImpacted.isEmpty();
9997    }
9998
9999    /**
10000     * @param value {@link #employmentImpacted} (The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).)
10001     */
10002    public ExplanationOfBenefit setEmploymentImpacted(Period value) { 
10003      this.employmentImpacted = value;
10004      return this;
10005    }
10006
10007    /**
10008     * @return {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
10009     */
10010    public Period getHospitalization() { 
10011      if (this.hospitalization == null)
10012        if (Configuration.errorOnAutoCreate())
10013          throw new Error("Attempt to auto-create ExplanationOfBenefit.hospitalization");
10014        else if (Configuration.doAutoCreate())
10015          this.hospitalization = new Period(); // cc
10016      return this.hospitalization;
10017    }
10018
10019    public boolean hasHospitalization() { 
10020      return this.hospitalization != null && !this.hospitalization.isEmpty();
10021    }
10022
10023    /**
10024     * @param value {@link #hospitalization} (The start and optional end dates of when the patient was confined to a treatment center.)
10025     */
10026    public ExplanationOfBenefit setHospitalization(Period value) { 
10027      this.hospitalization = value;
10028      return this;
10029    }
10030
10031    /**
10032     * @return {@link #item} (First tier of goods and services.)
10033     */
10034    public List<ItemsComponent> getItem() { 
10035      if (this.item == null)
10036        this.item = new ArrayList<ItemsComponent>();
10037      return this.item;
10038    }
10039
10040    public boolean hasItem() { 
10041      if (this.item == null)
10042        return false;
10043      for (ItemsComponent item : this.item)
10044        if (!item.isEmpty())
10045          return true;
10046      return false;
10047    }
10048
10049    /**
10050     * @return {@link #item} (First tier of goods and services.)
10051     */
10052    // syntactic sugar
10053    public ItemsComponent addItem() { //3
10054      ItemsComponent t = new ItemsComponent();
10055      if (this.item == null)
10056        this.item = new ArrayList<ItemsComponent>();
10057      this.item.add(t);
10058      return t;
10059    }
10060
10061    // syntactic sugar
10062    public ExplanationOfBenefit addItem(ItemsComponent t) { //3
10063      if (t == null)
10064        return this;
10065      if (this.item == null)
10066        this.item = new ArrayList<ItemsComponent>();
10067      this.item.add(t);
10068      return this;
10069    }
10070
10071    /**
10072     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
10073     */
10074    public List<AddedItemComponent> getAddItem() { 
10075      if (this.addItem == null)
10076        this.addItem = new ArrayList<AddedItemComponent>();
10077      return this.addItem;
10078    }
10079
10080    public boolean hasAddItem() { 
10081      if (this.addItem == null)
10082        return false;
10083      for (AddedItemComponent item : this.addItem)
10084        if (!item.isEmpty())
10085          return true;
10086      return false;
10087    }
10088
10089    /**
10090     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
10091     */
10092    // syntactic sugar
10093    public AddedItemComponent addAddItem() { //3
10094      AddedItemComponent t = new AddedItemComponent();
10095      if (this.addItem == null)
10096        this.addItem = new ArrayList<AddedItemComponent>();
10097      this.addItem.add(t);
10098      return t;
10099    }
10100
10101    // syntactic sugar
10102    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
10103      if (t == null)
10104        return this;
10105      if (this.addItem == null)
10106        this.addItem = new ArrayList<AddedItemComponent>();
10107      this.addItem.add(t);
10108      return this;
10109    }
10110
10111    /**
10112     * @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.)
10113     */
10114    public List<MissingTeethComponent> getMissingTeeth() { 
10115      if (this.missingTeeth == null)
10116        this.missingTeeth = new ArrayList<MissingTeethComponent>();
10117      return this.missingTeeth;
10118    }
10119
10120    public boolean hasMissingTeeth() { 
10121      if (this.missingTeeth == null)
10122        return false;
10123      for (MissingTeethComponent item : this.missingTeeth)
10124        if (!item.isEmpty())
10125          return true;
10126      return false;
10127    }
10128
10129    /**
10130     * @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.)
10131     */
10132    // syntactic sugar
10133    public MissingTeethComponent addMissingTeeth() { //3
10134      MissingTeethComponent t = new MissingTeethComponent();
10135      if (this.missingTeeth == null)
10136        this.missingTeeth = new ArrayList<MissingTeethComponent>();
10137      this.missingTeeth.add(t);
10138      return t;
10139    }
10140
10141    // syntactic sugar
10142    public ExplanationOfBenefit addMissingTeeth(MissingTeethComponent t) { //3
10143      if (t == null)
10144        return this;
10145      if (this.missingTeeth == null)
10146        this.missingTeeth = new ArrayList<MissingTeethComponent>();
10147      this.missingTeeth.add(t);
10148      return this;
10149    }
10150
10151    /**
10152     * @return {@link #totalCost} (The total cost of the services reported.)
10153     */
10154    public Money getTotalCost() { 
10155      if (this.totalCost == null)
10156        if (Configuration.errorOnAutoCreate())
10157          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalCost");
10158        else if (Configuration.doAutoCreate())
10159          this.totalCost = new Money(); // cc
10160      return this.totalCost;
10161    }
10162
10163    public boolean hasTotalCost() { 
10164      return this.totalCost != null && !this.totalCost.isEmpty();
10165    }
10166
10167    /**
10168     * @param value {@link #totalCost} (The total cost of the services reported.)
10169     */
10170    public ExplanationOfBenefit setTotalCost(Money value) { 
10171      this.totalCost = value;
10172      return this;
10173    }
10174
10175    /**
10176     * @return {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
10177     */
10178    public Money getUnallocDeductable() { 
10179      if (this.unallocDeductable == null)
10180        if (Configuration.errorOnAutoCreate())
10181          throw new Error("Attempt to auto-create ExplanationOfBenefit.unallocDeductable");
10182        else if (Configuration.doAutoCreate())
10183          this.unallocDeductable = new Money(); // cc
10184      return this.unallocDeductable;
10185    }
10186
10187    public boolean hasUnallocDeductable() { 
10188      return this.unallocDeductable != null && !this.unallocDeductable.isEmpty();
10189    }
10190
10191    /**
10192     * @param value {@link #unallocDeductable} (The amount of deductable applied which was not allocated to any particular service line.)
10193     */
10194    public ExplanationOfBenefit setUnallocDeductable(Money value) { 
10195      this.unallocDeductable = value;
10196      return this;
10197    }
10198
10199    /**
10200     * @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).)
10201     */
10202    public Money getTotalBenefit() { 
10203      if (this.totalBenefit == null)
10204        if (Configuration.errorOnAutoCreate())
10205          throw new Error("Attempt to auto-create ExplanationOfBenefit.totalBenefit");
10206        else if (Configuration.doAutoCreate())
10207          this.totalBenefit = new Money(); // cc
10208      return this.totalBenefit;
10209    }
10210
10211    public boolean hasTotalBenefit() { 
10212      return this.totalBenefit != null && !this.totalBenefit.isEmpty();
10213    }
10214
10215    /**
10216     * @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).)
10217     */
10218    public ExplanationOfBenefit setTotalBenefit(Money value) { 
10219      this.totalBenefit = value;
10220      return this;
10221    }
10222
10223    /**
10224     * @return {@link #paymentAdjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
10225     */
10226    public Money getPaymentAdjustment() { 
10227      if (this.paymentAdjustment == null)
10228        if (Configuration.errorOnAutoCreate())
10229          throw new Error("Attempt to auto-create ExplanationOfBenefit.paymentAdjustment");
10230        else if (Configuration.doAutoCreate())
10231          this.paymentAdjustment = new Money(); // cc
10232      return this.paymentAdjustment;
10233    }
10234
10235    public boolean hasPaymentAdjustment() { 
10236      return this.paymentAdjustment != null && !this.paymentAdjustment.isEmpty();
10237    }
10238
10239    /**
10240     * @param value {@link #paymentAdjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
10241     */
10242    public ExplanationOfBenefit setPaymentAdjustment(Money value) { 
10243      this.paymentAdjustment = value;
10244      return this;
10245    }
10246
10247    /**
10248     * @return {@link #paymentAdjustmentReason} (Reason for the payment adjustment.)
10249     */
10250    public Coding getPaymentAdjustmentReason() { 
10251      if (this.paymentAdjustmentReason == null)
10252        if (Configuration.errorOnAutoCreate())
10253          throw new Error("Attempt to auto-create ExplanationOfBenefit.paymentAdjustmentReason");
10254        else if (Configuration.doAutoCreate())
10255          this.paymentAdjustmentReason = new Coding(); // cc
10256      return this.paymentAdjustmentReason;
10257    }
10258
10259    public boolean hasPaymentAdjustmentReason() { 
10260      return this.paymentAdjustmentReason != null && !this.paymentAdjustmentReason.isEmpty();
10261    }
10262
10263    /**
10264     * @param value {@link #paymentAdjustmentReason} (Reason for the payment adjustment.)
10265     */
10266    public ExplanationOfBenefit setPaymentAdjustmentReason(Coding value) { 
10267      this.paymentAdjustmentReason = value;
10268      return this;
10269    }
10270
10271    /**
10272     * @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
10273     */
10274    public DateType getPaymentDateElement() { 
10275      if (this.paymentDate == null)
10276        if (Configuration.errorOnAutoCreate())
10277          throw new Error("Attempt to auto-create ExplanationOfBenefit.paymentDate");
10278        else if (Configuration.doAutoCreate())
10279          this.paymentDate = new DateType(); // bb
10280      return this.paymentDate;
10281    }
10282
10283    public boolean hasPaymentDateElement() { 
10284      return this.paymentDate != null && !this.paymentDate.isEmpty();
10285    }
10286
10287    public boolean hasPaymentDate() { 
10288      return this.paymentDate != null && !this.paymentDate.isEmpty();
10289    }
10290
10291    /**
10292     * @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
10293     */
10294    public ExplanationOfBenefit setPaymentDateElement(DateType value) { 
10295      this.paymentDate = value;
10296      return this;
10297    }
10298
10299    /**
10300     * @return Estimated payment data.
10301     */
10302    public Date getPaymentDate() { 
10303      return this.paymentDate == null ? null : this.paymentDate.getValue();
10304    }
10305
10306    /**
10307     * @param value Estimated payment data.
10308     */
10309    public ExplanationOfBenefit setPaymentDate(Date value) { 
10310      if (value == null)
10311        this.paymentDate = null;
10312      else {
10313        if (this.paymentDate == null)
10314          this.paymentDate = new DateType();
10315        this.paymentDate.setValue(value);
10316      }
10317      return this;
10318    }
10319
10320    /**
10321     * @return {@link #paymentAmount} (Payable less any payment adjustment.)
10322     */
10323    public Money getPaymentAmount() { 
10324      if (this.paymentAmount == null)
10325        if (Configuration.errorOnAutoCreate())
10326          throw new Error("Attempt to auto-create ExplanationOfBenefit.paymentAmount");
10327        else if (Configuration.doAutoCreate())
10328          this.paymentAmount = new Money(); // cc
10329      return this.paymentAmount;
10330    }
10331
10332    public boolean hasPaymentAmount() { 
10333      return this.paymentAmount != null && !this.paymentAmount.isEmpty();
10334    }
10335
10336    /**
10337     * @param value {@link #paymentAmount} (Payable less any payment adjustment.)
10338     */
10339    public ExplanationOfBenefit setPaymentAmount(Money value) { 
10340      this.paymentAmount = value;
10341      return this;
10342    }
10343
10344    /**
10345     * @return {@link #paymentRef} (Payment identifer.)
10346     */
10347    public Identifier getPaymentRef() { 
10348      if (this.paymentRef == null)
10349        if (Configuration.errorOnAutoCreate())
10350          throw new Error("Attempt to auto-create ExplanationOfBenefit.paymentRef");
10351        else if (Configuration.doAutoCreate())
10352          this.paymentRef = new Identifier(); // cc
10353      return this.paymentRef;
10354    }
10355
10356    public boolean hasPaymentRef() { 
10357      return this.paymentRef != null && !this.paymentRef.isEmpty();
10358    }
10359
10360    /**
10361     * @param value {@link #paymentRef} (Payment identifer.)
10362     */
10363    public ExplanationOfBenefit setPaymentRef(Identifier value) { 
10364      this.paymentRef = value;
10365      return this;
10366    }
10367
10368    /**
10369     * @return {@link #reserved} (Status of funds reservation (For provider, for Patient, None).)
10370     */
10371    public Coding getReserved() { 
10372      if (this.reserved == null)
10373        if (Configuration.errorOnAutoCreate())
10374          throw new Error("Attempt to auto-create ExplanationOfBenefit.reserved");
10375        else if (Configuration.doAutoCreate())
10376          this.reserved = new Coding(); // cc
10377      return this.reserved;
10378    }
10379
10380    public boolean hasReserved() { 
10381      return this.reserved != null && !this.reserved.isEmpty();
10382    }
10383
10384    /**
10385     * @param value {@link #reserved} (Status of funds reservation (For provider, for Patient, None).)
10386     */
10387    public ExplanationOfBenefit setReserved(Coding value) { 
10388      this.reserved = value;
10389      return this;
10390    }
10391
10392    /**
10393     * @return {@link #form} (The form to be used for printing the content.)
10394     */
10395    public Coding getForm() { 
10396      if (this.form == null)
10397        if (Configuration.errorOnAutoCreate())
10398          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
10399        else if (Configuration.doAutoCreate())
10400          this.form = new Coding(); // cc
10401      return this.form;
10402    }
10403
10404    public boolean hasForm() { 
10405      return this.form != null && !this.form.isEmpty();
10406    }
10407
10408    /**
10409     * @param value {@link #form} (The form to be used for printing the content.)
10410     */
10411    public ExplanationOfBenefit setForm(Coding value) { 
10412      this.form = value;
10413      return this;
10414    }
10415
10416    /**
10417     * @return {@link #note} (Note text.)
10418     */
10419    public List<NotesComponent> getNote() { 
10420      if (this.note == null)
10421        this.note = new ArrayList<NotesComponent>();
10422      return this.note;
10423    }
10424
10425    public boolean hasNote() { 
10426      if (this.note == null)
10427        return false;
10428      for (NotesComponent item : this.note)
10429        if (!item.isEmpty())
10430          return true;
10431      return false;
10432    }
10433
10434    /**
10435     * @return {@link #note} (Note text.)
10436     */
10437    // syntactic sugar
10438    public NotesComponent addNote() { //3
10439      NotesComponent t = new NotesComponent();
10440      if (this.note == null)
10441        this.note = new ArrayList<NotesComponent>();
10442      this.note.add(t);
10443      return t;
10444    }
10445
10446    // syntactic sugar
10447    public ExplanationOfBenefit addNote(NotesComponent t) { //3
10448      if (t == null)
10449        return this;
10450      if (this.note == null)
10451        this.note = new ArrayList<NotesComponent>();
10452      this.note.add(t);
10453      return this;
10454    }
10455
10456    /**
10457     * @return {@link #benefitBalance} (Balance by Benefit Category.)
10458     */
10459    public List<BenefitBalanceComponent> getBenefitBalance() { 
10460      if (this.benefitBalance == null)
10461        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
10462      return this.benefitBalance;
10463    }
10464
10465    public boolean hasBenefitBalance() { 
10466      if (this.benefitBalance == null)
10467        return false;
10468      for (BenefitBalanceComponent item : this.benefitBalance)
10469        if (!item.isEmpty())
10470          return true;
10471      return false;
10472    }
10473
10474    /**
10475     * @return {@link #benefitBalance} (Balance by Benefit Category.)
10476     */
10477    // syntactic sugar
10478    public BenefitBalanceComponent addBenefitBalance() { //3
10479      BenefitBalanceComponent t = new BenefitBalanceComponent();
10480      if (this.benefitBalance == null)
10481        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
10482      this.benefitBalance.add(t);
10483      return t;
10484    }
10485
10486    // syntactic sugar
10487    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
10488      if (t == null)
10489        return this;
10490      if (this.benefitBalance == null)
10491        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
10492      this.benefitBalance.add(t);
10493      return this;
10494    }
10495
10496      protected void listChildren(List<Property> childrenList) {
10497        super.listChildren(childrenList);
10498        childrenList.add(new Property("identifier", "Identifier", "The Response Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
10499        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));
10500        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));
10501        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));
10502        childrenList.add(new Property("ruleset", "Coding", "The version of the specification on which this instance relies.", 0, java.lang.Integer.MAX_VALUE, ruleset));
10503        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));
10504        childrenList.add(new Property("created", "dateTime", "The date when the EOB was created.", 0, java.lang.Integer.MAX_VALUE, created));
10505        childrenList.add(new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, java.lang.Integer.MAX_VALUE, billablePeriod));
10506        childrenList.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, java.lang.Integer.MAX_VALUE, disposition));
10507        childrenList.add(new Property("provider[x]", "Identifier|Reference(Practitioner)", "The provider which is responsible for the claim.", 0, java.lang.Integer.MAX_VALUE, provider));
10508        childrenList.add(new Property("organization[x]", "Identifier|Reference(Organization)", "The provider which is responsible for the claim.", 0, java.lang.Integer.MAX_VALUE, organization));
10509        childrenList.add(new Property("facility[x]", "Identifier|Reference(Location)", "Facility where the services were provided.", 0, java.lang.Integer.MAX_VALUE, facility));
10510        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));
10511        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));
10512        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));
10513        childrenList.add(new Property("payee", "", "The party to be reimbursed for the services.", 0, java.lang.Integer.MAX_VALUE, payee));
10514        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));
10515        childrenList.add(new Property("occurrenceCode", "Coding", "**Insert definition of Occurrence codes.", 0, java.lang.Integer.MAX_VALUE, occurrenceCode));
10516        childrenList.add(new Property("occurenceSpanCode", "Coding", "**Insert definition of Occurrence Span codes.", 0, java.lang.Integer.MAX_VALUE, occurenceSpanCode));
10517        childrenList.add(new Property("valueCode", "Coding", "**Insert definition of Value codes.", 0, java.lang.Integer.MAX_VALUE, valueCode));
10518        childrenList.add(new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
10519        childrenList.add(new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure));
10520        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));
10521        childrenList.add(new Property("patient[x]", "Identifier|Reference(Patient)", "Patient Resource.", 0, java.lang.Integer.MAX_VALUE, patient));
10522        childrenList.add(new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, java.lang.Integer.MAX_VALUE, precedence));
10523        childrenList.add(new Property("coverage", "", "Financial instrument by which payment information for health care.", 0, java.lang.Integer.MAX_VALUE, coverage));
10524        childrenList.add(new Property("accidentDate", "date", "Date of an accident which these services are addressing.", 0, java.lang.Integer.MAX_VALUE, accidentDate));
10525        childrenList.add(new Property("accidentType", "Coding", "Type of accident: work, auto, etc.", 0, java.lang.Integer.MAX_VALUE, accidentType));
10526        childrenList.add(new Property("accidentLocation[x]", "Address|Reference(Location)", "Accident Place.", 0, java.lang.Integer.MAX_VALUE, accidentLocation));
10527        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));
10528        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));
10529        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));
10530        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));
10531        childrenList.add(new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item));
10532        childrenList.add(new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem));
10533        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));
10534        childrenList.add(new Property("totalCost", "Money", "The total cost of the services reported.", 0, java.lang.Integer.MAX_VALUE, totalCost));
10535        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));
10536        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));
10537        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));
10538        childrenList.add(new Property("paymentAdjustmentReason", "Coding", "Reason for the payment adjustment.", 0, java.lang.Integer.MAX_VALUE, paymentAdjustmentReason));
10539        childrenList.add(new Property("paymentDate", "date", "Estimated payment data.", 0, java.lang.Integer.MAX_VALUE, paymentDate));
10540        childrenList.add(new Property("paymentAmount", "Money", "Payable less any payment adjustment.", 0, java.lang.Integer.MAX_VALUE, paymentAmount));
10541        childrenList.add(new Property("paymentRef", "Identifier", "Payment identifer.", 0, java.lang.Integer.MAX_VALUE, paymentRef));
10542        childrenList.add(new Property("reserved", "Coding", "Status of funds reservation (For provider, for Patient, None).", 0, java.lang.Integer.MAX_VALUE, reserved));
10543        childrenList.add(new Property("form", "Coding", "The form to be used for printing the content.", 0, java.lang.Integer.MAX_VALUE, form));
10544        childrenList.add(new Property("note", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, note));
10545        childrenList.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
10546      }
10547
10548      @Override
10549      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10550        switch (hash) {
10551        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
10552        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Type
10553        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Type
10554        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // Coding
10555        case 1548678118: /*ruleset*/ return this.ruleset == null ? new Base[0] : new Base[] {this.ruleset}; // Coding
10556        case 1089373397: /*originalRuleset*/ return this.originalRuleset == null ? new Base[0] : new Base[] {this.originalRuleset}; // Coding
10557        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
10558        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
10559        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
10560        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Type
10561        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Type
10562        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Type
10563        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimsComponent
10564        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Type
10565        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Type
10566        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
10567        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Type
10568        case 1721744222: /*occurrenceCode*/ return this.occurrenceCode == null ? new Base[0] : this.occurrenceCode.toArray(new Base[this.occurrenceCode.size()]); // Coding
10569        case -556690898: /*occurenceSpanCode*/ return this.occurenceSpanCode == null ? new Base[0] : this.occurenceSpanCode.toArray(new Base[this.occurenceSpanCode.size()]); // Coding
10570        case -766209282: /*valueCode*/ return this.valueCode == null ? new Base[0] : this.valueCode.toArray(new Base[this.valueCode.size()]); // Coding
10571        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
10572        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
10573        case -481489822: /*specialCondition*/ return this.specialCondition == null ? new Base[0] : this.specialCondition.toArray(new Base[this.specialCondition.size()]); // Coding
10574        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Type
10575        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
10576        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // CoverageComponent
10577        case -63170979: /*accidentDate*/ return this.accidentDate == null ? new Base[0] : new Base[] {this.accidentDate}; // DateType
10578        case -62671383: /*accidentType*/ return this.accidentType == null ? new Base[0] : new Base[] {this.accidentType}; // Coding
10579        case -1074014492: /*accidentLocation*/ return this.accidentLocation == null ? new Base[0] : new Base[] {this.accidentLocation}; // Type
10580        case 1753076536: /*interventionException*/ return this.interventionException == null ? new Base[0] : this.interventionException.toArray(new Base[this.interventionException.size()]); // Coding
10581        case 105901603: /*onset*/ return this.onset == null ? new Base[0] : this.onset.toArray(new Base[this.onset.size()]); // OnsetComponent
10582        case 1051487345: /*employmentImpacted*/ return this.employmentImpacted == null ? new Base[0] : new Base[] {this.employmentImpacted}; // Period
10583        case 1057894634: /*hospitalization*/ return this.hospitalization == null ? new Base[0] : new Base[] {this.hospitalization}; // Period
10584        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemsComponent
10585        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
10586        case -1157130302: /*missingTeeth*/ return this.missingTeeth == null ? new Base[0] : this.missingTeeth.toArray(new Base[this.missingTeeth.size()]); // MissingTeethComponent
10587        case -577782479: /*totalCost*/ return this.totalCost == null ? new Base[0] : new Base[] {this.totalCost}; // Money
10588        case 2096309753: /*unallocDeductable*/ return this.unallocDeductable == null ? new Base[0] : new Base[] {this.unallocDeductable}; // Money
10589        case 332332211: /*totalBenefit*/ return this.totalBenefit == null ? new Base[0] : new Base[] {this.totalBenefit}; // Money
10590        case 856402963: /*paymentAdjustment*/ return this.paymentAdjustment == null ? new Base[0] : new Base[] {this.paymentAdjustment}; // Money
10591        case -1386508233: /*paymentAdjustmentReason*/ return this.paymentAdjustmentReason == null ? new Base[0] : new Base[] {this.paymentAdjustmentReason}; // Coding
10592        case -1540873516: /*paymentDate*/ return this.paymentDate == null ? new Base[0] : new Base[] {this.paymentDate}; // DateType
10593        case 909332990: /*paymentAmount*/ return this.paymentAmount == null ? new Base[0] : new Base[] {this.paymentAmount}; // Money
10594        case 1612875949: /*paymentRef*/ return this.paymentRef == null ? new Base[0] : new Base[] {this.paymentRef}; // Identifier
10595        case -350385368: /*reserved*/ return this.reserved == null ? new Base[0] : new Base[] {this.reserved}; // Coding
10596        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Coding
10597        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // NotesComponent
10598        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
10599        default: return super.getProperty(hash, name, checkValid);
10600        }
10601
10602      }
10603
10604      @Override
10605      public void setProperty(int hash, String name, Base value) throws FHIRException {
10606        switch (hash) {
10607        case -1618432855: // identifier
10608          this.getIdentifier().add(castToIdentifier(value)); // Identifier
10609          break;
10610        case 94742588: // claim
10611          this.claim = (Type) value; // Type
10612          break;
10613        case 689513629: // claimResponse
10614          this.claimResponse = (Type) value; // Type
10615          break;
10616        case -1868521062: // subType
10617          this.getSubType().add(castToCoding(value)); // Coding
10618          break;
10619        case 1548678118: // ruleset
10620          this.ruleset = castToCoding(value); // Coding
10621          break;
10622        case 1089373397: // originalRuleset
10623          this.originalRuleset = castToCoding(value); // Coding
10624          break;
10625        case 1028554472: // created
10626          this.created = castToDateTime(value); // DateTimeType
10627          break;
10628        case -332066046: // billablePeriod
10629          this.billablePeriod = castToPeriod(value); // Period
10630          break;
10631        case 583380919: // disposition
10632          this.disposition = castToString(value); // StringType
10633          break;
10634        case -987494927: // provider
10635          this.provider = (Type) value; // Type
10636          break;
10637        case 1178922291: // organization
10638          this.organization = (Type) value; // Type
10639          break;
10640        case 501116579: // facility
10641          this.facility = (Type) value; // Type
10642          break;
10643        case 1090493483: // related
10644          this.getRelated().add((RelatedClaimsComponent) value); // RelatedClaimsComponent
10645          break;
10646        case 460301338: // prescription
10647          this.prescription = (Type) value; // Type
10648          break;
10649        case -1814015861: // originalPrescription
10650          this.originalPrescription = (Type) value; // Type
10651          break;
10652        case 106443592: // payee
10653          this.payee = (PayeeComponent) value; // PayeeComponent
10654          break;
10655        case -722568291: // referral
10656          this.referral = (Type) value; // Type
10657          break;
10658        case 1721744222: // occurrenceCode
10659          this.getOccurrenceCode().add(castToCoding(value)); // Coding
10660          break;
10661        case -556690898: // occurenceSpanCode
10662          this.getOccurenceSpanCode().add(castToCoding(value)); // Coding
10663          break;
10664        case -766209282: // valueCode
10665          this.getValueCode().add(castToCoding(value)); // Coding
10666          break;
10667        case 1196993265: // diagnosis
10668          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
10669          break;
10670        case -1095204141: // procedure
10671          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
10672          break;
10673        case -481489822: // specialCondition
10674          this.getSpecialCondition().add(castToCoding(value)); // Coding
10675          break;
10676        case -791418107: // patient
10677          this.patient = (Type) value; // Type
10678          break;
10679        case 159695370: // precedence
10680          this.precedence = castToPositiveInt(value); // PositiveIntType
10681          break;
10682        case -351767064: // coverage
10683          this.coverage = (CoverageComponent) value; // CoverageComponent
10684          break;
10685        case -63170979: // accidentDate
10686          this.accidentDate = castToDate(value); // DateType
10687          break;
10688        case -62671383: // accidentType
10689          this.accidentType = castToCoding(value); // Coding
10690          break;
10691        case -1074014492: // accidentLocation
10692          this.accidentLocation = (Type) value; // Type
10693          break;
10694        case 1753076536: // interventionException
10695          this.getInterventionException().add(castToCoding(value)); // Coding
10696          break;
10697        case 105901603: // onset
10698          this.getOnset().add((OnsetComponent) value); // OnsetComponent
10699          break;
10700        case 1051487345: // employmentImpacted
10701          this.employmentImpacted = castToPeriod(value); // Period
10702          break;
10703        case 1057894634: // hospitalization
10704          this.hospitalization = castToPeriod(value); // Period
10705          break;
10706        case 3242771: // item
10707          this.getItem().add((ItemsComponent) value); // ItemsComponent
10708          break;
10709        case -1148899500: // addItem
10710          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
10711          break;
10712        case -1157130302: // missingTeeth
10713          this.getMissingTeeth().add((MissingTeethComponent) value); // MissingTeethComponent
10714          break;
10715        case -577782479: // totalCost
10716          this.totalCost = castToMoney(value); // Money
10717          break;
10718        case 2096309753: // unallocDeductable
10719          this.unallocDeductable = castToMoney(value); // Money
10720          break;
10721        case 332332211: // totalBenefit
10722          this.totalBenefit = castToMoney(value); // Money
10723          break;
10724        case 856402963: // paymentAdjustment
10725          this.paymentAdjustment = castToMoney(value); // Money
10726          break;
10727        case -1386508233: // paymentAdjustmentReason
10728          this.paymentAdjustmentReason = castToCoding(value); // Coding
10729          break;
10730        case -1540873516: // paymentDate
10731          this.paymentDate = castToDate(value); // DateType
10732          break;
10733        case 909332990: // paymentAmount
10734          this.paymentAmount = castToMoney(value); // Money
10735          break;
10736        case 1612875949: // paymentRef
10737          this.paymentRef = castToIdentifier(value); // Identifier
10738          break;
10739        case -350385368: // reserved
10740          this.reserved = castToCoding(value); // Coding
10741          break;
10742        case 3148996: // form
10743          this.form = castToCoding(value); // Coding
10744          break;
10745        case 3387378: // note
10746          this.getNote().add((NotesComponent) value); // NotesComponent
10747          break;
10748        case 596003397: // benefitBalance
10749          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
10750          break;
10751        default: super.setProperty(hash, name, value);
10752        }
10753
10754      }
10755
10756      @Override
10757      public void setProperty(String name, Base value) throws FHIRException {
10758        if (name.equals("identifier"))
10759          this.getIdentifier().add(castToIdentifier(value));
10760        else if (name.equals("claim[x]"))
10761          this.claim = (Type) value; // Type
10762        else if (name.equals("claimResponse[x]"))
10763          this.claimResponse = (Type) value; // Type
10764        else if (name.equals("subType"))
10765          this.getSubType().add(castToCoding(value));
10766        else if (name.equals("ruleset"))
10767          this.ruleset = castToCoding(value); // Coding
10768        else if (name.equals("originalRuleset"))
10769          this.originalRuleset = castToCoding(value); // Coding
10770        else if (name.equals("created"))
10771          this.created = castToDateTime(value); // DateTimeType
10772        else if (name.equals("billablePeriod"))
10773          this.billablePeriod = castToPeriod(value); // Period
10774        else if (name.equals("disposition"))
10775          this.disposition = castToString(value); // StringType
10776        else if (name.equals("provider[x]"))
10777          this.provider = (Type) value; // Type
10778        else if (name.equals("organization[x]"))
10779          this.organization = (Type) value; // Type
10780        else if (name.equals("facility[x]"))
10781          this.facility = (Type) value; // Type
10782        else if (name.equals("related"))
10783          this.getRelated().add((RelatedClaimsComponent) value);
10784        else if (name.equals("prescription[x]"))
10785          this.prescription = (Type) value; // Type
10786        else if (name.equals("originalPrescription[x]"))
10787          this.originalPrescription = (Type) value; // Type
10788        else if (name.equals("payee"))
10789          this.payee = (PayeeComponent) value; // PayeeComponent
10790        else if (name.equals("referral[x]"))
10791          this.referral = (Type) value; // Type
10792        else if (name.equals("occurrenceCode"))
10793          this.getOccurrenceCode().add(castToCoding(value));
10794        else if (name.equals("occurenceSpanCode"))
10795          this.getOccurenceSpanCode().add(castToCoding(value));
10796        else if (name.equals("valueCode"))
10797          this.getValueCode().add(castToCoding(value));
10798        else if (name.equals("diagnosis"))
10799          this.getDiagnosis().add((DiagnosisComponent) value);
10800        else if (name.equals("procedure"))
10801          this.getProcedure().add((ProcedureComponent) value);
10802        else if (name.equals("specialCondition"))
10803          this.getSpecialCondition().add(castToCoding(value));
10804        else if (name.equals("patient[x]"))
10805          this.patient = (Type) value; // Type
10806        else if (name.equals("precedence"))
10807          this.precedence = castToPositiveInt(value); // PositiveIntType
10808        else if (name.equals("coverage"))
10809          this.coverage = (CoverageComponent) value; // CoverageComponent
10810        else if (name.equals("accidentDate"))
10811          this.accidentDate = castToDate(value); // DateType
10812        else if (name.equals("accidentType"))
10813          this.accidentType = castToCoding(value); // Coding
10814        else if (name.equals("accidentLocation[x]"))
10815          this.accidentLocation = (Type) value; // Type
10816        else if (name.equals("interventionException"))
10817          this.getInterventionException().add(castToCoding(value));
10818        else if (name.equals("onset"))
10819          this.getOnset().add((OnsetComponent) value);
10820        else if (name.equals("employmentImpacted"))
10821          this.employmentImpacted = castToPeriod(value); // Period
10822        else if (name.equals("hospitalization"))
10823          this.hospitalization = castToPeriod(value); // Period
10824        else if (name.equals("item"))
10825          this.getItem().add((ItemsComponent) value);
10826        else if (name.equals("addItem"))
10827          this.getAddItem().add((AddedItemComponent) value);
10828        else if (name.equals("missingTeeth"))
10829          this.getMissingTeeth().add((MissingTeethComponent) value);
10830        else if (name.equals("totalCost"))
10831          this.totalCost = castToMoney(value); // Money
10832        else if (name.equals("unallocDeductable"))
10833          this.unallocDeductable = castToMoney(value); // Money
10834        else if (name.equals("totalBenefit"))
10835          this.totalBenefit = castToMoney(value); // Money
10836        else if (name.equals("paymentAdjustment"))
10837          this.paymentAdjustment = castToMoney(value); // Money
10838        else if (name.equals("paymentAdjustmentReason"))
10839          this.paymentAdjustmentReason = castToCoding(value); // Coding
10840        else if (name.equals("paymentDate"))
10841          this.paymentDate = castToDate(value); // DateType
10842        else if (name.equals("paymentAmount"))
10843          this.paymentAmount = castToMoney(value); // Money
10844        else if (name.equals("paymentRef"))
10845          this.paymentRef = castToIdentifier(value); // Identifier
10846        else if (name.equals("reserved"))
10847          this.reserved = castToCoding(value); // Coding
10848        else if (name.equals("form"))
10849          this.form = castToCoding(value); // Coding
10850        else if (name.equals("note"))
10851          this.getNote().add((NotesComponent) value);
10852        else if (name.equals("benefitBalance"))
10853          this.getBenefitBalance().add((BenefitBalanceComponent) value);
10854        else
10855          super.setProperty(name, value);
10856      }
10857
10858      @Override
10859      public Base makeProperty(int hash, String name) throws FHIRException {
10860        switch (hash) {
10861        case -1618432855:  return addIdentifier(); // Identifier
10862        case 683016900:  return getClaim(); // Type
10863        case -1527963965:  return getClaimResponse(); // Type
10864        case -1868521062:  return addSubType(); // Coding
10865        case 1548678118:  return getRuleset(); // Coding
10866        case 1089373397:  return getOriginalRuleset(); // Coding
10867        case 1028554472: throw new FHIRException("Cannot make property created as it is not a complex type"); // DateTimeType
10868        case -332066046:  return getBillablePeriod(); // Period
10869        case 583380919: throw new FHIRException("Cannot make property disposition as it is not a complex type"); // StringType
10870        case 2064698607:  return getProvider(); // Type
10871        case 1326483053:  return getOrganization(); // Type
10872        case -542224643:  return getFacility(); // Type
10873        case 1090493483:  return addRelated(); // RelatedClaimsComponent
10874        case -993324506:  return getPrescription(); // Type
10875        case -2067905515:  return getOriginalPrescription(); // Type
10876        case 106443592:  return getPayee(); // PayeeComponent
10877        case 344221635:  return getReferral(); // Type
10878        case 1721744222:  return addOccurrenceCode(); // Coding
10879        case -556690898:  return addOccurenceSpanCode(); // Coding
10880        case -766209282:  return addValueCode(); // Coding
10881        case 1196993265:  return addDiagnosis(); // DiagnosisComponent
10882        case -1095204141:  return addProcedure(); // ProcedureComponent
10883        case -481489822:  return addSpecialCondition(); // Coding
10884        case -2061246629:  return getPatient(); // Type
10885        case 159695370: throw new FHIRException("Cannot make property precedence as it is not a complex type"); // PositiveIntType
10886        case -351767064:  return getCoverage(); // CoverageComponent
10887        case -63170979: throw new FHIRException("Cannot make property accidentDate as it is not a complex type"); // DateType
10888        case -62671383:  return getAccidentType(); // Coding
10889        case 1540715292:  return getAccidentLocation(); // Type
10890        case 1753076536:  return addInterventionException(); // Coding
10891        case 105901603:  return addOnset(); // OnsetComponent
10892        case 1051487345:  return getEmploymentImpacted(); // Period
10893        case 1057894634:  return getHospitalization(); // Period
10894        case 3242771:  return addItem(); // ItemsComponent
10895        case -1148899500:  return addAddItem(); // AddedItemComponent
10896        case -1157130302:  return addMissingTeeth(); // MissingTeethComponent
10897        case -577782479:  return getTotalCost(); // Money
10898        case 2096309753:  return getUnallocDeductable(); // Money
10899        case 332332211:  return getTotalBenefit(); // Money
10900        case 856402963:  return getPaymentAdjustment(); // Money
10901        case -1386508233:  return getPaymentAdjustmentReason(); // Coding
10902        case -1540873516: throw new FHIRException("Cannot make property paymentDate as it is not a complex type"); // DateType
10903        case 909332990:  return getPaymentAmount(); // Money
10904        case 1612875949:  return getPaymentRef(); // Identifier
10905        case -350385368:  return getReserved(); // Coding
10906        case 3148996:  return getForm(); // Coding
10907        case 3387378:  return addNote(); // NotesComponent
10908        case 596003397:  return addBenefitBalance(); // BenefitBalanceComponent
10909        default: return super.makeProperty(hash, name);
10910        }
10911
10912      }
10913
10914      @Override
10915      public Base addChild(String name) throws FHIRException {
10916        if (name.equals("identifier")) {
10917          return addIdentifier();
10918        }
10919        else if (name.equals("claimIdentifier")) {
10920          this.claim = new Identifier();
10921          return this.claim;
10922        }
10923        else if (name.equals("claimReference")) {
10924          this.claim = new Reference();
10925          return this.claim;
10926        }
10927        else if (name.equals("claimResponseIdentifier")) {
10928          this.claimResponse = new Identifier();
10929          return this.claimResponse;
10930        }
10931        else if (name.equals("claimResponseReference")) {
10932          this.claimResponse = new Reference();
10933          return this.claimResponse;
10934        }
10935        else if (name.equals("subType")) {
10936          return addSubType();
10937        }
10938        else if (name.equals("ruleset")) {
10939          this.ruleset = new Coding();
10940          return this.ruleset;
10941        }
10942        else if (name.equals("originalRuleset")) {
10943          this.originalRuleset = new Coding();
10944          return this.originalRuleset;
10945        }
10946        else if (name.equals("created")) {
10947          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
10948        }
10949        else if (name.equals("billablePeriod")) {
10950          this.billablePeriod = new Period();
10951          return this.billablePeriod;
10952        }
10953        else if (name.equals("disposition")) {
10954          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
10955        }
10956        else if (name.equals("providerIdentifier")) {
10957          this.provider = new Identifier();
10958          return this.provider;
10959        }
10960        else if (name.equals("providerReference")) {
10961          this.provider = new Reference();
10962          return this.provider;
10963        }
10964        else if (name.equals("organizationIdentifier")) {
10965          this.organization = new Identifier();
10966          return this.organization;
10967        }
10968        else if (name.equals("organizationReference")) {
10969          this.organization = new Reference();
10970          return this.organization;
10971        }
10972        else if (name.equals("facilityIdentifier")) {
10973          this.facility = new Identifier();
10974          return this.facility;
10975        }
10976        else if (name.equals("facilityReference")) {
10977          this.facility = new Reference();
10978          return this.facility;
10979        }
10980        else if (name.equals("related")) {
10981          return addRelated();
10982        }
10983        else if (name.equals("prescriptionIdentifier")) {
10984          this.prescription = new Identifier();
10985          return this.prescription;
10986        }
10987        else if (name.equals("prescriptionReference")) {
10988          this.prescription = new Reference();
10989          return this.prescription;
10990        }
10991        else if (name.equals("originalPrescriptionIdentifier")) {
10992          this.originalPrescription = new Identifier();
10993          return this.originalPrescription;
10994        }
10995        else if (name.equals("originalPrescriptionReference")) {
10996          this.originalPrescription = new Reference();
10997          return this.originalPrescription;
10998        }
10999        else if (name.equals("payee")) {
11000          this.payee = new PayeeComponent();
11001          return this.payee;
11002        }
11003        else if (name.equals("referralIdentifier")) {
11004          this.referral = new Identifier();
11005          return this.referral;
11006        }
11007        else if (name.equals("referralReference")) {
11008          this.referral = new Reference();
11009          return this.referral;
11010        }
11011        else if (name.equals("occurrenceCode")) {
11012          return addOccurrenceCode();
11013        }
11014        else if (name.equals("occurenceSpanCode")) {
11015          return addOccurenceSpanCode();
11016        }
11017        else if (name.equals("valueCode")) {
11018          return addValueCode();
11019        }
11020        else if (name.equals("diagnosis")) {
11021          return addDiagnosis();
11022        }
11023        else if (name.equals("procedure")) {
11024          return addProcedure();
11025        }
11026        else if (name.equals("specialCondition")) {
11027          return addSpecialCondition();
11028        }
11029        else if (name.equals("patientIdentifier")) {
11030          this.patient = new Identifier();
11031          return this.patient;
11032        }
11033        else if (name.equals("patientReference")) {
11034          this.patient = new Reference();
11035          return this.patient;
11036        }
11037        else if (name.equals("precedence")) {
11038          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
11039        }
11040        else if (name.equals("coverage")) {
11041          this.coverage = new CoverageComponent();
11042          return this.coverage;
11043        }
11044        else if (name.equals("accidentDate")) {
11045          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.accidentDate");
11046        }
11047        else if (name.equals("accidentType")) {
11048          this.accidentType = new Coding();
11049          return this.accidentType;
11050        }
11051        else if (name.equals("accidentLocationAddress")) {
11052          this.accidentLocation = new Address();
11053          return this.accidentLocation;
11054        }
11055        else if (name.equals("accidentLocationReference")) {
11056          this.accidentLocation = new Reference();
11057          return this.accidentLocation;
11058        }
11059        else if (name.equals("interventionException")) {
11060          return addInterventionException();
11061        }
11062        else if (name.equals("onset")) {
11063          return addOnset();
11064        }
11065        else if (name.equals("employmentImpacted")) {
11066          this.employmentImpacted = new Period();
11067          return this.employmentImpacted;
11068        }
11069        else if (name.equals("hospitalization")) {
11070          this.hospitalization = new Period();
11071          return this.hospitalization;
11072        }
11073        else if (name.equals("item")) {
11074          return addItem();
11075        }
11076        else if (name.equals("addItem")) {
11077          return addAddItem();
11078        }
11079        else if (name.equals("missingTeeth")) {
11080          return addMissingTeeth();
11081        }
11082        else if (name.equals("totalCost")) {
11083          this.totalCost = new Money();
11084          return this.totalCost;
11085        }
11086        else if (name.equals("unallocDeductable")) {
11087          this.unallocDeductable = new Money();
11088          return this.unallocDeductable;
11089        }
11090        else if (name.equals("totalBenefit")) {
11091          this.totalBenefit = new Money();
11092          return this.totalBenefit;
11093        }
11094        else if (name.equals("paymentAdjustment")) {
11095          this.paymentAdjustment = new Money();
11096          return this.paymentAdjustment;
11097        }
11098        else if (name.equals("paymentAdjustmentReason")) {
11099          this.paymentAdjustmentReason = new Coding();
11100          return this.paymentAdjustmentReason;
11101        }
11102        else if (name.equals("paymentDate")) {
11103          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.paymentDate");
11104        }
11105        else if (name.equals("paymentAmount")) {
11106          this.paymentAmount = new Money();
11107          return this.paymentAmount;
11108        }
11109        else if (name.equals("paymentRef")) {
11110          this.paymentRef = new Identifier();
11111          return this.paymentRef;
11112        }
11113        else if (name.equals("reserved")) {
11114          this.reserved = new Coding();
11115          return this.reserved;
11116        }
11117        else if (name.equals("form")) {
11118          this.form = new Coding();
11119          return this.form;
11120        }
11121        else if (name.equals("note")) {
11122          return addNote();
11123        }
11124        else if (name.equals("benefitBalance")) {
11125          return addBenefitBalance();
11126        }
11127        else
11128          return super.addChild(name);
11129      }
11130
11131  public String fhirType() {
11132    return "ExplanationOfBenefit";
11133
11134  }
11135
11136      public ExplanationOfBenefit copy() {
11137        ExplanationOfBenefit dst = new ExplanationOfBenefit();
11138        copyValues(dst);
11139        if (identifier != null) {
11140          dst.identifier = new ArrayList<Identifier>();
11141          for (Identifier i : identifier)
11142            dst.identifier.add(i.copy());
11143        };
11144        dst.claim = claim == null ? null : claim.copy();
11145        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
11146        if (subType != null) {
11147          dst.subType = new ArrayList<Coding>();
11148          for (Coding i : subType)
11149            dst.subType.add(i.copy());
11150        };
11151        dst.ruleset = ruleset == null ? null : ruleset.copy();
11152        dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
11153        dst.created = created == null ? null : created.copy();
11154        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
11155        dst.disposition = disposition == null ? null : disposition.copy();
11156        dst.provider = provider == null ? null : provider.copy();
11157        dst.organization = organization == null ? null : organization.copy();
11158        dst.facility = facility == null ? null : facility.copy();
11159        if (related != null) {
11160          dst.related = new ArrayList<RelatedClaimsComponent>();
11161          for (RelatedClaimsComponent i : related)
11162            dst.related.add(i.copy());
11163        };
11164        dst.prescription = prescription == null ? null : prescription.copy();
11165        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
11166        dst.payee = payee == null ? null : payee.copy();
11167        dst.referral = referral == null ? null : referral.copy();
11168        if (occurrenceCode != null) {
11169          dst.occurrenceCode = new ArrayList<Coding>();
11170          for (Coding i : occurrenceCode)
11171            dst.occurrenceCode.add(i.copy());
11172        };
11173        if (occurenceSpanCode != null) {
11174          dst.occurenceSpanCode = new ArrayList<Coding>();
11175          for (Coding i : occurenceSpanCode)
11176            dst.occurenceSpanCode.add(i.copy());
11177        };
11178        if (valueCode != null) {
11179          dst.valueCode = new ArrayList<Coding>();
11180          for (Coding i : valueCode)
11181            dst.valueCode.add(i.copy());
11182        };
11183        if (diagnosis != null) {
11184          dst.diagnosis = new ArrayList<DiagnosisComponent>();
11185          for (DiagnosisComponent i : diagnosis)
11186            dst.diagnosis.add(i.copy());
11187        };
11188        if (procedure != null) {
11189          dst.procedure = new ArrayList<ProcedureComponent>();
11190          for (ProcedureComponent i : procedure)
11191            dst.procedure.add(i.copy());
11192        };
11193        if (specialCondition != null) {
11194          dst.specialCondition = new ArrayList<Coding>();
11195          for (Coding i : specialCondition)
11196            dst.specialCondition.add(i.copy());
11197        };
11198        dst.patient = patient == null ? null : patient.copy();
11199        dst.precedence = precedence == null ? null : precedence.copy();
11200        dst.coverage = coverage == null ? null : coverage.copy();
11201        dst.accidentDate = accidentDate == null ? null : accidentDate.copy();
11202        dst.accidentType = accidentType == null ? null : accidentType.copy();
11203        dst.accidentLocation = accidentLocation == null ? null : accidentLocation.copy();
11204        if (interventionException != null) {
11205          dst.interventionException = new ArrayList<Coding>();
11206          for (Coding i : interventionException)
11207            dst.interventionException.add(i.copy());
11208        };
11209        if (onset != null) {
11210          dst.onset = new ArrayList<OnsetComponent>();
11211          for (OnsetComponent i : onset)
11212            dst.onset.add(i.copy());
11213        };
11214        dst.employmentImpacted = employmentImpacted == null ? null : employmentImpacted.copy();
11215        dst.hospitalization = hospitalization == null ? null : hospitalization.copy();
11216        if (item != null) {
11217          dst.item = new ArrayList<ItemsComponent>();
11218          for (ItemsComponent i : item)
11219            dst.item.add(i.copy());
11220        };
11221        if (addItem != null) {
11222          dst.addItem = new ArrayList<AddedItemComponent>();
11223          for (AddedItemComponent i : addItem)
11224            dst.addItem.add(i.copy());
11225        };
11226        if (missingTeeth != null) {
11227          dst.missingTeeth = new ArrayList<MissingTeethComponent>();
11228          for (MissingTeethComponent i : missingTeeth)
11229            dst.missingTeeth.add(i.copy());
11230        };
11231        dst.totalCost = totalCost == null ? null : totalCost.copy();
11232        dst.unallocDeductable = unallocDeductable == null ? null : unallocDeductable.copy();
11233        dst.totalBenefit = totalBenefit == null ? null : totalBenefit.copy();
11234        dst.paymentAdjustment = paymentAdjustment == null ? null : paymentAdjustment.copy();
11235        dst.paymentAdjustmentReason = paymentAdjustmentReason == null ? null : paymentAdjustmentReason.copy();
11236        dst.paymentDate = paymentDate == null ? null : paymentDate.copy();
11237        dst.paymentAmount = paymentAmount == null ? null : paymentAmount.copy();
11238        dst.paymentRef = paymentRef == null ? null : paymentRef.copy();
11239        dst.reserved = reserved == null ? null : reserved.copy();
11240        dst.form = form == null ? null : form.copy();
11241        if (note != null) {
11242          dst.note = new ArrayList<NotesComponent>();
11243          for (NotesComponent i : note)
11244            dst.note.add(i.copy());
11245        };
11246        if (benefitBalance != null) {
11247          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
11248          for (BenefitBalanceComponent i : benefitBalance)
11249            dst.benefitBalance.add(i.copy());
11250        };
11251        return dst;
11252      }
11253
11254      protected ExplanationOfBenefit typedCopy() {
11255        return copy();
11256      }
11257
11258      @Override
11259      public boolean equalsDeep(Base other) {
11260        if (!super.equalsDeep(other))
11261          return false;
11262        if (!(other instanceof ExplanationOfBenefit))
11263          return false;
11264        ExplanationOfBenefit o = (ExplanationOfBenefit) other;
11265        return compareDeep(identifier, o.identifier, true) && compareDeep(claim, o.claim, true) && compareDeep(claimResponse, o.claimResponse, true)
11266           && compareDeep(subType, o.subType, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
11267           && compareDeep(created, o.created, true) && compareDeep(billablePeriod, o.billablePeriod, true)
11268           && compareDeep(disposition, o.disposition, true) && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true)
11269           && compareDeep(facility, o.facility, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
11270           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
11271           && compareDeep(referral, o.referral, true) && compareDeep(occurrenceCode, o.occurrenceCode, true)
11272           && compareDeep(occurenceSpanCode, o.occurenceSpanCode, true) && compareDeep(valueCode, o.valueCode, true)
11273           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(specialCondition, o.specialCondition, true)
11274           && compareDeep(patient, o.patient, true) && compareDeep(precedence, o.precedence, true) && compareDeep(coverage, o.coverage, true)
11275           && compareDeep(accidentDate, o.accidentDate, true) && compareDeep(accidentType, o.accidentType, true)
11276           && compareDeep(accidentLocation, o.accidentLocation, true) && compareDeep(interventionException, o.interventionException, true)
11277           && compareDeep(onset, o.onset, true) && compareDeep(employmentImpacted, o.employmentImpacted, true)
11278           && compareDeep(hospitalization, o.hospitalization, true) && compareDeep(item, o.item, true) && compareDeep(addItem, o.addItem, true)
11279           && compareDeep(missingTeeth, o.missingTeeth, true) && compareDeep(totalCost, o.totalCost, true)
11280           && compareDeep(unallocDeductable, o.unallocDeductable, true) && compareDeep(totalBenefit, o.totalBenefit, true)
11281           && compareDeep(paymentAdjustment, o.paymentAdjustment, true) && compareDeep(paymentAdjustmentReason, o.paymentAdjustmentReason, true)
11282           && compareDeep(paymentDate, o.paymentDate, true) && compareDeep(paymentAmount, o.paymentAmount, true)
11283           && compareDeep(paymentRef, o.paymentRef, true) && compareDeep(reserved, o.reserved, true) && compareDeep(form, o.form, true)
11284           && compareDeep(note, o.note, true) && compareDeep(benefitBalance, o.benefitBalance, true);
11285      }
11286
11287      @Override
11288      public boolean equalsShallow(Base other) {
11289        if (!super.equalsShallow(other))
11290          return false;
11291        if (!(other instanceof ExplanationOfBenefit))
11292          return false;
11293        ExplanationOfBenefit o = (ExplanationOfBenefit) other;
11294        return compareValues(created, o.created, true) && compareValues(disposition, o.disposition, true) && compareValues(precedence, o.precedence, true)
11295           && compareValues(accidentDate, o.accidentDate, true) && compareValues(paymentDate, o.paymentDate, true)
11296          ;
11297      }
11298
11299      public boolean isEmpty() {
11300        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (claim == null || claim.isEmpty())
11301           && (claimResponse == null || claimResponse.isEmpty()) && (subType == null || subType.isEmpty())
11302           && (ruleset == null || ruleset.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
11303           && (created == null || created.isEmpty()) && (billablePeriod == null || billablePeriod.isEmpty())
11304           && (disposition == null || disposition.isEmpty()) && (provider == null || provider.isEmpty())
11305           && (organization == null || organization.isEmpty()) && (facility == null || facility.isEmpty())
11306           && (related == null || related.isEmpty()) && (prescription == null || prescription.isEmpty())
11307           && (originalPrescription == null || originalPrescription.isEmpty()) && (payee == null || payee.isEmpty())
11308           && (referral == null || referral.isEmpty()) && (occurrenceCode == null || occurrenceCode.isEmpty())
11309           && (occurenceSpanCode == null || occurenceSpanCode.isEmpty()) && (valueCode == null || valueCode.isEmpty())
11310           && (diagnosis == null || diagnosis.isEmpty()) && (procedure == null || procedure.isEmpty())
11311           && (specialCondition == null || specialCondition.isEmpty()) && (patient == null || patient.isEmpty())
11312           && (precedence == null || precedence.isEmpty()) && (coverage == null || coverage.isEmpty())
11313           && (accidentDate == null || accidentDate.isEmpty()) && (accidentType == null || accidentType.isEmpty())
11314           && (accidentLocation == null || accidentLocation.isEmpty()) && (interventionException == null || interventionException.isEmpty())
11315           && (onset == null || onset.isEmpty()) && (employmentImpacted == null || employmentImpacted.isEmpty())
11316           && (hospitalization == null || hospitalization.isEmpty()) && (item == null || item.isEmpty())
11317           && (addItem == null || addItem.isEmpty()) && (missingTeeth == null || missingTeeth.isEmpty())
11318           && (totalCost == null || totalCost.isEmpty()) && (unallocDeductable == null || unallocDeductable.isEmpty())
11319           && (totalBenefit == null || totalBenefit.isEmpty()) && (paymentAdjustment == null || paymentAdjustment.isEmpty())
11320           && (paymentAdjustmentReason == null || paymentAdjustmentReason.isEmpty()) && (paymentDate == null || paymentDate.isEmpty())
11321           && (paymentAmount == null || paymentAmount.isEmpty()) && (paymentRef == null || paymentRef.isEmpty())
11322           && (reserved == null || reserved.isEmpty()) && (form == null || form.isEmpty()) && (note == null || note.isEmpty())
11323           && (benefitBalance == null || benefitBalance.isEmpty());
11324      }
11325
11326  @Override
11327  public ResourceType getResourceType() {
11328    return ResourceType.ExplanationOfBenefit;
11329   }
11330
11331 /**
11332   * Search parameter: <b>patientidentifier</b>
11333   * <p>
11334   * Description: <b>The reference to the patient</b><br>
11335   * Type: <b>token</b><br>
11336   * Path: <b>ExplanationOfBenefit.patientIdentifier</b><br>
11337   * </p>
11338   */
11339  @SearchParamDefinition(name="patientidentifier", path="ExplanationOfBenefit.patient.as(Identifier)", description="The reference to the patient", type="token" )
11340  public static final String SP_PATIENTIDENTIFIER = "patientidentifier";
11341 /**
11342   * <b>Fluent Client</b> search parameter constant for <b>patientidentifier</b>
11343   * <p>
11344   * Description: <b>The reference to the patient</b><br>
11345   * Type: <b>token</b><br>
11346   * Path: <b>ExplanationOfBenefit.patientIdentifier</b><br>
11347   * </p>
11348   */
11349  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PATIENTIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PATIENTIDENTIFIER);
11350
11351 /**
11352   * Search parameter: <b>claimindentifier</b>
11353   * <p>
11354   * Description: <b>The reference to the claim</b><br>
11355   * Type: <b>token</b><br>
11356   * Path: <b>ExplanationOfBenefit.claimIdentifier</b><br>
11357   * </p>
11358   */
11359  @SearchParamDefinition(name="claimindentifier", path="ExplanationOfBenefit.claim.as(Identifier)", description="The reference to the claim", type="token" )
11360  public static final String SP_CLAIMINDENTIFIER = "claimindentifier";
11361 /**
11362   * <b>Fluent Client</b> search parameter constant for <b>claimindentifier</b>
11363   * <p>
11364   * Description: <b>The reference to the claim</b><br>
11365   * Type: <b>token</b><br>
11366   * Path: <b>ExplanationOfBenefit.claimIdentifier</b><br>
11367   * </p>
11368   */
11369  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLAIMINDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLAIMINDENTIFIER);
11370
11371 /**
11372   * Search parameter: <b>facilityreference</b>
11373   * <p>
11374   * Description: <b>Facility responsible for the goods and services</b><br>
11375   * Type: <b>reference</b><br>
11376   * Path: <b>ExplanationOfBenefit.facilityReference</b><br>
11377   * </p>
11378   */
11379  @SearchParamDefinition(name="facilityreference", path="ExplanationOfBenefit.facility.as(Reference)", description="Facility responsible for the goods and services", type="reference" )
11380  public static final String SP_FACILITYREFERENCE = "facilityreference";
11381 /**
11382   * <b>Fluent Client</b> search parameter constant for <b>facilityreference</b>
11383   * <p>
11384   * Description: <b>Facility responsible for the goods and services</b><br>
11385   * Type: <b>reference</b><br>
11386   * Path: <b>ExplanationOfBenefit.facilityReference</b><br>
11387   * </p>
11388   */
11389  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITYREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITYREFERENCE);
11390
11391/**
11392   * Constant for fluent queries to be used to add include statements. Specifies
11393   * the path value of "<b>ExplanationOfBenefit:facilityreference</b>".
11394   */
11395  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITYREFERENCE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facilityreference").toLocked();
11396
11397 /**
11398   * Search parameter: <b>providerreference</b>
11399   * <p>
11400   * Description: <b>The reference to the provider</b><br>
11401   * Type: <b>reference</b><br>
11402   * Path: <b>ExplanationOfBenefit.providerReference</b><br>
11403   * </p>
11404   */
11405  @SearchParamDefinition(name="providerreference", path="ExplanationOfBenefit.provider.as(Reference)", description="The reference to the provider", type="reference" )
11406  public static final String SP_PROVIDERREFERENCE = "providerreference";
11407 /**
11408   * <b>Fluent Client</b> search parameter constant for <b>providerreference</b>
11409   * <p>
11410   * Description: <b>The reference to the provider</b><br>
11411   * Type: <b>reference</b><br>
11412   * Path: <b>ExplanationOfBenefit.providerReference</b><br>
11413   * </p>
11414   */
11415  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDERREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDERREFERENCE);
11416
11417/**
11418   * Constant for fluent queries to be used to add include statements. Specifies
11419   * the path value of "<b>ExplanationOfBenefit:providerreference</b>".
11420   */
11421  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDERREFERENCE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:providerreference").toLocked();
11422
11423 /**
11424   * Search parameter: <b>facilityidentifier</b>
11425   * <p>
11426   * Description: <b>Facility responsible for the goods and services</b><br>
11427   * Type: <b>token</b><br>
11428   * Path: <b>ExplanationOfBenefit.facilityIdentifier</b><br>
11429   * </p>
11430   */
11431  @SearchParamDefinition(name="facilityidentifier", path="ExplanationOfBenefit.facility.as(Identifier)", description="Facility responsible for the goods and services", type="token" )
11432  public static final String SP_FACILITYIDENTIFIER = "facilityidentifier";
11433 /**
11434   * <b>Fluent Client</b> search parameter constant for <b>facilityidentifier</b>
11435   * <p>
11436   * Description: <b>Facility responsible for the goods and services</b><br>
11437   * Type: <b>token</b><br>
11438   * Path: <b>ExplanationOfBenefit.facilityIdentifier</b><br>
11439   * </p>
11440   */
11441  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FACILITYIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FACILITYIDENTIFIER);
11442
11443 /**
11444   * Search parameter: <b>organizationidentifier</b>
11445   * <p>
11446   * Description: <b>The reference to the providing organization</b><br>
11447   * Type: <b>token</b><br>
11448   * Path: <b>ExplanationOfBenefit.organizationIdentifier</b><br>
11449   * </p>
11450   */
11451  @SearchParamDefinition(name="organizationidentifier", path="ExplanationOfBenefit.organization.as(Identifier)", description="The reference to the providing organization", type="token" )
11452  public static final String SP_ORGANIZATIONIDENTIFIER = "organizationidentifier";
11453 /**
11454   * <b>Fluent Client</b> search parameter constant for <b>organizationidentifier</b>
11455   * <p>
11456   * Description: <b>The reference to the providing organization</b><br>
11457   * Type: <b>token</b><br>
11458   * Path: <b>ExplanationOfBenefit.organizationIdentifier</b><br>
11459   * </p>
11460   */
11461  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ORGANIZATIONIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ORGANIZATIONIDENTIFIER);
11462
11463 /**
11464   * Search parameter: <b>patientreference</b>
11465   * <p>
11466   * Description: <b>The reference to the patient</b><br>
11467   * Type: <b>reference</b><br>
11468   * Path: <b>ExplanationOfBenefit.patientReference</b><br>
11469   * </p>
11470   */
11471  @SearchParamDefinition(name="patientreference", path="ExplanationOfBenefit.patient.as(Reference)", description="The reference to the patient", type="reference" )
11472  public static final String SP_PATIENTREFERENCE = "patientreference";
11473 /**
11474   * <b>Fluent Client</b> search parameter constant for <b>patientreference</b>
11475   * <p>
11476   * Description: <b>The reference to the patient</b><br>
11477   * Type: <b>reference</b><br>
11478   * Path: <b>ExplanationOfBenefit.patientReference</b><br>
11479   * </p>
11480   */
11481  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENTREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENTREFERENCE);
11482
11483/**
11484   * Constant for fluent queries to be used to add include statements. Specifies
11485   * the path value of "<b>ExplanationOfBenefit:patientreference</b>".
11486   */
11487  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENTREFERENCE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patientreference").toLocked();
11488
11489 /**
11490   * Search parameter: <b>created</b>
11491   * <p>
11492   * Description: <b>The creation date for the EOB</b><br>
11493   * Type: <b>date</b><br>
11494   * Path: <b>ExplanationOfBenefit.created</b><br>
11495   * </p>
11496   */
11497  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
11498  public static final String SP_CREATED = "created";
11499 /**
11500   * <b>Fluent Client</b> search parameter constant for <b>created</b>
11501   * <p>
11502   * Description: <b>The creation date for the EOB</b><br>
11503   * Type: <b>date</b><br>
11504   * Path: <b>ExplanationOfBenefit.created</b><br>
11505   * </p>
11506   */
11507  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
11508
11509 /**
11510   * Search parameter: <b>organizationreference</b>
11511   * <p>
11512   * Description: <b>The reference to the providing organization</b><br>
11513   * Type: <b>reference</b><br>
11514   * Path: <b>ExplanationOfBenefit.organizationReference</b><br>
11515   * </p>
11516   */
11517  @SearchParamDefinition(name="organizationreference", path="ExplanationOfBenefit.organization.as(Reference)", description="The reference to the providing organization", type="reference" )
11518  public static final String SP_ORGANIZATIONREFERENCE = "organizationreference";
11519 /**
11520   * <b>Fluent Client</b> search parameter constant for <b>organizationreference</b>
11521   * <p>
11522   * Description: <b>The reference to the providing organization</b><br>
11523   * Type: <b>reference</b><br>
11524   * Path: <b>ExplanationOfBenefit.organizationReference</b><br>
11525   * </p>
11526   */
11527  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATIONREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATIONREFERENCE);
11528
11529/**
11530   * Constant for fluent queries to be used to add include statements. Specifies
11531   * the path value of "<b>ExplanationOfBenefit:organizationreference</b>".
11532   */
11533  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATIONREFERENCE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:organizationreference").toLocked();
11534
11535 /**
11536   * Search parameter: <b>identifier</b>
11537   * <p>
11538   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
11539   * Type: <b>token</b><br>
11540   * Path: <b>ExplanationOfBenefit.identifier</b><br>
11541   * </p>
11542   */
11543  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
11544  public static final String SP_IDENTIFIER = "identifier";
11545 /**
11546   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
11547   * <p>
11548   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
11549   * Type: <b>token</b><br>
11550   * Path: <b>ExplanationOfBenefit.identifier</b><br>
11551   * </p>
11552   */
11553  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
11554
11555 /**
11556   * Search parameter: <b>disposition</b>
11557   * <p>
11558   * Description: <b>The contents of the disposition message</b><br>
11559   * Type: <b>string</b><br>
11560   * Path: <b>ExplanationOfBenefit.disposition</b><br>
11561   * </p>
11562   */
11563  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
11564  public static final String SP_DISPOSITION = "disposition";
11565 /**
11566   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
11567   * <p>
11568   * Description: <b>The contents of the disposition message</b><br>
11569   * Type: <b>string</b><br>
11570   * Path: <b>ExplanationOfBenefit.disposition</b><br>
11571   * </p>
11572   */
11573  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
11574
11575 /**
11576   * Search parameter: <b>provideridentifier</b>
11577   * <p>
11578   * Description: <b>The reference to the provider</b><br>
11579   * Type: <b>token</b><br>
11580   * Path: <b>ExplanationOfBenefit.providerIdentifier</b><br>
11581   * </p>
11582   */
11583  @SearchParamDefinition(name="provideridentifier", path="ExplanationOfBenefit.provider.as(Identifier)", description="The reference to the provider", type="token" )
11584  public static final String SP_PROVIDERIDENTIFIER = "provideridentifier";
11585 /**
11586   * <b>Fluent Client</b> search parameter constant for <b>provideridentifier</b>
11587   * <p>
11588   * Description: <b>The reference to the provider</b><br>
11589   * Type: <b>token</b><br>
11590   * Path: <b>ExplanationOfBenefit.providerIdentifier</b><br>
11591   * </p>
11592   */
11593  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PROVIDERIDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PROVIDERIDENTIFIER);
11594
11595 /**
11596   * Search parameter: <b>claimreference</b>
11597   * <p>
11598   * Description: <b>The reference to the claim</b><br>
11599   * Type: <b>reference</b><br>
11600   * Path: <b>ExplanationOfBenefit.claimReference</b><br>
11601   * </p>
11602   */
11603  @SearchParamDefinition(name="claimreference", path="ExplanationOfBenefit.claim.as(Reference)", description="The reference to the claim", type="reference" )
11604  public static final String SP_CLAIMREFERENCE = "claimreference";
11605 /**
11606   * <b>Fluent Client</b> search parameter constant for <b>claimreference</b>
11607   * <p>
11608   * Description: <b>The reference to the claim</b><br>
11609   * Type: <b>reference</b><br>
11610   * Path: <b>ExplanationOfBenefit.claimReference</b><br>
11611   * </p>
11612   */
11613  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIMREFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIMREFERENCE);
11614
11615/**
11616   * Constant for fluent queries to be used to add include statements. Specifies
11617   * the path value of "<b>ExplanationOfBenefit:claimreference</b>".
11618   */
11619  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIMREFERENCE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claimreference").toLocked();
11620
11621
11622}