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