001package org.hl7.fhir.dstu3.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu3
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056
057import org.hl7.fhir.exceptions.FHIRException;
058import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
059import org.hl7.fhir.utilities.Utilities;
060
061import ca.uhn.fhir.model.api.annotation.Block;
062import ca.uhn.fhir.model.api.annotation.Child;
063import ca.uhn.fhir.model.api.annotation.Description;
064import ca.uhn.fhir.model.api.annotation.ResourceDef;
065import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
066/**
067 * This resource provides payment details and claim references supporting a bulk payment.
068 */
069@ResourceDef(name="PaymentReconciliation", profile="http://hl7.org/fhir/Profile/PaymentReconciliation")
070public class PaymentReconciliation extends DomainResource {
071
072    public enum PaymentReconciliationStatus {
073        /**
074         * The instance is currently in-force.
075         */
076        ACTIVE, 
077        /**
078         * The instance is withdrawn, rescinded or reversed.
079         */
080        CANCELLED, 
081        /**
082         * A new instance the contents of which is not complete.
083         */
084        DRAFT, 
085        /**
086         * The instance was entered in error.
087         */
088        ENTEREDINERROR, 
089        /**
090         * added to help the parsers with the generic types
091         */
092        NULL;
093        public static PaymentReconciliationStatus fromCode(String codeString) throws FHIRException {
094            if (codeString == null || "".equals(codeString))
095                return null;
096        if ("active".equals(codeString))
097          return ACTIVE;
098        if ("cancelled".equals(codeString))
099          return CANCELLED;
100        if ("draft".equals(codeString))
101          return DRAFT;
102        if ("entered-in-error".equals(codeString))
103          return ENTEREDINERROR;
104        if (Configuration.isAcceptInvalidEnums())
105          return null;
106        else
107          throw new FHIRException("Unknown PaymentReconciliationStatus code '"+codeString+"'");
108        }
109        public String toCode() {
110          switch (this) {
111            case ACTIVE: return "active";
112            case CANCELLED: return "cancelled";
113            case DRAFT: return "draft";
114            case ENTEREDINERROR: return "entered-in-error";
115            default: return "?";
116          }
117        }
118        public String getSystem() {
119          switch (this) {
120            case ACTIVE: return "http://hl7.org/fhir/fm-status";
121            case CANCELLED: return "http://hl7.org/fhir/fm-status";
122            case DRAFT: return "http://hl7.org/fhir/fm-status";
123            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
124            default: return "?";
125          }
126        }
127        public String getDefinition() {
128          switch (this) {
129            case ACTIVE: return "The instance is currently in-force.";
130            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
131            case DRAFT: return "A new instance the contents of which is not complete.";
132            case ENTEREDINERROR: return "The instance was entered in error.";
133            default: return "?";
134          }
135        }
136        public String getDisplay() {
137          switch (this) {
138            case ACTIVE: return "Active";
139            case CANCELLED: return "Cancelled";
140            case DRAFT: return "Draft";
141            case ENTEREDINERROR: return "Entered in Error";
142            default: return "?";
143          }
144        }
145    }
146
147  public static class PaymentReconciliationStatusEnumFactory implements EnumFactory<PaymentReconciliationStatus> {
148    public PaymentReconciliationStatus fromCode(String codeString) throws IllegalArgumentException {
149      if (codeString == null || "".equals(codeString))
150            if (codeString == null || "".equals(codeString))
151                return null;
152        if ("active".equals(codeString))
153          return PaymentReconciliationStatus.ACTIVE;
154        if ("cancelled".equals(codeString))
155          return PaymentReconciliationStatus.CANCELLED;
156        if ("draft".equals(codeString))
157          return PaymentReconciliationStatus.DRAFT;
158        if ("entered-in-error".equals(codeString))
159          return PaymentReconciliationStatus.ENTEREDINERROR;
160        throw new IllegalArgumentException("Unknown PaymentReconciliationStatus code '"+codeString+"'");
161        }
162        public Enumeration<PaymentReconciliationStatus> fromType(Base code) throws FHIRException {
163          if (code == null)
164            return null;
165          if (code.isEmpty())
166            return new Enumeration<PaymentReconciliationStatus>(this);
167          String codeString = ((PrimitiveType) code).asStringValue();
168          if (codeString == null || "".equals(codeString))
169            return null;
170        if ("active".equals(codeString))
171          return new Enumeration<PaymentReconciliationStatus>(this, PaymentReconciliationStatus.ACTIVE);
172        if ("cancelled".equals(codeString))
173          return new Enumeration<PaymentReconciliationStatus>(this, PaymentReconciliationStatus.CANCELLED);
174        if ("draft".equals(codeString))
175          return new Enumeration<PaymentReconciliationStatus>(this, PaymentReconciliationStatus.DRAFT);
176        if ("entered-in-error".equals(codeString))
177          return new Enumeration<PaymentReconciliationStatus>(this, PaymentReconciliationStatus.ENTEREDINERROR);
178        throw new FHIRException("Unknown PaymentReconciliationStatus code '"+codeString+"'");
179        }
180    public String toCode(PaymentReconciliationStatus code) {
181      if (code == PaymentReconciliationStatus.ACTIVE)
182        return "active";
183      if (code == PaymentReconciliationStatus.CANCELLED)
184        return "cancelled";
185      if (code == PaymentReconciliationStatus.DRAFT)
186        return "draft";
187      if (code == PaymentReconciliationStatus.ENTEREDINERROR)
188        return "entered-in-error";
189      return "?";
190      }
191    public String toSystem(PaymentReconciliationStatus code) {
192      return code.getSystem();
193      }
194    }
195
196    @Block()
197    public static class DetailsComponent extends BackboneElement implements IBaseBackboneElement {
198        /**
199         * Code to indicate the nature of the payment, adjustment, funds advance, etc.
200         */
201        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
202        @Description(shortDefinition="Type code", formalDefinition="Code to indicate the nature of the payment, adjustment, funds advance, etc." )
203        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-type")
204        protected CodeableConcept type;
205
206        /**
207         * The claim or financial resource.
208         */
209        @Child(name = "request", type = {Reference.class}, order=2, min=0, max=1, modifier=false, summary=false)
210        @Description(shortDefinition="Claim", formalDefinition="The claim or financial resource." )
211        protected Reference request;
212
213        /**
214         * The actual object that is the target of the reference (The claim or financial resource.)
215         */
216        protected Resource requestTarget;
217
218        /**
219         * The claim response resource.
220         */
221        @Child(name = "response", type = {Reference.class}, order=3, min=0, max=1, modifier=false, summary=false)
222        @Description(shortDefinition="Claim Response", formalDefinition="The claim response resource." )
223        protected Reference response;
224
225        /**
226         * The actual object that is the target of the reference (The claim response resource.)
227         */
228        protected Resource responseTarget;
229
230        /**
231         * The Organization which submitted the claim or financial transaction.
232         */
233        @Child(name = "submitter", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=false)
234        @Description(shortDefinition="Organization which submitted the claim", formalDefinition="The Organization which submitted the claim or financial transaction." )
235        protected Reference submitter;
236
237        /**
238         * The actual object that is the target of the reference (The Organization which submitted the claim or financial transaction.)
239         */
240        protected Organization submitterTarget;
241
242        /**
243         * The organization which is receiving the payment.
244         */
245        @Child(name = "payee", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=false)
246        @Description(shortDefinition="Organization which is receiving the payment", formalDefinition="The organization which is receiving the payment." )
247        protected Reference payee;
248
249        /**
250         * The actual object that is the target of the reference (The organization which is receiving the payment.)
251         */
252        protected Organization payeeTarget;
253
254        /**
255         * The date of the invoice or financial resource.
256         */
257        @Child(name = "date", type = {DateType.class}, order=6, min=0, max=1, modifier=false, summary=false)
258        @Description(shortDefinition="Invoice date", formalDefinition="The date of the invoice or financial resource." )
259        protected DateType date;
260
261        /**
262         * Amount paid for this detail.
263         */
264        @Child(name = "amount", type = {Money.class}, order=7, min=0, max=1, modifier=false, summary=false)
265        @Description(shortDefinition="Amount being paid", formalDefinition="Amount paid for this detail." )
266        protected Money amount;
267
268        private static final long serialVersionUID = 661095855L;
269
270    /**
271     * Constructor
272     */
273      public DetailsComponent() {
274        super();
275      }
276
277    /**
278     * Constructor
279     */
280      public DetailsComponent(CodeableConcept type) {
281        super();
282        this.type = type;
283      }
284
285        /**
286         * @return {@link #type} (Code to indicate the nature of the payment, adjustment, funds advance, etc.)
287         */
288        public CodeableConcept getType() { 
289          if (this.type == null)
290            if (Configuration.errorOnAutoCreate())
291              throw new Error("Attempt to auto-create DetailsComponent.type");
292            else if (Configuration.doAutoCreate())
293              this.type = new CodeableConcept(); // cc
294          return this.type;
295        }
296
297        public boolean hasType() { 
298          return this.type != null && !this.type.isEmpty();
299        }
300
301        /**
302         * @param value {@link #type} (Code to indicate the nature of the payment, adjustment, funds advance, etc.)
303         */
304        public DetailsComponent setType(CodeableConcept value)  { 
305          this.type = value;
306          return this;
307        }
308
309        /**
310         * @return {@link #request} (The claim or financial resource.)
311         */
312        public Reference getRequest() { 
313          if (this.request == null)
314            if (Configuration.errorOnAutoCreate())
315              throw new Error("Attempt to auto-create DetailsComponent.request");
316            else if (Configuration.doAutoCreate())
317              this.request = new Reference(); // cc
318          return this.request;
319        }
320
321        public boolean hasRequest() { 
322          return this.request != null && !this.request.isEmpty();
323        }
324
325        /**
326         * @param value {@link #request} (The claim or financial resource.)
327         */
328        public DetailsComponent setRequest(Reference value)  { 
329          this.request = value;
330          return this;
331        }
332
333        /**
334         * @return {@link #request} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The claim or financial resource.)
335         */
336        public Resource getRequestTarget() { 
337          return this.requestTarget;
338        }
339
340        /**
341         * @param value {@link #request} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The claim or financial resource.)
342         */
343        public DetailsComponent setRequestTarget(Resource value) { 
344          this.requestTarget = value;
345          return this;
346        }
347
348        /**
349         * @return {@link #response} (The claim response resource.)
350         */
351        public Reference getResponse() { 
352          if (this.response == null)
353            if (Configuration.errorOnAutoCreate())
354              throw new Error("Attempt to auto-create DetailsComponent.response");
355            else if (Configuration.doAutoCreate())
356              this.response = new Reference(); // cc
357          return this.response;
358        }
359
360        public boolean hasResponse() { 
361          return this.response != null && !this.response.isEmpty();
362        }
363
364        /**
365         * @param value {@link #response} (The claim response resource.)
366         */
367        public DetailsComponent setResponse(Reference value)  { 
368          this.response = value;
369          return this;
370        }
371
372        /**
373         * @return {@link #response} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The claim response resource.)
374         */
375        public Resource getResponseTarget() { 
376          return this.responseTarget;
377        }
378
379        /**
380         * @param value {@link #response} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The claim response resource.)
381         */
382        public DetailsComponent setResponseTarget(Resource value) { 
383          this.responseTarget = value;
384          return this;
385        }
386
387        /**
388         * @return {@link #submitter} (The Organization which submitted the claim or financial transaction.)
389         */
390        public Reference getSubmitter() { 
391          if (this.submitter == null)
392            if (Configuration.errorOnAutoCreate())
393              throw new Error("Attempt to auto-create DetailsComponent.submitter");
394            else if (Configuration.doAutoCreate())
395              this.submitter = new Reference(); // cc
396          return this.submitter;
397        }
398
399        public boolean hasSubmitter() { 
400          return this.submitter != null && !this.submitter.isEmpty();
401        }
402
403        /**
404         * @param value {@link #submitter} (The Organization which submitted the claim or financial transaction.)
405         */
406        public DetailsComponent setSubmitter(Reference value)  { 
407          this.submitter = value;
408          return this;
409        }
410
411        /**
412         * @return {@link #submitter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Organization which submitted the claim or financial transaction.)
413         */
414        public Organization getSubmitterTarget() { 
415          if (this.submitterTarget == null)
416            if (Configuration.errorOnAutoCreate())
417              throw new Error("Attempt to auto-create DetailsComponent.submitter");
418            else if (Configuration.doAutoCreate())
419              this.submitterTarget = new Organization(); // aa
420          return this.submitterTarget;
421        }
422
423        /**
424         * @param value {@link #submitter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Organization which submitted the claim or financial transaction.)
425         */
426        public DetailsComponent setSubmitterTarget(Organization value) { 
427          this.submitterTarget = value;
428          return this;
429        }
430
431        /**
432         * @return {@link #payee} (The organization which is receiving the payment.)
433         */
434        public Reference getPayee() { 
435          if (this.payee == null)
436            if (Configuration.errorOnAutoCreate())
437              throw new Error("Attempt to auto-create DetailsComponent.payee");
438            else if (Configuration.doAutoCreate())
439              this.payee = new Reference(); // cc
440          return this.payee;
441        }
442
443        public boolean hasPayee() { 
444          return this.payee != null && !this.payee.isEmpty();
445        }
446
447        /**
448         * @param value {@link #payee} (The organization which is receiving the payment.)
449         */
450        public DetailsComponent setPayee(Reference value)  { 
451          this.payee = value;
452          return this;
453        }
454
455        /**
456         * @return {@link #payee} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is receiving the payment.)
457         */
458        public Organization getPayeeTarget() { 
459          if (this.payeeTarget == null)
460            if (Configuration.errorOnAutoCreate())
461              throw new Error("Attempt to auto-create DetailsComponent.payee");
462            else if (Configuration.doAutoCreate())
463              this.payeeTarget = new Organization(); // aa
464          return this.payeeTarget;
465        }
466
467        /**
468         * @param value {@link #payee} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is receiving the payment.)
469         */
470        public DetailsComponent setPayeeTarget(Organization value) { 
471          this.payeeTarget = value;
472          return this;
473        }
474
475        /**
476         * @return {@link #date} (The date of the invoice or financial resource.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
477         */
478        public DateType getDateElement() { 
479          if (this.date == null)
480            if (Configuration.errorOnAutoCreate())
481              throw new Error("Attempt to auto-create DetailsComponent.date");
482            else if (Configuration.doAutoCreate())
483              this.date = new DateType(); // bb
484          return this.date;
485        }
486
487        public boolean hasDateElement() { 
488          return this.date != null && !this.date.isEmpty();
489        }
490
491        public boolean hasDate() { 
492          return this.date != null && !this.date.isEmpty();
493        }
494
495        /**
496         * @param value {@link #date} (The date of the invoice or financial resource.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
497         */
498        public DetailsComponent setDateElement(DateType value) { 
499          this.date = value;
500          return this;
501        }
502
503        /**
504         * @return The date of the invoice or financial resource.
505         */
506        public Date getDate() { 
507          return this.date == null ? null : this.date.getValue();
508        }
509
510        /**
511         * @param value The date of the invoice or financial resource.
512         */
513        public DetailsComponent setDate(Date value) { 
514          if (value == null)
515            this.date = null;
516          else {
517            if (this.date == null)
518              this.date = new DateType();
519            this.date.setValue(value);
520          }
521          return this;
522        }
523
524        /**
525         * @return {@link #amount} (Amount paid for this detail.)
526         */
527        public Money getAmount() { 
528          if (this.amount == null)
529            if (Configuration.errorOnAutoCreate())
530              throw new Error("Attempt to auto-create DetailsComponent.amount");
531            else if (Configuration.doAutoCreate())
532              this.amount = new Money(); // cc
533          return this.amount;
534        }
535
536        public boolean hasAmount() { 
537          return this.amount != null && !this.amount.isEmpty();
538        }
539
540        /**
541         * @param value {@link #amount} (Amount paid for this detail.)
542         */
543        public DetailsComponent setAmount(Money value)  { 
544          this.amount = value;
545          return this;
546        }
547
548        protected void listChildren(List<Property> children) {
549          super.listChildren(children);
550          children.add(new Property("type", "CodeableConcept", "Code to indicate the nature of the payment, adjustment, funds advance, etc.", 0, 1, type));
551          children.add(new Property("request", "Reference(Any)", "The claim or financial resource.", 0, 1, request));
552          children.add(new Property("response", "Reference(Any)", "The claim response resource.", 0, 1, response));
553          children.add(new Property("submitter", "Reference(Organization)", "The Organization which submitted the claim or financial transaction.", 0, 1, submitter));
554          children.add(new Property("payee", "Reference(Organization)", "The organization which is receiving the payment.", 0, 1, payee));
555          children.add(new Property("date", "date", "The date of the invoice or financial resource.", 0, 1, date));
556          children.add(new Property("amount", "Money", "Amount paid for this detail.", 0, 1, amount));
557        }
558
559        @Override
560        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
561          switch (_hash) {
562          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Code to indicate the nature of the payment, adjustment, funds advance, etc.", 0, 1, type);
563          case 1095692943: /*request*/  return new Property("request", "Reference(Any)", "The claim or financial resource.", 0, 1, request);
564          case -340323263: /*response*/  return new Property("response", "Reference(Any)", "The claim response resource.", 0, 1, response);
565          case 348678409: /*submitter*/  return new Property("submitter", "Reference(Organization)", "The Organization which submitted the claim or financial transaction.", 0, 1, submitter);
566          case 106443592: /*payee*/  return new Property("payee", "Reference(Organization)", "The organization which is receiving the payment.", 0, 1, payee);
567          case 3076014: /*date*/  return new Property("date", "date", "The date of the invoice or financial resource.", 0, 1, date);
568          case -1413853096: /*amount*/  return new Property("amount", "Money", "Amount paid for this detail.", 0, 1, amount);
569          default: return super.getNamedProperty(_hash, _name, _checkValid);
570          }
571
572        }
573
574      @Override
575      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
576        switch (hash) {
577        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
578        case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
579        case -340323263: /*response*/ return this.response == null ? new Base[0] : new Base[] {this.response}; // Reference
580        case 348678409: /*submitter*/ return this.submitter == null ? new Base[0] : new Base[] {this.submitter}; // Reference
581        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // Reference
582        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
583        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
584        default: return super.getProperty(hash, name, checkValid);
585        }
586
587      }
588
589      @Override
590      public Base setProperty(int hash, String name, Base value) throws FHIRException {
591        switch (hash) {
592        case 3575610: // type
593          this.type = castToCodeableConcept(value); // CodeableConcept
594          return value;
595        case 1095692943: // request
596          this.request = castToReference(value); // Reference
597          return value;
598        case -340323263: // response
599          this.response = castToReference(value); // Reference
600          return value;
601        case 348678409: // submitter
602          this.submitter = castToReference(value); // Reference
603          return value;
604        case 106443592: // payee
605          this.payee = castToReference(value); // Reference
606          return value;
607        case 3076014: // date
608          this.date = castToDate(value); // DateType
609          return value;
610        case -1413853096: // amount
611          this.amount = castToMoney(value); // Money
612          return value;
613        default: return super.setProperty(hash, name, value);
614        }
615
616      }
617
618      @Override
619      public Base setProperty(String name, Base value) throws FHIRException {
620        if (name.equals("type")) {
621          this.type = castToCodeableConcept(value); // CodeableConcept
622        } else if (name.equals("request")) {
623          this.request = castToReference(value); // Reference
624        } else if (name.equals("response")) {
625          this.response = castToReference(value); // Reference
626        } else if (name.equals("submitter")) {
627          this.submitter = castToReference(value); // Reference
628        } else if (name.equals("payee")) {
629          this.payee = castToReference(value); // Reference
630        } else if (name.equals("date")) {
631          this.date = castToDate(value); // DateType
632        } else if (name.equals("amount")) {
633          this.amount = castToMoney(value); // Money
634        } else
635          return super.setProperty(name, value);
636        return value;
637      }
638
639      @Override
640      public Base makeProperty(int hash, String name) throws FHIRException {
641        switch (hash) {
642        case 3575610:  return getType(); 
643        case 1095692943:  return getRequest(); 
644        case -340323263:  return getResponse(); 
645        case 348678409:  return getSubmitter(); 
646        case 106443592:  return getPayee(); 
647        case 3076014:  return getDateElement();
648        case -1413853096:  return getAmount(); 
649        default: return super.makeProperty(hash, name);
650        }
651
652      }
653
654      @Override
655      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
656        switch (hash) {
657        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
658        case 1095692943: /*request*/ return new String[] {"Reference"};
659        case -340323263: /*response*/ return new String[] {"Reference"};
660        case 348678409: /*submitter*/ return new String[] {"Reference"};
661        case 106443592: /*payee*/ return new String[] {"Reference"};
662        case 3076014: /*date*/ return new String[] {"date"};
663        case -1413853096: /*amount*/ return new String[] {"Money"};
664        default: return super.getTypesForProperty(hash, name);
665        }
666
667      }
668
669      @Override
670      public Base addChild(String name) throws FHIRException {
671        if (name.equals("type")) {
672          this.type = new CodeableConcept();
673          return this.type;
674        }
675        else if (name.equals("request")) {
676          this.request = new Reference();
677          return this.request;
678        }
679        else if (name.equals("response")) {
680          this.response = new Reference();
681          return this.response;
682        }
683        else if (name.equals("submitter")) {
684          this.submitter = new Reference();
685          return this.submitter;
686        }
687        else if (name.equals("payee")) {
688          this.payee = new Reference();
689          return this.payee;
690        }
691        else if (name.equals("date")) {
692          throw new FHIRException("Cannot call addChild on a primitive type PaymentReconciliation.date");
693        }
694        else if (name.equals("amount")) {
695          this.amount = new Money();
696          return this.amount;
697        }
698        else
699          return super.addChild(name);
700      }
701
702      public DetailsComponent copy() {
703        DetailsComponent dst = new DetailsComponent();
704        copyValues(dst);
705        dst.type = type == null ? null : type.copy();
706        dst.request = request == null ? null : request.copy();
707        dst.response = response == null ? null : response.copy();
708        dst.submitter = submitter == null ? null : submitter.copy();
709        dst.payee = payee == null ? null : payee.copy();
710        dst.date = date == null ? null : date.copy();
711        dst.amount = amount == null ? null : amount.copy();
712        return dst;
713      }
714
715      @Override
716      public boolean equalsDeep(Base other_) {
717        if (!super.equalsDeep(other_))
718          return false;
719        if (!(other_ instanceof DetailsComponent))
720          return false;
721        DetailsComponent o = (DetailsComponent) other_;
722        return compareDeep(type, o.type, true) && compareDeep(request, o.request, true) && compareDeep(response, o.response, true)
723           && compareDeep(submitter, o.submitter, true) && compareDeep(payee, o.payee, true) && compareDeep(date, o.date, true)
724           && compareDeep(amount, o.amount, true);
725      }
726
727      @Override
728      public boolean equalsShallow(Base other_) {
729        if (!super.equalsShallow(other_))
730          return false;
731        if (!(other_ instanceof DetailsComponent))
732          return false;
733        DetailsComponent o = (DetailsComponent) other_;
734        return compareValues(date, o.date, true);
735      }
736
737      public boolean isEmpty() {
738        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, request, response
739          , submitter, payee, date, amount);
740      }
741
742  public String fhirType() {
743    return "PaymentReconciliation.detail";
744
745  }
746
747  }
748
749    @Block()
750    public static class NotesComponent extends BackboneElement implements IBaseBackboneElement {
751        /**
752         * The note purpose: Print/Display.
753         */
754        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
755        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
756        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
757        protected CodeableConcept type;
758
759        /**
760         * The note text.
761         */
762        @Child(name = "text", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
763        @Description(shortDefinition="Comment on the processing", formalDefinition="The note text." )
764        protected StringType text;
765
766        private static final long serialVersionUID = 874830709L;
767
768    /**
769     * Constructor
770     */
771      public NotesComponent() {
772        super();
773      }
774
775        /**
776         * @return {@link #type} (The note purpose: Print/Display.)
777         */
778        public CodeableConcept getType() { 
779          if (this.type == null)
780            if (Configuration.errorOnAutoCreate())
781              throw new Error("Attempt to auto-create NotesComponent.type");
782            else if (Configuration.doAutoCreate())
783              this.type = new CodeableConcept(); // cc
784          return this.type;
785        }
786
787        public boolean hasType() { 
788          return this.type != null && !this.type.isEmpty();
789        }
790
791        /**
792         * @param value {@link #type} (The note purpose: Print/Display.)
793         */
794        public NotesComponent setType(CodeableConcept value)  { 
795          this.type = value;
796          return this;
797        }
798
799        /**
800         * @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
801         */
802        public StringType getTextElement() { 
803          if (this.text == null)
804            if (Configuration.errorOnAutoCreate())
805              throw new Error("Attempt to auto-create NotesComponent.text");
806            else if (Configuration.doAutoCreate())
807              this.text = new StringType(); // bb
808          return this.text;
809        }
810
811        public boolean hasTextElement() { 
812          return this.text != null && !this.text.isEmpty();
813        }
814
815        public boolean hasText() { 
816          return this.text != null && !this.text.isEmpty();
817        }
818
819        /**
820         * @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
821         */
822        public NotesComponent setTextElement(StringType value) { 
823          this.text = value;
824          return this;
825        }
826
827        /**
828         * @return The note text.
829         */
830        public String getText() { 
831          return this.text == null ? null : this.text.getValue();
832        }
833
834        /**
835         * @param value The note text.
836         */
837        public NotesComponent setText(String value) { 
838          if (Utilities.noString(value))
839            this.text = null;
840          else {
841            if (this.text == null)
842              this.text = new StringType();
843            this.text.setValue(value);
844          }
845          return this;
846        }
847
848        protected void listChildren(List<Property> children) {
849          super.listChildren(children);
850          children.add(new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, 1, type));
851          children.add(new Property("text", "string", "The note text.", 0, 1, text));
852        }
853
854        @Override
855        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
856          switch (_hash) {
857          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, 1, type);
858          case 3556653: /*text*/  return new Property("text", "string", "The note text.", 0, 1, text);
859          default: return super.getNamedProperty(_hash, _name, _checkValid);
860          }
861
862        }
863
864      @Override
865      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
866        switch (hash) {
867        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
868        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
869        default: return super.getProperty(hash, name, checkValid);
870        }
871
872      }
873
874      @Override
875      public Base setProperty(int hash, String name, Base value) throws FHIRException {
876        switch (hash) {
877        case 3575610: // type
878          this.type = castToCodeableConcept(value); // CodeableConcept
879          return value;
880        case 3556653: // text
881          this.text = castToString(value); // StringType
882          return value;
883        default: return super.setProperty(hash, name, value);
884        }
885
886      }
887
888      @Override
889      public Base setProperty(String name, Base value) throws FHIRException {
890        if (name.equals("type")) {
891          this.type = castToCodeableConcept(value); // CodeableConcept
892        } else if (name.equals("text")) {
893          this.text = castToString(value); // StringType
894        } else
895          return super.setProperty(name, value);
896        return value;
897      }
898
899      @Override
900      public Base makeProperty(int hash, String name) throws FHIRException {
901        switch (hash) {
902        case 3575610:  return getType(); 
903        case 3556653:  return getTextElement();
904        default: return super.makeProperty(hash, name);
905        }
906
907      }
908
909      @Override
910      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
911        switch (hash) {
912        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
913        case 3556653: /*text*/ return new String[] {"string"};
914        default: return super.getTypesForProperty(hash, name);
915        }
916
917      }
918
919      @Override
920      public Base addChild(String name) throws FHIRException {
921        if (name.equals("type")) {
922          this.type = new CodeableConcept();
923          return this.type;
924        }
925        else if (name.equals("text")) {
926          throw new FHIRException("Cannot call addChild on a primitive type PaymentReconciliation.text");
927        }
928        else
929          return super.addChild(name);
930      }
931
932      public NotesComponent copy() {
933        NotesComponent dst = new NotesComponent();
934        copyValues(dst);
935        dst.type = type == null ? null : type.copy();
936        dst.text = text == null ? null : text.copy();
937        return dst;
938      }
939
940      @Override
941      public boolean equalsDeep(Base other_) {
942        if (!super.equalsDeep(other_))
943          return false;
944        if (!(other_ instanceof NotesComponent))
945          return false;
946        NotesComponent o = (NotesComponent) other_;
947        return compareDeep(type, o.type, true) && compareDeep(text, o.text, true);
948      }
949
950      @Override
951      public boolean equalsShallow(Base other_) {
952        if (!super.equalsShallow(other_))
953          return false;
954        if (!(other_ instanceof NotesComponent))
955          return false;
956        NotesComponent o = (NotesComponent) other_;
957        return compareValues(text, o.text, true);
958      }
959
960      public boolean isEmpty() {
961        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, text);
962      }
963
964  public String fhirType() {
965    return "PaymentReconciliation.processNote";
966
967  }
968
969  }
970
971    /**
972     * The Response business identifier.
973     */
974    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
975    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
976    protected List<Identifier> identifier;
977
978    /**
979     * The status of the resource instance.
980     */
981    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
982    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
983    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
984    protected Enumeration<PaymentReconciliationStatus> status;
985
986    /**
987     * The period of time for which payments have been gathered into this bulk payment for settlement.
988     */
989    @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
990    @Description(shortDefinition="Period covered", formalDefinition="The period of time for which payments have been gathered into this bulk payment for settlement." )
991    protected Period period;
992
993    /**
994     * The date when the enclosed suite of services were performed or completed.
995     */
996    @Child(name = "created", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
997    @Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
998    protected DateTimeType created;
999
1000    /**
1001     * The Insurer who produced this adjudicated response.
1002     */
1003    @Child(name = "organization", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=false)
1004    @Description(shortDefinition="Insurer", formalDefinition="The Insurer who produced this adjudicated response." )
1005    protected Reference organization;
1006
1007    /**
1008     * The actual object that is the target of the reference (The Insurer who produced this adjudicated response.)
1009     */
1010    protected Organization organizationTarget;
1011
1012    /**
1013     * Original request resource reference.
1014     */
1015    @Child(name = "request", type = {ProcessRequest.class}, order=5, min=0, max=1, modifier=false, summary=false)
1016    @Description(shortDefinition="Claim reference", formalDefinition="Original request resource reference." )
1017    protected Reference request;
1018
1019    /**
1020     * The actual object that is the target of the reference (Original request resource reference.)
1021     */
1022    protected ProcessRequest requestTarget;
1023
1024    /**
1025     * Transaction status: error, complete.
1026     */
1027    @Child(name = "outcome", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1028    @Description(shortDefinition="complete | error | partial", formalDefinition="Transaction status: error, complete." )
1029    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
1030    protected CodeableConcept outcome;
1031
1032    /**
1033     * A description of the status of the adjudication.
1034     */
1035    @Child(name = "disposition", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
1036    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
1037    protected StringType disposition;
1038
1039    /**
1040     * The practitioner who is responsible for the services rendered to the patient.
1041     */
1042    @Child(name = "requestProvider", type = {Practitioner.class}, order=8, min=0, max=1, modifier=false, summary=false)
1043    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
1044    protected Reference requestProvider;
1045
1046    /**
1047     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
1048     */
1049    protected Practitioner requestProviderTarget;
1050
1051    /**
1052     * The organization which is responsible for the services rendered to the patient.
1053     */
1054    @Child(name = "requestOrganization", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=false)
1055    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
1056    protected Reference requestOrganization;
1057
1058    /**
1059     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
1060     */
1061    protected Organization requestOrganizationTarget;
1062
1063    /**
1064     * List of individual settlement amounts and the corresponding transaction.
1065     */
1066    @Child(name = "detail", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1067    @Description(shortDefinition="List of settlements", formalDefinition="List of individual settlement amounts and the corresponding transaction." )
1068    protected List<DetailsComponent> detail;
1069
1070    /**
1071     * The form to be used for printing the content.
1072     */
1073    @Child(name = "form", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
1074    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
1075    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
1076    protected CodeableConcept form;
1077
1078    /**
1079     * Total payment amount.
1080     */
1081    @Child(name = "total", type = {Money.class}, order=12, min=0, max=1, modifier=false, summary=false)
1082    @Description(shortDefinition="Total amount of Payment", formalDefinition="Total payment amount." )
1083    protected Money total;
1084
1085    /**
1086     * Suite of notes.
1087     */
1088    @Child(name = "processNote", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1089    @Description(shortDefinition="Processing comments", formalDefinition="Suite of notes." )
1090    protected List<NotesComponent> processNote;
1091
1092    private static final long serialVersionUID = -665475468L;
1093
1094  /**
1095   * Constructor
1096   */
1097    public PaymentReconciliation() {
1098      super();
1099    }
1100
1101    /**
1102     * @return {@link #identifier} (The Response business identifier.)
1103     */
1104    public List<Identifier> getIdentifier() { 
1105      if (this.identifier == null)
1106        this.identifier = new ArrayList<Identifier>();
1107      return this.identifier;
1108    }
1109
1110    /**
1111     * @return Returns a reference to <code>this</code> for easy method chaining
1112     */
1113    public PaymentReconciliation setIdentifier(List<Identifier> theIdentifier) { 
1114      this.identifier = theIdentifier;
1115      return this;
1116    }
1117
1118    public boolean hasIdentifier() { 
1119      if (this.identifier == null)
1120        return false;
1121      for (Identifier item : this.identifier)
1122        if (!item.isEmpty())
1123          return true;
1124      return false;
1125    }
1126
1127    public Identifier addIdentifier() { //3
1128      Identifier t = new Identifier();
1129      if (this.identifier == null)
1130        this.identifier = new ArrayList<Identifier>();
1131      this.identifier.add(t);
1132      return t;
1133    }
1134
1135    public PaymentReconciliation addIdentifier(Identifier t) { //3
1136      if (t == null)
1137        return this;
1138      if (this.identifier == null)
1139        this.identifier = new ArrayList<Identifier>();
1140      this.identifier.add(t);
1141      return this;
1142    }
1143
1144    /**
1145     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1146     */
1147    public Identifier getIdentifierFirstRep() { 
1148      if (getIdentifier().isEmpty()) {
1149        addIdentifier();
1150      }
1151      return getIdentifier().get(0);
1152    }
1153
1154    /**
1155     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1156     */
1157    public Enumeration<PaymentReconciliationStatus> getStatusElement() { 
1158      if (this.status == null)
1159        if (Configuration.errorOnAutoCreate())
1160          throw new Error("Attempt to auto-create PaymentReconciliation.status");
1161        else if (Configuration.doAutoCreate())
1162          this.status = new Enumeration<PaymentReconciliationStatus>(new PaymentReconciliationStatusEnumFactory()); // bb
1163      return this.status;
1164    }
1165
1166    public boolean hasStatusElement() { 
1167      return this.status != null && !this.status.isEmpty();
1168    }
1169
1170    public boolean hasStatus() { 
1171      return this.status != null && !this.status.isEmpty();
1172    }
1173
1174    /**
1175     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1176     */
1177    public PaymentReconciliation setStatusElement(Enumeration<PaymentReconciliationStatus> value) { 
1178      this.status = value;
1179      return this;
1180    }
1181
1182    /**
1183     * @return The status of the resource instance.
1184     */
1185    public PaymentReconciliationStatus getStatus() { 
1186      return this.status == null ? null : this.status.getValue();
1187    }
1188
1189    /**
1190     * @param value The status of the resource instance.
1191     */
1192    public PaymentReconciliation setStatus(PaymentReconciliationStatus value) { 
1193      if (value == null)
1194        this.status = null;
1195      else {
1196        if (this.status == null)
1197          this.status = new Enumeration<PaymentReconciliationStatus>(new PaymentReconciliationStatusEnumFactory());
1198        this.status.setValue(value);
1199      }
1200      return this;
1201    }
1202
1203    /**
1204     * @return {@link #period} (The period of time for which payments have been gathered into this bulk payment for settlement.)
1205     */
1206    public Period getPeriod() { 
1207      if (this.period == null)
1208        if (Configuration.errorOnAutoCreate())
1209          throw new Error("Attempt to auto-create PaymentReconciliation.period");
1210        else if (Configuration.doAutoCreate())
1211          this.period = new Period(); // cc
1212      return this.period;
1213    }
1214
1215    public boolean hasPeriod() { 
1216      return this.period != null && !this.period.isEmpty();
1217    }
1218
1219    /**
1220     * @param value {@link #period} (The period of time for which payments have been gathered into this bulk payment for settlement.)
1221     */
1222    public PaymentReconciliation setPeriod(Period value)  { 
1223      this.period = value;
1224      return this;
1225    }
1226
1227    /**
1228     * @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1229     */
1230    public DateTimeType getCreatedElement() { 
1231      if (this.created == null)
1232        if (Configuration.errorOnAutoCreate())
1233          throw new Error("Attempt to auto-create PaymentReconciliation.created");
1234        else if (Configuration.doAutoCreate())
1235          this.created = new DateTimeType(); // bb
1236      return this.created;
1237    }
1238
1239    public boolean hasCreatedElement() { 
1240      return this.created != null && !this.created.isEmpty();
1241    }
1242
1243    public boolean hasCreated() { 
1244      return this.created != null && !this.created.isEmpty();
1245    }
1246
1247    /**
1248     * @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1249     */
1250    public PaymentReconciliation setCreatedElement(DateTimeType value) { 
1251      this.created = value;
1252      return this;
1253    }
1254
1255    /**
1256     * @return The date when the enclosed suite of services were performed or completed.
1257     */
1258    public Date getCreated() { 
1259      return this.created == null ? null : this.created.getValue();
1260    }
1261
1262    /**
1263     * @param value The date when the enclosed suite of services were performed or completed.
1264     */
1265    public PaymentReconciliation setCreated(Date value) { 
1266      if (value == null)
1267        this.created = null;
1268      else {
1269        if (this.created == null)
1270          this.created = new DateTimeType();
1271        this.created.setValue(value);
1272      }
1273      return this;
1274    }
1275
1276    /**
1277     * @return {@link #organization} (The Insurer who produced this adjudicated response.)
1278     */
1279    public Reference getOrganization() { 
1280      if (this.organization == null)
1281        if (Configuration.errorOnAutoCreate())
1282          throw new Error("Attempt to auto-create PaymentReconciliation.organization");
1283        else if (Configuration.doAutoCreate())
1284          this.organization = new Reference(); // cc
1285      return this.organization;
1286    }
1287
1288    public boolean hasOrganization() { 
1289      return this.organization != null && !this.organization.isEmpty();
1290    }
1291
1292    /**
1293     * @param value {@link #organization} (The Insurer who produced this adjudicated response.)
1294     */
1295    public PaymentReconciliation setOrganization(Reference value)  { 
1296      this.organization = value;
1297      return this;
1298    }
1299
1300    /**
1301     * @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
1302     */
1303    public Organization getOrganizationTarget() { 
1304      if (this.organizationTarget == null)
1305        if (Configuration.errorOnAutoCreate())
1306          throw new Error("Attempt to auto-create PaymentReconciliation.organization");
1307        else if (Configuration.doAutoCreate())
1308          this.organizationTarget = new Organization(); // aa
1309      return this.organizationTarget;
1310    }
1311
1312    /**
1313     * @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
1314     */
1315    public PaymentReconciliation setOrganizationTarget(Organization value) { 
1316      this.organizationTarget = value;
1317      return this;
1318    }
1319
1320    /**
1321     * @return {@link #request} (Original request resource reference.)
1322     */
1323    public Reference getRequest() { 
1324      if (this.request == null)
1325        if (Configuration.errorOnAutoCreate())
1326          throw new Error("Attempt to auto-create PaymentReconciliation.request");
1327        else if (Configuration.doAutoCreate())
1328          this.request = new Reference(); // cc
1329      return this.request;
1330    }
1331
1332    public boolean hasRequest() { 
1333      return this.request != null && !this.request.isEmpty();
1334    }
1335
1336    /**
1337     * @param value {@link #request} (Original request resource reference.)
1338     */
1339    public PaymentReconciliation setRequest(Reference value)  { 
1340      this.request = value;
1341      return this;
1342    }
1343
1344    /**
1345     * @return {@link #request} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
1346     */
1347    public ProcessRequest getRequestTarget() { 
1348      if (this.requestTarget == null)
1349        if (Configuration.errorOnAutoCreate())
1350          throw new Error("Attempt to auto-create PaymentReconciliation.request");
1351        else if (Configuration.doAutoCreate())
1352          this.requestTarget = new ProcessRequest(); // aa
1353      return this.requestTarget;
1354    }
1355
1356    /**
1357     * @param value {@link #request} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
1358     */
1359    public PaymentReconciliation setRequestTarget(ProcessRequest value) { 
1360      this.requestTarget = value;
1361      return this;
1362    }
1363
1364    /**
1365     * @return {@link #outcome} (Transaction status: error, complete.)
1366     */
1367    public CodeableConcept getOutcome() { 
1368      if (this.outcome == null)
1369        if (Configuration.errorOnAutoCreate())
1370          throw new Error("Attempt to auto-create PaymentReconciliation.outcome");
1371        else if (Configuration.doAutoCreate())
1372          this.outcome = new CodeableConcept(); // cc
1373      return this.outcome;
1374    }
1375
1376    public boolean hasOutcome() { 
1377      return this.outcome != null && !this.outcome.isEmpty();
1378    }
1379
1380    /**
1381     * @param value {@link #outcome} (Transaction status: error, complete.)
1382     */
1383    public PaymentReconciliation setOutcome(CodeableConcept value)  { 
1384      this.outcome = value;
1385      return this;
1386    }
1387
1388    /**
1389     * @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
1390     */
1391    public StringType getDispositionElement() { 
1392      if (this.disposition == null)
1393        if (Configuration.errorOnAutoCreate())
1394          throw new Error("Attempt to auto-create PaymentReconciliation.disposition");
1395        else if (Configuration.doAutoCreate())
1396          this.disposition = new StringType(); // bb
1397      return this.disposition;
1398    }
1399
1400    public boolean hasDispositionElement() { 
1401      return this.disposition != null && !this.disposition.isEmpty();
1402    }
1403
1404    public boolean hasDisposition() { 
1405      return this.disposition != null && !this.disposition.isEmpty();
1406    }
1407
1408    /**
1409     * @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
1410     */
1411    public PaymentReconciliation setDispositionElement(StringType value) { 
1412      this.disposition = value;
1413      return this;
1414    }
1415
1416    /**
1417     * @return A description of the status of the adjudication.
1418     */
1419    public String getDisposition() { 
1420      return this.disposition == null ? null : this.disposition.getValue();
1421    }
1422
1423    /**
1424     * @param value A description of the status of the adjudication.
1425     */
1426    public PaymentReconciliation setDisposition(String value) { 
1427      if (Utilities.noString(value))
1428        this.disposition = null;
1429      else {
1430        if (this.disposition == null)
1431          this.disposition = new StringType();
1432        this.disposition.setValue(value);
1433      }
1434      return this;
1435    }
1436
1437    /**
1438     * @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
1439     */
1440    public Reference getRequestProvider() { 
1441      if (this.requestProvider == null)
1442        if (Configuration.errorOnAutoCreate())
1443          throw new Error("Attempt to auto-create PaymentReconciliation.requestProvider");
1444        else if (Configuration.doAutoCreate())
1445          this.requestProvider = new Reference(); // cc
1446      return this.requestProvider;
1447    }
1448
1449    public boolean hasRequestProvider() { 
1450      return this.requestProvider != null && !this.requestProvider.isEmpty();
1451    }
1452
1453    /**
1454     * @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
1455     */
1456    public PaymentReconciliation setRequestProvider(Reference value)  { 
1457      this.requestProvider = value;
1458      return this;
1459    }
1460
1461    /**
1462     * @return {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
1463     */
1464    public Practitioner getRequestProviderTarget() { 
1465      if (this.requestProviderTarget == null)
1466        if (Configuration.errorOnAutoCreate())
1467          throw new Error("Attempt to auto-create PaymentReconciliation.requestProvider");
1468        else if (Configuration.doAutoCreate())
1469          this.requestProviderTarget = new Practitioner(); // aa
1470      return this.requestProviderTarget;
1471    }
1472
1473    /**
1474     * @param value {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
1475     */
1476    public PaymentReconciliation setRequestProviderTarget(Practitioner value) { 
1477      this.requestProviderTarget = value;
1478      return this;
1479    }
1480
1481    /**
1482     * @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
1483     */
1484    public Reference getRequestOrganization() { 
1485      if (this.requestOrganization == null)
1486        if (Configuration.errorOnAutoCreate())
1487          throw new Error("Attempt to auto-create PaymentReconciliation.requestOrganization");
1488        else if (Configuration.doAutoCreate())
1489          this.requestOrganization = new Reference(); // cc
1490      return this.requestOrganization;
1491    }
1492
1493    public boolean hasRequestOrganization() { 
1494      return this.requestOrganization != null && !this.requestOrganization.isEmpty();
1495    }
1496
1497    /**
1498     * @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
1499     */
1500    public PaymentReconciliation setRequestOrganization(Reference value)  { 
1501      this.requestOrganization = value;
1502      return this;
1503    }
1504
1505    /**
1506     * @return {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
1507     */
1508    public Organization getRequestOrganizationTarget() { 
1509      if (this.requestOrganizationTarget == null)
1510        if (Configuration.errorOnAutoCreate())
1511          throw new Error("Attempt to auto-create PaymentReconciliation.requestOrganization");
1512        else if (Configuration.doAutoCreate())
1513          this.requestOrganizationTarget = new Organization(); // aa
1514      return this.requestOrganizationTarget;
1515    }
1516
1517    /**
1518     * @param value {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
1519     */
1520    public PaymentReconciliation setRequestOrganizationTarget(Organization value) { 
1521      this.requestOrganizationTarget = value;
1522      return this;
1523    }
1524
1525    /**
1526     * @return {@link #detail} (List of individual settlement amounts and the corresponding transaction.)
1527     */
1528    public List<DetailsComponent> getDetail() { 
1529      if (this.detail == null)
1530        this.detail = new ArrayList<DetailsComponent>();
1531      return this.detail;
1532    }
1533
1534    /**
1535     * @return Returns a reference to <code>this</code> for easy method chaining
1536     */
1537    public PaymentReconciliation setDetail(List<DetailsComponent> theDetail) { 
1538      this.detail = theDetail;
1539      return this;
1540    }
1541
1542    public boolean hasDetail() { 
1543      if (this.detail == null)
1544        return false;
1545      for (DetailsComponent item : this.detail)
1546        if (!item.isEmpty())
1547          return true;
1548      return false;
1549    }
1550
1551    public DetailsComponent addDetail() { //3
1552      DetailsComponent t = new DetailsComponent();
1553      if (this.detail == null)
1554        this.detail = new ArrayList<DetailsComponent>();
1555      this.detail.add(t);
1556      return t;
1557    }
1558
1559    public PaymentReconciliation addDetail(DetailsComponent t) { //3
1560      if (t == null)
1561        return this;
1562      if (this.detail == null)
1563        this.detail = new ArrayList<DetailsComponent>();
1564      this.detail.add(t);
1565      return this;
1566    }
1567
1568    /**
1569     * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
1570     */
1571    public DetailsComponent getDetailFirstRep() { 
1572      if (getDetail().isEmpty()) {
1573        addDetail();
1574      }
1575      return getDetail().get(0);
1576    }
1577
1578    /**
1579     * @return {@link #form} (The form to be used for printing the content.)
1580     */
1581    public CodeableConcept getForm() { 
1582      if (this.form == null)
1583        if (Configuration.errorOnAutoCreate())
1584          throw new Error("Attempt to auto-create PaymentReconciliation.form");
1585        else if (Configuration.doAutoCreate())
1586          this.form = new CodeableConcept(); // cc
1587      return this.form;
1588    }
1589
1590    public boolean hasForm() { 
1591      return this.form != null && !this.form.isEmpty();
1592    }
1593
1594    /**
1595     * @param value {@link #form} (The form to be used for printing the content.)
1596     */
1597    public PaymentReconciliation setForm(CodeableConcept value)  { 
1598      this.form = value;
1599      return this;
1600    }
1601
1602    /**
1603     * @return {@link #total} (Total payment amount.)
1604     */
1605    public Money getTotal() { 
1606      if (this.total == null)
1607        if (Configuration.errorOnAutoCreate())
1608          throw new Error("Attempt to auto-create PaymentReconciliation.total");
1609        else if (Configuration.doAutoCreate())
1610          this.total = new Money(); // cc
1611      return this.total;
1612    }
1613
1614    public boolean hasTotal() { 
1615      return this.total != null && !this.total.isEmpty();
1616    }
1617
1618    /**
1619     * @param value {@link #total} (Total payment amount.)
1620     */
1621    public PaymentReconciliation setTotal(Money value)  { 
1622      this.total = value;
1623      return this;
1624    }
1625
1626    /**
1627     * @return {@link #processNote} (Suite of notes.)
1628     */
1629    public List<NotesComponent> getProcessNote() { 
1630      if (this.processNote == null)
1631        this.processNote = new ArrayList<NotesComponent>();
1632      return this.processNote;
1633    }
1634
1635    /**
1636     * @return Returns a reference to <code>this</code> for easy method chaining
1637     */
1638    public PaymentReconciliation setProcessNote(List<NotesComponent> theProcessNote) { 
1639      this.processNote = theProcessNote;
1640      return this;
1641    }
1642
1643    public boolean hasProcessNote() { 
1644      if (this.processNote == null)
1645        return false;
1646      for (NotesComponent item : this.processNote)
1647        if (!item.isEmpty())
1648          return true;
1649      return false;
1650    }
1651
1652    public NotesComponent addProcessNote() { //3
1653      NotesComponent t = new NotesComponent();
1654      if (this.processNote == null)
1655        this.processNote = new ArrayList<NotesComponent>();
1656      this.processNote.add(t);
1657      return t;
1658    }
1659
1660    public PaymentReconciliation addProcessNote(NotesComponent t) { //3
1661      if (t == null)
1662        return this;
1663      if (this.processNote == null)
1664        this.processNote = new ArrayList<NotesComponent>();
1665      this.processNote.add(t);
1666      return this;
1667    }
1668
1669    /**
1670     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
1671     */
1672    public NotesComponent getProcessNoteFirstRep() { 
1673      if (getProcessNote().isEmpty()) {
1674        addProcessNote();
1675      }
1676      return getProcessNote().get(0);
1677    }
1678
1679      protected void listChildren(List<Property> children) {
1680        super.listChildren(children);
1681        children.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
1682        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
1683        children.add(new Property("period", "Period", "The period of time for which payments have been gathered into this bulk payment for settlement.", 0, 1, period));
1684        children.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, 1, created));
1685        children.add(new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, 1, organization));
1686        children.add(new Property("request", "Reference(ProcessRequest)", "Original request resource reference.", 0, 1, request));
1687        children.add(new Property("outcome", "CodeableConcept", "Transaction status: error, complete.", 0, 1, outcome));
1688        children.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition));
1689        children.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, requestProvider));
1690        children.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, 1, requestOrganization));
1691        children.add(new Property("detail", "", "List of individual settlement amounts and the corresponding transaction.", 0, java.lang.Integer.MAX_VALUE, detail));
1692        children.add(new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form));
1693        children.add(new Property("total", "Money", "Total payment amount.", 0, 1, total));
1694        children.add(new Property("processNote", "", "Suite of notes.", 0, java.lang.Integer.MAX_VALUE, processNote));
1695      }
1696
1697      @Override
1698      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1699        switch (_hash) {
1700        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
1701        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
1702        case -991726143: /*period*/  return new Property("period", "Period", "The period of time for which payments have been gathered into this bulk payment for settlement.", 0, 1, period);
1703        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, 1, created);
1704        case 1178922291: /*organization*/  return new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, 1, organization);
1705        case 1095692943: /*request*/  return new Property("request", "Reference(ProcessRequest)", "Original request resource reference.", 0, 1, request);
1706        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "Transaction status: error, complete.", 0, 1, outcome);
1707        case 583380919: /*disposition*/  return new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition);
1708        case 1601527200: /*requestProvider*/  return new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, requestProvider);
1709        case 599053666: /*requestOrganization*/  return new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, 1, requestOrganization);
1710        case -1335224239: /*detail*/  return new Property("detail", "", "List of individual settlement amounts and the corresponding transaction.", 0, java.lang.Integer.MAX_VALUE, detail);
1711        case 3148996: /*form*/  return new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form);
1712        case 110549828: /*total*/  return new Property("total", "Money", "Total payment amount.", 0, 1, total);
1713        case 202339073: /*processNote*/  return new Property("processNote", "", "Suite of notes.", 0, java.lang.Integer.MAX_VALUE, processNote);
1714        default: return super.getNamedProperty(_hash, _name, _checkValid);
1715        }
1716
1717      }
1718
1719      @Override
1720      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1721        switch (hash) {
1722        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1723        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PaymentReconciliationStatus>
1724        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1725        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
1726        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
1727        case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
1728        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
1729        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
1730        case 1601527200: /*requestProvider*/ return this.requestProvider == null ? new Base[0] : new Base[] {this.requestProvider}; // Reference
1731        case 599053666: /*requestOrganization*/ return this.requestOrganization == null ? new Base[0] : new Base[] {this.requestOrganization}; // Reference
1732        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailsComponent
1733        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
1734        case 110549828: /*total*/ return this.total == null ? new Base[0] : new Base[] {this.total}; // Money
1735        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NotesComponent
1736        default: return super.getProperty(hash, name, checkValid);
1737        }
1738
1739      }
1740
1741      @Override
1742      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1743        switch (hash) {
1744        case -1618432855: // identifier
1745          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1746          return value;
1747        case -892481550: // status
1748          value = new PaymentReconciliationStatusEnumFactory().fromType(castToCode(value));
1749          this.status = (Enumeration) value; // Enumeration<PaymentReconciliationStatus>
1750          return value;
1751        case -991726143: // period
1752          this.period = castToPeriod(value); // Period
1753          return value;
1754        case 1028554472: // created
1755          this.created = castToDateTime(value); // DateTimeType
1756          return value;
1757        case 1178922291: // organization
1758          this.organization = castToReference(value); // Reference
1759          return value;
1760        case 1095692943: // request
1761          this.request = castToReference(value); // Reference
1762          return value;
1763        case -1106507950: // outcome
1764          this.outcome = castToCodeableConcept(value); // CodeableConcept
1765          return value;
1766        case 583380919: // disposition
1767          this.disposition = castToString(value); // StringType
1768          return value;
1769        case 1601527200: // requestProvider
1770          this.requestProvider = castToReference(value); // Reference
1771          return value;
1772        case 599053666: // requestOrganization
1773          this.requestOrganization = castToReference(value); // Reference
1774          return value;
1775        case -1335224239: // detail
1776          this.getDetail().add((DetailsComponent) value); // DetailsComponent
1777          return value;
1778        case 3148996: // form
1779          this.form = castToCodeableConcept(value); // CodeableConcept
1780          return value;
1781        case 110549828: // total
1782          this.total = castToMoney(value); // Money
1783          return value;
1784        case 202339073: // processNote
1785          this.getProcessNote().add((NotesComponent) value); // NotesComponent
1786          return value;
1787        default: return super.setProperty(hash, name, value);
1788        }
1789
1790      }
1791
1792      @Override
1793      public Base setProperty(String name, Base value) throws FHIRException {
1794        if (name.equals("identifier")) {
1795          this.getIdentifier().add(castToIdentifier(value));
1796        } else if (name.equals("status")) {
1797          value = new PaymentReconciliationStatusEnumFactory().fromType(castToCode(value));
1798          this.status = (Enumeration) value; // Enumeration<PaymentReconciliationStatus>
1799        } else if (name.equals("period")) {
1800          this.period = castToPeriod(value); // Period
1801        } else if (name.equals("created")) {
1802          this.created = castToDateTime(value); // DateTimeType
1803        } else if (name.equals("organization")) {
1804          this.organization = castToReference(value); // Reference
1805        } else if (name.equals("request")) {
1806          this.request = castToReference(value); // Reference
1807        } else if (name.equals("outcome")) {
1808          this.outcome = castToCodeableConcept(value); // CodeableConcept
1809        } else if (name.equals("disposition")) {
1810          this.disposition = castToString(value); // StringType
1811        } else if (name.equals("requestProvider")) {
1812          this.requestProvider = castToReference(value); // Reference
1813        } else if (name.equals("requestOrganization")) {
1814          this.requestOrganization = castToReference(value); // Reference
1815        } else if (name.equals("detail")) {
1816          this.getDetail().add((DetailsComponent) value);
1817        } else if (name.equals("form")) {
1818          this.form = castToCodeableConcept(value); // CodeableConcept
1819        } else if (name.equals("total")) {
1820          this.total = castToMoney(value); // Money
1821        } else if (name.equals("processNote")) {
1822          this.getProcessNote().add((NotesComponent) value);
1823        } else
1824          return super.setProperty(name, value);
1825        return value;
1826      }
1827
1828      @Override
1829      public Base makeProperty(int hash, String name) throws FHIRException {
1830        switch (hash) {
1831        case -1618432855:  return addIdentifier(); 
1832        case -892481550:  return getStatusElement();
1833        case -991726143:  return getPeriod(); 
1834        case 1028554472:  return getCreatedElement();
1835        case 1178922291:  return getOrganization(); 
1836        case 1095692943:  return getRequest(); 
1837        case -1106507950:  return getOutcome(); 
1838        case 583380919:  return getDispositionElement();
1839        case 1601527200:  return getRequestProvider(); 
1840        case 599053666:  return getRequestOrganization(); 
1841        case -1335224239:  return addDetail(); 
1842        case 3148996:  return getForm(); 
1843        case 110549828:  return getTotal(); 
1844        case 202339073:  return addProcessNote(); 
1845        default: return super.makeProperty(hash, name);
1846        }
1847
1848      }
1849
1850      @Override
1851      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1852        switch (hash) {
1853        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1854        case -892481550: /*status*/ return new String[] {"code"};
1855        case -991726143: /*period*/ return new String[] {"Period"};
1856        case 1028554472: /*created*/ return new String[] {"dateTime"};
1857        case 1178922291: /*organization*/ return new String[] {"Reference"};
1858        case 1095692943: /*request*/ return new String[] {"Reference"};
1859        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
1860        case 583380919: /*disposition*/ return new String[] {"string"};
1861        case 1601527200: /*requestProvider*/ return new String[] {"Reference"};
1862        case 599053666: /*requestOrganization*/ return new String[] {"Reference"};
1863        case -1335224239: /*detail*/ return new String[] {};
1864        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
1865        case 110549828: /*total*/ return new String[] {"Money"};
1866        case 202339073: /*processNote*/ return new String[] {};
1867        default: return super.getTypesForProperty(hash, name);
1868        }
1869
1870      }
1871
1872      @Override
1873      public Base addChild(String name) throws FHIRException {
1874        if (name.equals("identifier")) {
1875          return addIdentifier();
1876        }
1877        else if (name.equals("status")) {
1878          throw new FHIRException("Cannot call addChild on a primitive type PaymentReconciliation.status");
1879        }
1880        else if (name.equals("period")) {
1881          this.period = new Period();
1882          return this.period;
1883        }
1884        else if (name.equals("created")) {
1885          throw new FHIRException("Cannot call addChild on a primitive type PaymentReconciliation.created");
1886        }
1887        else if (name.equals("organization")) {
1888          this.organization = new Reference();
1889          return this.organization;
1890        }
1891        else if (name.equals("request")) {
1892          this.request = new Reference();
1893          return this.request;
1894        }
1895        else if (name.equals("outcome")) {
1896          this.outcome = new CodeableConcept();
1897          return this.outcome;
1898        }
1899        else if (name.equals("disposition")) {
1900          throw new FHIRException("Cannot call addChild on a primitive type PaymentReconciliation.disposition");
1901        }
1902        else if (name.equals("requestProvider")) {
1903          this.requestProvider = new Reference();
1904          return this.requestProvider;
1905        }
1906        else if (name.equals("requestOrganization")) {
1907          this.requestOrganization = new Reference();
1908          return this.requestOrganization;
1909        }
1910        else if (name.equals("detail")) {
1911          return addDetail();
1912        }
1913        else if (name.equals("form")) {
1914          this.form = new CodeableConcept();
1915          return this.form;
1916        }
1917        else if (name.equals("total")) {
1918          this.total = new Money();
1919          return this.total;
1920        }
1921        else if (name.equals("processNote")) {
1922          return addProcessNote();
1923        }
1924        else
1925          return super.addChild(name);
1926      }
1927
1928  public String fhirType() {
1929    return "PaymentReconciliation";
1930
1931  }
1932
1933      public PaymentReconciliation copy() {
1934        PaymentReconciliation dst = new PaymentReconciliation();
1935        copyValues(dst);
1936        if (identifier != null) {
1937          dst.identifier = new ArrayList<Identifier>();
1938          for (Identifier i : identifier)
1939            dst.identifier.add(i.copy());
1940        };
1941        dst.status = status == null ? null : status.copy();
1942        dst.period = period == null ? null : period.copy();
1943        dst.created = created == null ? null : created.copy();
1944        dst.organization = organization == null ? null : organization.copy();
1945        dst.request = request == null ? null : request.copy();
1946        dst.outcome = outcome == null ? null : outcome.copy();
1947        dst.disposition = disposition == null ? null : disposition.copy();
1948        dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
1949        dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
1950        if (detail != null) {
1951          dst.detail = new ArrayList<DetailsComponent>();
1952          for (DetailsComponent i : detail)
1953            dst.detail.add(i.copy());
1954        };
1955        dst.form = form == null ? null : form.copy();
1956        dst.total = total == null ? null : total.copy();
1957        if (processNote != null) {
1958          dst.processNote = new ArrayList<NotesComponent>();
1959          for (NotesComponent i : processNote)
1960            dst.processNote.add(i.copy());
1961        };
1962        return dst;
1963      }
1964
1965      protected PaymentReconciliation typedCopy() {
1966        return copy();
1967      }
1968
1969      @Override
1970      public boolean equalsDeep(Base other_) {
1971        if (!super.equalsDeep(other_))
1972          return false;
1973        if (!(other_ instanceof PaymentReconciliation))
1974          return false;
1975        PaymentReconciliation o = (PaymentReconciliation) other_;
1976        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(period, o.period, true)
1977           && compareDeep(created, o.created, true) && compareDeep(organization, o.organization, true) && compareDeep(request, o.request, true)
1978           && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true) && compareDeep(requestProvider, o.requestProvider, true)
1979           && compareDeep(requestOrganization, o.requestOrganization, true) && compareDeep(detail, o.detail, true)
1980           && compareDeep(form, o.form, true) && compareDeep(total, o.total, true) && compareDeep(processNote, o.processNote, true)
1981          ;
1982      }
1983
1984      @Override
1985      public boolean equalsShallow(Base other_) {
1986        if (!super.equalsShallow(other_))
1987          return false;
1988        if (!(other_ instanceof PaymentReconciliation))
1989          return false;
1990        PaymentReconciliation o = (PaymentReconciliation) other_;
1991        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(disposition, o.disposition, true)
1992          ;
1993      }
1994
1995      public boolean isEmpty() {
1996        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, period
1997          , created, organization, request, outcome, disposition, requestProvider, requestOrganization
1998          , detail, form, total, processNote);
1999      }
2000
2001  @Override
2002  public ResourceType getResourceType() {
2003    return ResourceType.PaymentReconciliation;
2004   }
2005
2006 /**
2007   * Search parameter: <b>identifier</b>
2008   * <p>
2009   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
2010   * Type: <b>token</b><br>
2011   * Path: <b>PaymentReconciliation.identifier</b><br>
2012   * </p>
2013   */
2014  @SearchParamDefinition(name="identifier", path="PaymentReconciliation.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
2015  public static final String SP_IDENTIFIER = "identifier";
2016 /**
2017   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2018   * <p>
2019   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
2020   * Type: <b>token</b><br>
2021   * Path: <b>PaymentReconciliation.identifier</b><br>
2022   * </p>
2023   */
2024  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2025
2026 /**
2027   * Search parameter: <b>request</b>
2028   * <p>
2029   * Description: <b>The reference to the claim</b><br>
2030   * Type: <b>reference</b><br>
2031   * Path: <b>PaymentReconciliation.request</b><br>
2032   * </p>
2033   */
2034  @SearchParamDefinition(name="request", path="PaymentReconciliation.request", description="The reference to the claim", type="reference", target={ProcessRequest.class } )
2035  public static final String SP_REQUEST = "request";
2036 /**
2037   * <b>Fluent Client</b> search parameter constant for <b>request</b>
2038   * <p>
2039   * Description: <b>The reference to the claim</b><br>
2040   * Type: <b>reference</b><br>
2041   * Path: <b>PaymentReconciliation.request</b><br>
2042   * </p>
2043   */
2044  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST);
2045
2046/**
2047   * Constant for fluent queries to be used to add include statements. Specifies
2048   * the path value of "<b>PaymentReconciliation:request</b>".
2049   */
2050  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("PaymentReconciliation:request").toLocked();
2051
2052 /**
2053   * Search parameter: <b>disposition</b>
2054   * <p>
2055   * Description: <b>The contents of the disposition message</b><br>
2056   * Type: <b>string</b><br>
2057   * Path: <b>PaymentReconciliation.disposition</b><br>
2058   * </p>
2059   */
2060  @SearchParamDefinition(name="disposition", path="PaymentReconciliation.disposition", description="The contents of the disposition message", type="string" )
2061  public static final String SP_DISPOSITION = "disposition";
2062 /**
2063   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
2064   * <p>
2065   * Description: <b>The contents of the disposition message</b><br>
2066   * Type: <b>string</b><br>
2067   * Path: <b>PaymentReconciliation.disposition</b><br>
2068   * </p>
2069   */
2070  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
2071
2072 /**
2073   * Search parameter: <b>created</b>
2074   * <p>
2075   * Description: <b>The creation date</b><br>
2076   * Type: <b>date</b><br>
2077   * Path: <b>PaymentReconciliation.created</b><br>
2078   * </p>
2079   */
2080  @SearchParamDefinition(name="created", path="PaymentReconciliation.created", description="The creation date", type="date" )
2081  public static final String SP_CREATED = "created";
2082 /**
2083   * <b>Fluent Client</b> search parameter constant for <b>created</b>
2084   * <p>
2085   * Description: <b>The creation date</b><br>
2086   * Type: <b>date</b><br>
2087   * Path: <b>PaymentReconciliation.created</b><br>
2088   * </p>
2089   */
2090  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
2091
2092 /**
2093   * Search parameter: <b>organization</b>
2094   * <p>
2095   * Description: <b>The organization who generated this resource</b><br>
2096   * Type: <b>reference</b><br>
2097   * Path: <b>PaymentReconciliation.organization</b><br>
2098   * </p>
2099   */
2100  @SearchParamDefinition(name="organization", path="PaymentReconciliation.organization", description="The organization who generated this resource", type="reference", target={Organization.class } )
2101  public static final String SP_ORGANIZATION = "organization";
2102 /**
2103   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
2104   * <p>
2105   * Description: <b>The organization who generated this resource</b><br>
2106   * Type: <b>reference</b><br>
2107   * Path: <b>PaymentReconciliation.organization</b><br>
2108   * </p>
2109   */
2110  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
2111
2112/**
2113   * Constant for fluent queries to be used to add include statements. Specifies
2114   * the path value of "<b>PaymentReconciliation:organization</b>".
2115   */
2116  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("PaymentReconciliation:organization").toLocked();
2117
2118 /**
2119   * Search parameter: <b>request-organization</b>
2120   * <p>
2121   * Description: <b>The organization who generated this resource</b><br>
2122   * Type: <b>reference</b><br>
2123   * Path: <b>PaymentReconciliation.requestOrganization</b><br>
2124   * </p>
2125   */
2126  @SearchParamDefinition(name="request-organization", path="PaymentReconciliation.requestOrganization", description="The organization who generated this resource", type="reference", target={Organization.class } )
2127  public static final String SP_REQUEST_ORGANIZATION = "request-organization";
2128 /**
2129   * <b>Fluent Client</b> search parameter constant for <b>request-organization</b>
2130   * <p>
2131   * Description: <b>The organization who generated this resource</b><br>
2132   * Type: <b>reference</b><br>
2133   * Path: <b>PaymentReconciliation.requestOrganization</b><br>
2134   * </p>
2135   */
2136  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST_ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST_ORGANIZATION);
2137
2138/**
2139   * Constant for fluent queries to be used to add include statements. Specifies
2140   * the path value of "<b>PaymentReconciliation:request-organization</b>".
2141   */
2142  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST_ORGANIZATION = new ca.uhn.fhir.model.api.Include("PaymentReconciliation:request-organization").toLocked();
2143
2144 /**
2145   * Search parameter: <b>request-provider</b>
2146   * <p>
2147   * Description: <b>The reference to the provider who sumbitted the claim</b><br>
2148   * Type: <b>reference</b><br>
2149   * Path: <b>PaymentReconciliation.requestProvider</b><br>
2150   * </p>
2151   */
2152  @SearchParamDefinition(name="request-provider", path="PaymentReconciliation.requestProvider", description="The reference to the provider who sumbitted the claim", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
2153  public static final String SP_REQUEST_PROVIDER = "request-provider";
2154 /**
2155   * <b>Fluent Client</b> search parameter constant for <b>request-provider</b>
2156   * <p>
2157   * Description: <b>The reference to the provider who sumbitted the claim</b><br>
2158   * Type: <b>reference</b><br>
2159   * Path: <b>PaymentReconciliation.requestProvider</b><br>
2160   * </p>
2161   */
2162  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST_PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST_PROVIDER);
2163
2164/**
2165   * Constant for fluent queries to be used to add include statements. Specifies
2166   * the path value of "<b>PaymentReconciliation:request-provider</b>".
2167   */
2168  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST_PROVIDER = new ca.uhn.fhir.model.api.Include("PaymentReconciliation:request-provider").toLocked();
2169
2170 /**
2171   * Search parameter: <b>outcome</b>
2172   * <p>
2173   * Description: <b>The processing outcome</b><br>
2174   * Type: <b>token</b><br>
2175   * Path: <b>PaymentReconciliation.outcome</b><br>
2176   * </p>
2177   */
2178  @SearchParamDefinition(name="outcome", path="PaymentReconciliation.outcome", description="The processing outcome", type="token" )
2179  public static final String SP_OUTCOME = "outcome";
2180 /**
2181   * <b>Fluent Client</b> search parameter constant for <b>outcome</b>
2182   * <p>
2183   * Description: <b>The processing outcome</b><br>
2184   * Type: <b>token</b><br>
2185   * Path: <b>PaymentReconciliation.outcome</b><br>
2186   * </p>
2187   */
2188  public static final ca.uhn.fhir.rest.gclient.TokenClientParam OUTCOME = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_OUTCOME);
2189
2190
2191}
2192