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