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