001package org.hl7.fhir.dstu2.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu2
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, 
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this 
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, 
034     this list of conditions and the following disclaimer in the documentation 
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
049  POSSIBILITY OF SUCH DAMAGE.
050  
051*/
052
053// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057
058import org.hl7.fhir.dstu2.model.Enumerations.RemittanceOutcome;
059import org.hl7.fhir.dstu2.model.Enumerations.RemittanceOutcomeEnumFactory;
060import ca.uhn.fhir.model.api.annotation.Block;
061import ca.uhn.fhir.model.api.annotation.Child;
062import ca.uhn.fhir.model.api.annotation.Description;
063import ca.uhn.fhir.model.api.annotation.ResourceDef;
064import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
065import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
066import org.hl7.fhir.exceptions.FHIRException;
067import org.hl7.fhir.utilities.Utilities;
068/**
069 * This resource provides payment details and claim references supporting a bulk payment.
070 */
071@ResourceDef(name="PaymentReconciliation", profile="http://hl7.org/fhir/Profile/PaymentReconciliation")
072public class PaymentReconciliation extends DomainResource {
073
074    @Block()
075    public static class DetailsComponent extends BackboneElement implements IBaseBackboneElement {
076        /**
077         * Code to indicate the nature of the payment, adjustment, funds advance, etc.
078         */
079        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
080        @Description(shortDefinition="Type code", formalDefinition="Code to indicate the nature of the payment, adjustment, funds advance, etc." )
081        protected Coding type;
082
083        /**
084         * The claim or financial resource.
085         */
086        @Child(name = "request", type = {}, order=2, min=0, max=1, modifier=false, summary=true)
087        @Description(shortDefinition="Claim", formalDefinition="The claim or financial resource." )
088        protected Reference request;
089
090        /**
091         * The actual object that is the target of the reference (The claim or financial resource.)
092         */
093        protected Resource requestTarget;
094
095        /**
096         * The claim response resource.
097         */
098        @Child(name = "responce", type = {}, order=3, min=0, max=1, modifier=false, summary=true)
099        @Description(shortDefinition="Claim Response", formalDefinition="The claim response resource." )
100        protected Reference responce;
101
102        /**
103         * The actual object that is the target of the reference (The claim response resource.)
104         */
105        protected Resource responceTarget;
106
107        /**
108         * The Organization which submitted the invoice or financial transaction.
109         */
110        @Child(name = "submitter", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=true)
111        @Description(shortDefinition="Submitter", formalDefinition="The Organization which submitted the invoice or financial transaction." )
112        protected Reference submitter;
113
114        /**
115         * The actual object that is the target of the reference (The Organization which submitted the invoice or financial transaction.)
116         */
117        protected Organization submitterTarget;
118
119        /**
120         * The organization which is receiving the payment.
121         */
122        @Child(name = "payee", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=true)
123        @Description(shortDefinition="Payee", formalDefinition="The organization which is receiving the payment." )
124        protected Reference payee;
125
126        /**
127         * The actual object that is the target of the reference (The organization which is receiving the payment.)
128         */
129        protected Organization payeeTarget;
130
131        /**
132         * The date of the invoice or financial resource.
133         */
134        @Child(name = "date", type = {DateType.class}, order=6, min=0, max=1, modifier=false, summary=true)
135        @Description(shortDefinition="Invoice date", formalDefinition="The date of the invoice or financial resource." )
136        protected DateType date;
137
138        /**
139         * Amount paid for this detail.
140         */
141        @Child(name = "amount", type = {Money.class}, order=7, min=0, max=1, modifier=false, summary=true)
142        @Description(shortDefinition="Detail amount", formalDefinition="Amount paid for this detail." )
143        protected Money amount;
144
145        private static final long serialVersionUID = -1644048062L;
146
147    /*
148     * Constructor
149     */
150      public DetailsComponent() {
151        super();
152      }
153
154    /*
155     * Constructor
156     */
157      public DetailsComponent(Coding type) {
158        super();
159        this.type = type;
160      }
161
162        /**
163         * @return {@link #type} (Code to indicate the nature of the payment, adjustment, funds advance, etc.)
164         */
165        public Coding getType() { 
166          if (this.type == null)
167            if (Configuration.errorOnAutoCreate())
168              throw new Error("Attempt to auto-create DetailsComponent.type");
169            else if (Configuration.doAutoCreate())
170              this.type = new Coding(); // cc
171          return this.type;
172        }
173
174        public boolean hasType() { 
175          return this.type != null && !this.type.isEmpty();
176        }
177
178        /**
179         * @param value {@link #type} (Code to indicate the nature of the payment, adjustment, funds advance, etc.)
180         */
181        public DetailsComponent setType(Coding value) { 
182          this.type = value;
183          return this;
184        }
185
186        /**
187         * @return {@link #request} (The claim or financial resource.)
188         */
189        public Reference getRequest() { 
190          if (this.request == null)
191            if (Configuration.errorOnAutoCreate())
192              throw new Error("Attempt to auto-create DetailsComponent.request");
193            else if (Configuration.doAutoCreate())
194              this.request = new Reference(); // cc
195          return this.request;
196        }
197
198        public boolean hasRequest() { 
199          return this.request != null && !this.request.isEmpty();
200        }
201
202        /**
203         * @param value {@link #request} (The claim or financial resource.)
204         */
205        public DetailsComponent setRequest(Reference value) { 
206          this.request = value;
207          return this;
208        }
209
210        /**
211         * @return {@link #request} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The claim or financial resource.)
212         */
213        public Resource getRequestTarget() { 
214          return this.requestTarget;
215        }
216
217        /**
218         * @param value {@link #request} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The claim or financial resource.)
219         */
220        public DetailsComponent setRequestTarget(Resource value) { 
221          this.requestTarget = value;
222          return this;
223        }
224
225        /**
226         * @return {@link #responce} (The claim response resource.)
227         */
228        public Reference getResponce() { 
229          if (this.responce == null)
230            if (Configuration.errorOnAutoCreate())
231              throw new Error("Attempt to auto-create DetailsComponent.responce");
232            else if (Configuration.doAutoCreate())
233              this.responce = new Reference(); // cc
234          return this.responce;
235        }
236
237        public boolean hasResponce() { 
238          return this.responce != null && !this.responce.isEmpty();
239        }
240
241        /**
242         * @param value {@link #responce} (The claim response resource.)
243         */
244        public DetailsComponent setResponce(Reference value) { 
245          this.responce = value;
246          return this;
247        }
248
249        /**
250         * @return {@link #responce} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The claim response resource.)
251         */
252        public Resource getResponceTarget() { 
253          return this.responceTarget;
254        }
255
256        /**
257         * @param value {@link #responce} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The claim response resource.)
258         */
259        public DetailsComponent setResponceTarget(Resource value) { 
260          this.responceTarget = value;
261          return this;
262        }
263
264        /**
265         * @return {@link #submitter} (The Organization which submitted the invoice or financial transaction.)
266         */
267        public Reference getSubmitter() { 
268          if (this.submitter == null)
269            if (Configuration.errorOnAutoCreate())
270              throw new Error("Attempt to auto-create DetailsComponent.submitter");
271            else if (Configuration.doAutoCreate())
272              this.submitter = new Reference(); // cc
273          return this.submitter;
274        }
275
276        public boolean hasSubmitter() { 
277          return this.submitter != null && !this.submitter.isEmpty();
278        }
279
280        /**
281         * @param value {@link #submitter} (The Organization which submitted the invoice or financial transaction.)
282         */
283        public DetailsComponent setSubmitter(Reference value) { 
284          this.submitter = value;
285          return this;
286        }
287
288        /**
289         * @return {@link #submitter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Organization which submitted the invoice or financial transaction.)
290         */
291        public Organization getSubmitterTarget() { 
292          if (this.submitterTarget == null)
293            if (Configuration.errorOnAutoCreate())
294              throw new Error("Attempt to auto-create DetailsComponent.submitter");
295            else if (Configuration.doAutoCreate())
296              this.submitterTarget = new Organization(); // aa
297          return this.submitterTarget;
298        }
299
300        /**
301         * @param value {@link #submitter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Organization which submitted the invoice or financial transaction.)
302         */
303        public DetailsComponent setSubmitterTarget(Organization value) { 
304          this.submitterTarget = value;
305          return this;
306        }
307
308        /**
309         * @return {@link #payee} (The organization which is receiving the payment.)
310         */
311        public Reference getPayee() { 
312          if (this.payee == null)
313            if (Configuration.errorOnAutoCreate())
314              throw new Error("Attempt to auto-create DetailsComponent.payee");
315            else if (Configuration.doAutoCreate())
316              this.payee = new Reference(); // cc
317          return this.payee;
318        }
319
320        public boolean hasPayee() { 
321          return this.payee != null && !this.payee.isEmpty();
322        }
323
324        /**
325         * @param value {@link #payee} (The organization which is receiving the payment.)
326         */
327        public DetailsComponent setPayee(Reference value) { 
328          this.payee = value;
329          return this;
330        }
331
332        /**
333         * @return {@link #payee} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is receiving the payment.)
334         */
335        public Organization getPayeeTarget() { 
336          if (this.payeeTarget == null)
337            if (Configuration.errorOnAutoCreate())
338              throw new Error("Attempt to auto-create DetailsComponent.payee");
339            else if (Configuration.doAutoCreate())
340              this.payeeTarget = new Organization(); // aa
341          return this.payeeTarget;
342        }
343
344        /**
345         * @param value {@link #payee} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is receiving the payment.)
346         */
347        public DetailsComponent setPayeeTarget(Organization value) { 
348          this.payeeTarget = value;
349          return this;
350        }
351
352        /**
353         * @return {@link #date} (The date of the invoice or financial resource.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
354         */
355        public DateType getDateElement() { 
356          if (this.date == null)
357            if (Configuration.errorOnAutoCreate())
358              throw new Error("Attempt to auto-create DetailsComponent.date");
359            else if (Configuration.doAutoCreate())
360              this.date = new DateType(); // bb
361          return this.date;
362        }
363
364        public boolean hasDateElement() { 
365          return this.date != null && !this.date.isEmpty();
366        }
367
368        public boolean hasDate() { 
369          return this.date != null && !this.date.isEmpty();
370        }
371
372        /**
373         * @param value {@link #date} (The date of the invoice or financial resource.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
374         */
375        public DetailsComponent setDateElement(DateType value) { 
376          this.date = value;
377          return this;
378        }
379
380        /**
381         * @return The date of the invoice or financial resource.
382         */
383        public Date getDate() { 
384          return this.date == null ? null : this.date.getValue();
385        }
386
387        /**
388         * @param value The date of the invoice or financial resource.
389         */
390        public DetailsComponent setDate(Date value) { 
391          if (value == null)
392            this.date = null;
393          else {
394            if (this.date == null)
395              this.date = new DateType();
396            this.date.setValue(value);
397          }
398          return this;
399        }
400
401        /**
402         * @return {@link #amount} (Amount paid for this detail.)
403         */
404        public Money getAmount() { 
405          if (this.amount == null)
406            if (Configuration.errorOnAutoCreate())
407              throw new Error("Attempt to auto-create DetailsComponent.amount");
408            else if (Configuration.doAutoCreate())
409              this.amount = new Money(); // cc
410          return this.amount;
411        }
412
413        public boolean hasAmount() { 
414          return this.amount != null && !this.amount.isEmpty();
415        }
416
417        /**
418         * @param value {@link #amount} (Amount paid for this detail.)
419         */
420        public DetailsComponent setAmount(Money value) { 
421          this.amount = value;
422          return this;
423        }
424
425        protected void listChildren(List<Property> childrenList) {
426          super.listChildren(childrenList);
427          childrenList.add(new Property("type", "Coding", "Code to indicate the nature of the payment, adjustment, funds advance, etc.", 0, java.lang.Integer.MAX_VALUE, type));
428          childrenList.add(new Property("request", "Reference(Any)", "The claim or financial resource.", 0, java.lang.Integer.MAX_VALUE, request));
429          childrenList.add(new Property("responce", "Reference(Any)", "The claim response resource.", 0, java.lang.Integer.MAX_VALUE, responce));
430          childrenList.add(new Property("submitter", "Reference(Organization)", "The Organization which submitted the invoice or financial transaction.", 0, java.lang.Integer.MAX_VALUE, submitter));
431          childrenList.add(new Property("payee", "Reference(Organization)", "The organization which is receiving the payment.", 0, java.lang.Integer.MAX_VALUE, payee));
432          childrenList.add(new Property("date", "date", "The date of the invoice or financial resource.", 0, java.lang.Integer.MAX_VALUE, date));
433          childrenList.add(new Property("amount", "Money", "Amount paid for this detail.", 0, java.lang.Integer.MAX_VALUE, amount));
434        }
435
436      @Override
437      public void setProperty(String name, Base value) throws FHIRException {
438        if (name.equals("type"))
439          this.type = castToCoding(value); // Coding
440        else if (name.equals("request"))
441          this.request = castToReference(value); // Reference
442        else if (name.equals("responce"))
443          this.responce = castToReference(value); // Reference
444        else if (name.equals("submitter"))
445          this.submitter = castToReference(value); // Reference
446        else if (name.equals("payee"))
447          this.payee = castToReference(value); // Reference
448        else if (name.equals("date"))
449          this.date = castToDate(value); // DateType
450        else if (name.equals("amount"))
451          this.amount = castToMoney(value); // Money
452        else
453          super.setProperty(name, value);
454      }
455
456      @Override
457      public Base addChild(String name) throws FHIRException {
458        if (name.equals("type")) {
459          this.type = new Coding();
460          return this.type;
461        }
462        else if (name.equals("request")) {
463          this.request = new Reference();
464          return this.request;
465        }
466        else if (name.equals("responce")) {
467          this.responce = new Reference();
468          return this.responce;
469        }
470        else if (name.equals("submitter")) {
471          this.submitter = new Reference();
472          return this.submitter;
473        }
474        else if (name.equals("payee")) {
475          this.payee = new Reference();
476          return this.payee;
477        }
478        else if (name.equals("date")) {
479          throw new FHIRException("Cannot call addChild on a primitive type PaymentReconciliation.date");
480        }
481        else if (name.equals("amount")) {
482          this.amount = new Money();
483          return this.amount;
484        }
485        else
486          return super.addChild(name);
487      }
488
489      public DetailsComponent copy() {
490        DetailsComponent dst = new DetailsComponent();
491        copyValues(dst);
492        dst.type = type == null ? null : type.copy();
493        dst.request = request == null ? null : request.copy();
494        dst.responce = responce == null ? null : responce.copy();
495        dst.submitter = submitter == null ? null : submitter.copy();
496        dst.payee = payee == null ? null : payee.copy();
497        dst.date = date == null ? null : date.copy();
498        dst.amount = amount == null ? null : amount.copy();
499        return dst;
500      }
501
502      @Override
503      public boolean equalsDeep(Base other) {
504        if (!super.equalsDeep(other))
505          return false;
506        if (!(other instanceof DetailsComponent))
507          return false;
508        DetailsComponent o = (DetailsComponent) other;
509        return compareDeep(type, o.type, true) && compareDeep(request, o.request, true) && compareDeep(responce, o.responce, true)
510           && compareDeep(submitter, o.submitter, true) && compareDeep(payee, o.payee, true) && compareDeep(date, o.date, true)
511           && compareDeep(amount, o.amount, true);
512      }
513
514      @Override
515      public boolean equalsShallow(Base other) {
516        if (!super.equalsShallow(other))
517          return false;
518        if (!(other instanceof DetailsComponent))
519          return false;
520        DetailsComponent o = (DetailsComponent) other;
521        return compareValues(date, o.date, true);
522      }
523
524      public boolean isEmpty() {
525        return super.isEmpty() && (type == null || type.isEmpty()) && (request == null || request.isEmpty())
526           && (responce == null || responce.isEmpty()) && (submitter == null || submitter.isEmpty())
527           && (payee == null || payee.isEmpty()) && (date == null || date.isEmpty()) && (amount == null || amount.isEmpty())
528          ;
529      }
530
531  public String fhirType() {
532    return "PaymentReconciliation.detail";
533
534  }
535
536  }
537
538    @Block()
539    public static class NotesComponent extends BackboneElement implements IBaseBackboneElement {
540        /**
541         * The note purpose: Print/Display.
542         */
543        @Child(name = "type", type = {Coding.class}, order=1, min=0, max=1, modifier=false, summary=true)
544        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
545        protected Coding type;
546
547        /**
548         * The note text.
549         */
550        @Child(name = "text", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
551        @Description(shortDefinition="Notes text", formalDefinition="The note text." )
552        protected StringType text;
553
554        private static final long serialVersionUID = 129959202L;
555
556    /*
557     * Constructor
558     */
559      public NotesComponent() {
560        super();
561      }
562
563        /**
564         * @return {@link #type} (The note purpose: Print/Display.)
565         */
566        public Coding getType() { 
567          if (this.type == null)
568            if (Configuration.errorOnAutoCreate())
569              throw new Error("Attempt to auto-create NotesComponent.type");
570            else if (Configuration.doAutoCreate())
571              this.type = new Coding(); // cc
572          return this.type;
573        }
574
575        public boolean hasType() { 
576          return this.type != null && !this.type.isEmpty();
577        }
578
579        /**
580         * @param value {@link #type} (The note purpose: Print/Display.)
581         */
582        public NotesComponent setType(Coding value) { 
583          this.type = value;
584          return this;
585        }
586
587        /**
588         * @return {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
589         */
590        public StringType getTextElement() { 
591          if (this.text == null)
592            if (Configuration.errorOnAutoCreate())
593              throw new Error("Attempt to auto-create NotesComponent.text");
594            else if (Configuration.doAutoCreate())
595              this.text = new StringType(); // bb
596          return this.text;
597        }
598
599        public boolean hasTextElement() { 
600          return this.text != null && !this.text.isEmpty();
601        }
602
603        public boolean hasText() { 
604          return this.text != null && !this.text.isEmpty();
605        }
606
607        /**
608         * @param value {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
609         */
610        public NotesComponent setTextElement(StringType value) { 
611          this.text = value;
612          return this;
613        }
614
615        /**
616         * @return The note text.
617         */
618        public String getText() { 
619          return this.text == null ? null : this.text.getValue();
620        }
621
622        /**
623         * @param value The note text.
624         */
625        public NotesComponent setText(String value) { 
626          if (Utilities.noString(value))
627            this.text = null;
628          else {
629            if (this.text == null)
630              this.text = new StringType();
631            this.text.setValue(value);
632          }
633          return this;
634        }
635
636        protected void listChildren(List<Property> childrenList) {
637          super.listChildren(childrenList);
638          childrenList.add(new Property("type", "Coding", "The note purpose: Print/Display.", 0, java.lang.Integer.MAX_VALUE, type));
639          childrenList.add(new Property("text", "string", "The note text.", 0, java.lang.Integer.MAX_VALUE, text));
640        }
641
642      @Override
643      public void setProperty(String name, Base value) throws FHIRException {
644        if (name.equals("type"))
645          this.type = castToCoding(value); // Coding
646        else if (name.equals("text"))
647          this.text = castToString(value); // StringType
648        else
649          super.setProperty(name, value);
650      }
651
652      @Override
653      public Base addChild(String name) throws FHIRException {
654        if (name.equals("type")) {
655          this.type = new Coding();
656          return this.type;
657        }
658        else if (name.equals("text")) {
659          throw new FHIRException("Cannot call addChild on a primitive type PaymentReconciliation.text");
660        }
661        else
662          return super.addChild(name);
663      }
664
665      public NotesComponent copy() {
666        NotesComponent dst = new NotesComponent();
667        copyValues(dst);
668        dst.type = type == null ? null : type.copy();
669        dst.text = text == null ? null : text.copy();
670        return dst;
671      }
672
673      @Override
674      public boolean equalsDeep(Base other) {
675        if (!super.equalsDeep(other))
676          return false;
677        if (!(other instanceof NotesComponent))
678          return false;
679        NotesComponent o = (NotesComponent) other;
680        return compareDeep(type, o.type, true) && compareDeep(text, o.text, true);
681      }
682
683      @Override
684      public boolean equalsShallow(Base other) {
685        if (!super.equalsShallow(other))
686          return false;
687        if (!(other instanceof NotesComponent))
688          return false;
689        NotesComponent o = (NotesComponent) other;
690        return compareValues(text, o.text, true);
691      }
692
693      public boolean isEmpty() {
694        return super.isEmpty() && (type == null || type.isEmpty()) && (text == null || text.isEmpty())
695          ;
696      }
697
698  public String fhirType() {
699    return "PaymentReconciliation.note";
700
701  }
702
703  }
704
705    /**
706     * The Response business identifier.
707     */
708    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
709    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
710    protected List<Identifier> identifier;
711
712    /**
713     * Original request resource reference.
714     */
715    @Child(name = "request", type = {ProcessRequest.class}, order=1, min=0, max=1, modifier=false, summary=true)
716    @Description(shortDefinition="Claim reference", formalDefinition="Original request resource reference." )
717    protected Reference request;
718
719    /**
720     * The actual object that is the target of the reference (Original request resource reference.)
721     */
722    protected ProcessRequest requestTarget;
723
724    /**
725     * Transaction status: error, complete.
726     */
727    @Child(name = "outcome", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
728    @Description(shortDefinition="complete | error", formalDefinition="Transaction status: error, complete." )
729    protected Enumeration<RemittanceOutcome> outcome;
730
731    /**
732     * A description of the status of the adjudication.
733     */
734    @Child(name = "disposition", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
735    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
736    protected StringType disposition;
737
738    /**
739     * The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
740     */
741    @Child(name = "ruleset", type = {Coding.class}, order=4, min=0, max=1, modifier=false, summary=true)
742    @Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." )
743    protected Coding ruleset;
744
745    /**
746     * The style (standard) and version of the original material which was converted into this resource.
747     */
748    @Child(name = "originalRuleset", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
749    @Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
750    protected Coding originalRuleset;
751
752    /**
753     * The date when the enclosed suite of services were performed or completed.
754     */
755    @Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
756    @Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
757    protected DateTimeType created;
758
759    /**
760     * The period of time for which payments have been gathered into this bulk payment for settlement.
761     */
762    @Child(name = "period", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
763    @Description(shortDefinition="Period covered", formalDefinition="The period of time for which payments have been gathered into this bulk payment for settlement." )
764    protected Period period;
765
766    /**
767     * The Insurer who produced this adjudicated response.
768     */
769    @Child(name = "organization", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=true)
770    @Description(shortDefinition="Insurer", formalDefinition="The Insurer who produced this adjudicated response." )
771    protected Reference organization;
772
773    /**
774     * The actual object that is the target of the reference (The Insurer who produced this adjudicated response.)
775     */
776    protected Organization organizationTarget;
777
778    /**
779     * The practitioner who is responsible for the services rendered to the patient.
780     */
781    @Child(name = "requestProvider", type = {Practitioner.class}, order=9, min=0, max=1, modifier=false, summary=true)
782    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
783    protected Reference requestProvider;
784
785    /**
786     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
787     */
788    protected Practitioner requestProviderTarget;
789
790    /**
791     * The organization which is responsible for the services rendered to the patient.
792     */
793    @Child(name = "requestOrganization", type = {Organization.class}, order=10, min=0, max=1, modifier=false, summary=true)
794    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
795    protected Reference requestOrganization;
796
797    /**
798     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
799     */
800    protected Organization requestOrganizationTarget;
801
802    /**
803     * List of individual settlement amounts and the corresponding transaction.
804     */
805    @Child(name = "detail", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
806    @Description(shortDefinition="Details", formalDefinition="List of individual settlement amounts and the corresponding transaction." )
807    protected List<DetailsComponent> detail;
808
809    /**
810     * The form to be used for printing the content.
811     */
812    @Child(name = "form", type = {Coding.class}, order=12, min=0, max=1, modifier=false, summary=true)
813    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
814    protected Coding form;
815
816    /**
817     * Total payment amount.
818     */
819    @Child(name = "total", type = {Money.class}, order=13, min=1, max=1, modifier=false, summary=true)
820    @Description(shortDefinition="Total amount of Payment", formalDefinition="Total payment amount." )
821    protected Money total;
822
823    /**
824     * Suite of notes.
825     */
826    @Child(name = "note", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
827    @Description(shortDefinition="Note text", formalDefinition="Suite of notes." )
828    protected List<NotesComponent> note;
829
830    private static final long serialVersionUID = 454328025L;
831
832  /*
833   * Constructor
834   */
835    public PaymentReconciliation() {
836      super();
837    }
838
839  /*
840   * Constructor
841   */
842    public PaymentReconciliation(Money total) {
843      super();
844      this.total = total;
845    }
846
847    /**
848     * @return {@link #identifier} (The Response business identifier.)
849     */
850    public List<Identifier> getIdentifier() { 
851      if (this.identifier == null)
852        this.identifier = new ArrayList<Identifier>();
853      return this.identifier;
854    }
855
856    public boolean hasIdentifier() { 
857      if (this.identifier == null)
858        return false;
859      for (Identifier item : this.identifier)
860        if (!item.isEmpty())
861          return true;
862      return false;
863    }
864
865    /**
866     * @return {@link #identifier} (The Response business identifier.)
867     */
868    // syntactic sugar
869    public Identifier addIdentifier() { //3
870      Identifier t = new Identifier();
871      if (this.identifier == null)
872        this.identifier = new ArrayList<Identifier>();
873      this.identifier.add(t);
874      return t;
875    }
876
877    // syntactic sugar
878    public PaymentReconciliation addIdentifier(Identifier t) { //3
879      if (t == null)
880        return this;
881      if (this.identifier == null)
882        this.identifier = new ArrayList<Identifier>();
883      this.identifier.add(t);
884      return this;
885    }
886
887    /**
888     * @return {@link #request} (Original request resource reference.)
889     */
890    public Reference getRequest() { 
891      if (this.request == null)
892        if (Configuration.errorOnAutoCreate())
893          throw new Error("Attempt to auto-create PaymentReconciliation.request");
894        else if (Configuration.doAutoCreate())
895          this.request = new Reference(); // cc
896      return this.request;
897    }
898
899    public boolean hasRequest() { 
900      return this.request != null && !this.request.isEmpty();
901    }
902
903    /**
904     * @param value {@link #request} (Original request resource reference.)
905     */
906    public PaymentReconciliation setRequest(Reference value) { 
907      this.request = value;
908      return this;
909    }
910
911    /**
912     * @return {@link #request} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
913     */
914    public ProcessRequest getRequestTarget() { 
915      if (this.requestTarget == null)
916        if (Configuration.errorOnAutoCreate())
917          throw new Error("Attempt to auto-create PaymentReconciliation.request");
918        else if (Configuration.doAutoCreate())
919          this.requestTarget = new ProcessRequest(); // aa
920      return this.requestTarget;
921    }
922
923    /**
924     * @param value {@link #request} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
925     */
926    public PaymentReconciliation setRequestTarget(ProcessRequest value) { 
927      this.requestTarget = value;
928      return this;
929    }
930
931    /**
932     * @return {@link #outcome} (Transaction status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
933     */
934    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
935      if (this.outcome == null)
936        if (Configuration.errorOnAutoCreate())
937          throw new Error("Attempt to auto-create PaymentReconciliation.outcome");
938        else if (Configuration.doAutoCreate())
939          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
940      return this.outcome;
941    }
942
943    public boolean hasOutcomeElement() { 
944      return this.outcome != null && !this.outcome.isEmpty();
945    }
946
947    public boolean hasOutcome() { 
948      return this.outcome != null && !this.outcome.isEmpty();
949    }
950
951    /**
952     * @param value {@link #outcome} (Transaction status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
953     */
954    public PaymentReconciliation setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
955      this.outcome = value;
956      return this;
957    }
958
959    /**
960     * @return Transaction status: error, complete.
961     */
962    public RemittanceOutcome getOutcome() { 
963      return this.outcome == null ? null : this.outcome.getValue();
964    }
965
966    /**
967     * @param value Transaction status: error, complete.
968     */
969    public PaymentReconciliation setOutcome(RemittanceOutcome value) { 
970      if (value == null)
971        this.outcome = null;
972      else {
973        if (this.outcome == null)
974          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
975        this.outcome.setValue(value);
976      }
977      return this;
978    }
979
980    /**
981     * @return {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
982     */
983    public StringType getDispositionElement() { 
984      if (this.disposition == null)
985        if (Configuration.errorOnAutoCreate())
986          throw new Error("Attempt to auto-create PaymentReconciliation.disposition");
987        else if (Configuration.doAutoCreate())
988          this.disposition = new StringType(); // bb
989      return this.disposition;
990    }
991
992    public boolean hasDispositionElement() { 
993      return this.disposition != null && !this.disposition.isEmpty();
994    }
995
996    public boolean hasDisposition() { 
997      return this.disposition != null && !this.disposition.isEmpty();
998    }
999
1000    /**
1001     * @param value {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
1002     */
1003    public PaymentReconciliation setDispositionElement(StringType value) { 
1004      this.disposition = value;
1005      return this;
1006    }
1007
1008    /**
1009     * @return A description of the status of the adjudication.
1010     */
1011    public String getDisposition() { 
1012      return this.disposition == null ? null : this.disposition.getValue();
1013    }
1014
1015    /**
1016     * @param value A description of the status of the adjudication.
1017     */
1018    public PaymentReconciliation setDisposition(String value) { 
1019      if (Utilities.noString(value))
1020        this.disposition = null;
1021      else {
1022        if (this.disposition == null)
1023          this.disposition = new StringType();
1024        this.disposition.setValue(value);
1025      }
1026      return this;
1027    }
1028
1029    /**
1030     * @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
1031     */
1032    public Coding getRuleset() { 
1033      if (this.ruleset == null)
1034        if (Configuration.errorOnAutoCreate())
1035          throw new Error("Attempt to auto-create PaymentReconciliation.ruleset");
1036        else if (Configuration.doAutoCreate())
1037          this.ruleset = new Coding(); // cc
1038      return this.ruleset;
1039    }
1040
1041    public boolean hasRuleset() { 
1042      return this.ruleset != null && !this.ruleset.isEmpty();
1043    }
1044
1045    /**
1046     * @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
1047     */
1048    public PaymentReconciliation setRuleset(Coding value) { 
1049      this.ruleset = value;
1050      return this;
1051    }
1052
1053    /**
1054     * @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
1055     */
1056    public Coding getOriginalRuleset() { 
1057      if (this.originalRuleset == null)
1058        if (Configuration.errorOnAutoCreate())
1059          throw new Error("Attempt to auto-create PaymentReconciliation.originalRuleset");
1060        else if (Configuration.doAutoCreate())
1061          this.originalRuleset = new Coding(); // cc
1062      return this.originalRuleset;
1063    }
1064
1065    public boolean hasOriginalRuleset() { 
1066      return this.originalRuleset != null && !this.originalRuleset.isEmpty();
1067    }
1068
1069    /**
1070     * @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
1071     */
1072    public PaymentReconciliation setOriginalRuleset(Coding value) { 
1073      this.originalRuleset = value;
1074      return this;
1075    }
1076
1077    /**
1078     * @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1079     */
1080    public DateTimeType getCreatedElement() { 
1081      if (this.created == null)
1082        if (Configuration.errorOnAutoCreate())
1083          throw new Error("Attempt to auto-create PaymentReconciliation.created");
1084        else if (Configuration.doAutoCreate())
1085          this.created = new DateTimeType(); // bb
1086      return this.created;
1087    }
1088
1089    public boolean hasCreatedElement() { 
1090      return this.created != null && !this.created.isEmpty();
1091    }
1092
1093    public boolean hasCreated() { 
1094      return this.created != null && !this.created.isEmpty();
1095    }
1096
1097    /**
1098     * @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1099     */
1100    public PaymentReconciliation setCreatedElement(DateTimeType value) { 
1101      this.created = value;
1102      return this;
1103    }
1104
1105    /**
1106     * @return The date when the enclosed suite of services were performed or completed.
1107     */
1108    public Date getCreated() { 
1109      return this.created == null ? null : this.created.getValue();
1110    }
1111
1112    /**
1113     * @param value The date when the enclosed suite of services were performed or completed.
1114     */
1115    public PaymentReconciliation setCreated(Date value) { 
1116      if (value == null)
1117        this.created = null;
1118      else {
1119        if (this.created == null)
1120          this.created = new DateTimeType();
1121        this.created.setValue(value);
1122      }
1123      return this;
1124    }
1125
1126    /**
1127     * @return {@link #period} (The period of time for which payments have been gathered into this bulk payment for settlement.)
1128     */
1129    public Period getPeriod() { 
1130      if (this.period == null)
1131        if (Configuration.errorOnAutoCreate())
1132          throw new Error("Attempt to auto-create PaymentReconciliation.period");
1133        else if (Configuration.doAutoCreate())
1134          this.period = new Period(); // cc
1135      return this.period;
1136    }
1137
1138    public boolean hasPeriod() { 
1139      return this.period != null && !this.period.isEmpty();
1140    }
1141
1142    /**
1143     * @param value {@link #period} (The period of time for which payments have been gathered into this bulk payment for settlement.)
1144     */
1145    public PaymentReconciliation setPeriod(Period value) { 
1146      this.period = value;
1147      return this;
1148    }
1149
1150    /**
1151     * @return {@link #organization} (The Insurer who produced this adjudicated response.)
1152     */
1153    public Reference getOrganization() { 
1154      if (this.organization == null)
1155        if (Configuration.errorOnAutoCreate())
1156          throw new Error("Attempt to auto-create PaymentReconciliation.organization");
1157        else if (Configuration.doAutoCreate())
1158          this.organization = new Reference(); // cc
1159      return this.organization;
1160    }
1161
1162    public boolean hasOrganization() { 
1163      return this.organization != null && !this.organization.isEmpty();
1164    }
1165
1166    /**
1167     * @param value {@link #organization} (The Insurer who produced this adjudicated response.)
1168     */
1169    public PaymentReconciliation setOrganization(Reference value) { 
1170      this.organization = value;
1171      return this;
1172    }
1173
1174    /**
1175     * @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
1176     */
1177    public Organization getOrganizationTarget() { 
1178      if (this.organizationTarget == null)
1179        if (Configuration.errorOnAutoCreate())
1180          throw new Error("Attempt to auto-create PaymentReconciliation.organization");
1181        else if (Configuration.doAutoCreate())
1182          this.organizationTarget = new Organization(); // aa
1183      return this.organizationTarget;
1184    }
1185
1186    /**
1187     * @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
1188     */
1189    public PaymentReconciliation setOrganizationTarget(Organization value) { 
1190      this.organizationTarget = value;
1191      return this;
1192    }
1193
1194    /**
1195     * @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
1196     */
1197    public Reference getRequestProvider() { 
1198      if (this.requestProvider == null)
1199        if (Configuration.errorOnAutoCreate())
1200          throw new Error("Attempt to auto-create PaymentReconciliation.requestProvider");
1201        else if (Configuration.doAutoCreate())
1202          this.requestProvider = new Reference(); // cc
1203      return this.requestProvider;
1204    }
1205
1206    public boolean hasRequestProvider() { 
1207      return this.requestProvider != null && !this.requestProvider.isEmpty();
1208    }
1209
1210    /**
1211     * @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
1212     */
1213    public PaymentReconciliation setRequestProvider(Reference value) { 
1214      this.requestProvider = value;
1215      return this;
1216    }
1217
1218    /**
1219     * @return {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
1220     */
1221    public Practitioner getRequestProviderTarget() { 
1222      if (this.requestProviderTarget == null)
1223        if (Configuration.errorOnAutoCreate())
1224          throw new Error("Attempt to auto-create PaymentReconciliation.requestProvider");
1225        else if (Configuration.doAutoCreate())
1226          this.requestProviderTarget = new Practitioner(); // aa
1227      return this.requestProviderTarget;
1228    }
1229
1230    /**
1231     * @param value {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
1232     */
1233    public PaymentReconciliation setRequestProviderTarget(Practitioner value) { 
1234      this.requestProviderTarget = value;
1235      return this;
1236    }
1237
1238    /**
1239     * @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
1240     */
1241    public Reference getRequestOrganization() { 
1242      if (this.requestOrganization == null)
1243        if (Configuration.errorOnAutoCreate())
1244          throw new Error("Attempt to auto-create PaymentReconciliation.requestOrganization");
1245        else if (Configuration.doAutoCreate())
1246          this.requestOrganization = new Reference(); // cc
1247      return this.requestOrganization;
1248    }
1249
1250    public boolean hasRequestOrganization() { 
1251      return this.requestOrganization != null && !this.requestOrganization.isEmpty();
1252    }
1253
1254    /**
1255     * @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
1256     */
1257    public PaymentReconciliation setRequestOrganization(Reference value) { 
1258      this.requestOrganization = value;
1259      return this;
1260    }
1261
1262    /**
1263     * @return {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
1264     */
1265    public Organization getRequestOrganizationTarget() { 
1266      if (this.requestOrganizationTarget == null)
1267        if (Configuration.errorOnAutoCreate())
1268          throw new Error("Attempt to auto-create PaymentReconciliation.requestOrganization");
1269        else if (Configuration.doAutoCreate())
1270          this.requestOrganizationTarget = new Organization(); // aa
1271      return this.requestOrganizationTarget;
1272    }
1273
1274    /**
1275     * @param value {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
1276     */
1277    public PaymentReconciliation setRequestOrganizationTarget(Organization value) { 
1278      this.requestOrganizationTarget = value;
1279      return this;
1280    }
1281
1282    /**
1283     * @return {@link #detail} (List of individual settlement amounts and the corresponding transaction.)
1284     */
1285    public List<DetailsComponent> getDetail() { 
1286      if (this.detail == null)
1287        this.detail = new ArrayList<DetailsComponent>();
1288      return this.detail;
1289    }
1290
1291    public boolean hasDetail() { 
1292      if (this.detail == null)
1293        return false;
1294      for (DetailsComponent item : this.detail)
1295        if (!item.isEmpty())
1296          return true;
1297      return false;
1298    }
1299
1300    /**
1301     * @return {@link #detail} (List of individual settlement amounts and the corresponding transaction.)
1302     */
1303    // syntactic sugar
1304    public DetailsComponent addDetail() { //3
1305      DetailsComponent t = new DetailsComponent();
1306      if (this.detail == null)
1307        this.detail = new ArrayList<DetailsComponent>();
1308      this.detail.add(t);
1309      return t;
1310    }
1311
1312    // syntactic sugar
1313    public PaymentReconciliation addDetail(DetailsComponent t) { //3
1314      if (t == null)
1315        return this;
1316      if (this.detail == null)
1317        this.detail = new ArrayList<DetailsComponent>();
1318      this.detail.add(t);
1319      return this;
1320    }
1321
1322    /**
1323     * @return {@link #form} (The form to be used for printing the content.)
1324     */
1325    public Coding getForm() { 
1326      if (this.form == null)
1327        if (Configuration.errorOnAutoCreate())
1328          throw new Error("Attempt to auto-create PaymentReconciliation.form");
1329        else if (Configuration.doAutoCreate())
1330          this.form = new Coding(); // cc
1331      return this.form;
1332    }
1333
1334    public boolean hasForm() { 
1335      return this.form != null && !this.form.isEmpty();
1336    }
1337
1338    /**
1339     * @param value {@link #form} (The form to be used for printing the content.)
1340     */
1341    public PaymentReconciliation setForm(Coding value) { 
1342      this.form = value;
1343      return this;
1344    }
1345
1346    /**
1347     * @return {@link #total} (Total payment amount.)
1348     */
1349    public Money getTotal() { 
1350      if (this.total == null)
1351        if (Configuration.errorOnAutoCreate())
1352          throw new Error("Attempt to auto-create PaymentReconciliation.total");
1353        else if (Configuration.doAutoCreate())
1354          this.total = new Money(); // cc
1355      return this.total;
1356    }
1357
1358    public boolean hasTotal() { 
1359      return this.total != null && !this.total.isEmpty();
1360    }
1361
1362    /**
1363     * @param value {@link #total} (Total payment amount.)
1364     */
1365    public PaymentReconciliation setTotal(Money value) { 
1366      this.total = value;
1367      return this;
1368    }
1369
1370    /**
1371     * @return {@link #note} (Suite of notes.)
1372     */
1373    public List<NotesComponent> getNote() { 
1374      if (this.note == null)
1375        this.note = new ArrayList<NotesComponent>();
1376      return this.note;
1377    }
1378
1379    public boolean hasNote() { 
1380      if (this.note == null)
1381        return false;
1382      for (NotesComponent item : this.note)
1383        if (!item.isEmpty())
1384          return true;
1385      return false;
1386    }
1387
1388    /**
1389     * @return {@link #note} (Suite of notes.)
1390     */
1391    // syntactic sugar
1392    public NotesComponent addNote() { //3
1393      NotesComponent t = new NotesComponent();
1394      if (this.note == null)
1395        this.note = new ArrayList<NotesComponent>();
1396      this.note.add(t);
1397      return t;
1398    }
1399
1400    // syntactic sugar
1401    public PaymentReconciliation addNote(NotesComponent t) { //3
1402      if (t == null)
1403        return this;
1404      if (this.note == null)
1405        this.note = new ArrayList<NotesComponent>();
1406      this.note.add(t);
1407      return this;
1408    }
1409
1410      protected void listChildren(List<Property> childrenList) {
1411        super.listChildren(childrenList);
1412        childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
1413        childrenList.add(new Property("request", "Reference(ProcessRequest)", "Original request resource reference.", 0, java.lang.Integer.MAX_VALUE, request));
1414        childrenList.add(new Property("outcome", "code", "Transaction status: error, complete.", 0, java.lang.Integer.MAX_VALUE, outcome));
1415        childrenList.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, java.lang.Integer.MAX_VALUE, disposition));
1416        childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset));
1417        childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
1418        childrenList.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, created));
1419        childrenList.add(new Property("period", "Period", "The period of time for which payments have been gathered into this bulk payment for settlement.", 0, java.lang.Integer.MAX_VALUE, period));
1420        childrenList.add(new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, java.lang.Integer.MAX_VALUE, organization));
1421        childrenList.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestProvider));
1422        childrenList.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestOrganization));
1423        childrenList.add(new Property("detail", "", "List of individual settlement amounts and the corresponding transaction.", 0, java.lang.Integer.MAX_VALUE, detail));
1424        childrenList.add(new Property("form", "Coding", "The form to be used for printing the content.", 0, java.lang.Integer.MAX_VALUE, form));
1425        childrenList.add(new Property("total", "Money", "Total payment amount.", 0, java.lang.Integer.MAX_VALUE, total));
1426        childrenList.add(new Property("note", "", "Suite of notes.", 0, java.lang.Integer.MAX_VALUE, note));
1427      }
1428
1429      @Override
1430      public void setProperty(String name, Base value) throws FHIRException {
1431        if (name.equals("identifier"))
1432          this.getIdentifier().add(castToIdentifier(value));
1433        else if (name.equals("request"))
1434          this.request = castToReference(value); // Reference
1435        else if (name.equals("outcome"))
1436          this.outcome = new RemittanceOutcomeEnumFactory().fromType(value); // Enumeration<RemittanceOutcome>
1437        else if (name.equals("disposition"))
1438          this.disposition = castToString(value); // StringType
1439        else if (name.equals("ruleset"))
1440          this.ruleset = castToCoding(value); // Coding
1441        else if (name.equals("originalRuleset"))
1442          this.originalRuleset = castToCoding(value); // Coding
1443        else if (name.equals("created"))
1444          this.created = castToDateTime(value); // DateTimeType
1445        else if (name.equals("period"))
1446          this.period = castToPeriod(value); // Period
1447        else if (name.equals("organization"))
1448          this.organization = castToReference(value); // Reference
1449        else if (name.equals("requestProvider"))
1450          this.requestProvider = castToReference(value); // Reference
1451        else if (name.equals("requestOrganization"))
1452          this.requestOrganization = castToReference(value); // Reference
1453        else if (name.equals("detail"))
1454          this.getDetail().add((DetailsComponent) value);
1455        else if (name.equals("form"))
1456          this.form = castToCoding(value); // Coding
1457        else if (name.equals("total"))
1458          this.total = castToMoney(value); // Money
1459        else if (name.equals("note"))
1460          this.getNote().add((NotesComponent) value);
1461        else
1462          super.setProperty(name, value);
1463      }
1464
1465      @Override
1466      public Base addChild(String name) throws FHIRException {
1467        if (name.equals("identifier")) {
1468          return addIdentifier();
1469        }
1470        else if (name.equals("request")) {
1471          this.request = new Reference();
1472          return this.request;
1473        }
1474        else if (name.equals("outcome")) {
1475          throw new FHIRException("Cannot call addChild on a primitive type PaymentReconciliation.outcome");
1476        }
1477        else if (name.equals("disposition")) {
1478          throw new FHIRException("Cannot call addChild on a primitive type PaymentReconciliation.disposition");
1479        }
1480        else if (name.equals("ruleset")) {
1481          this.ruleset = new Coding();
1482          return this.ruleset;
1483        }
1484        else if (name.equals("originalRuleset")) {
1485          this.originalRuleset = new Coding();
1486          return this.originalRuleset;
1487        }
1488        else if (name.equals("created")) {
1489          throw new FHIRException("Cannot call addChild on a primitive type PaymentReconciliation.created");
1490        }
1491        else if (name.equals("period")) {
1492          this.period = new Period();
1493          return this.period;
1494        }
1495        else if (name.equals("organization")) {
1496          this.organization = new Reference();
1497          return this.organization;
1498        }
1499        else if (name.equals("requestProvider")) {
1500          this.requestProvider = new Reference();
1501          return this.requestProvider;
1502        }
1503        else if (name.equals("requestOrganization")) {
1504          this.requestOrganization = new Reference();
1505          return this.requestOrganization;
1506        }
1507        else if (name.equals("detail")) {
1508          return addDetail();
1509        }
1510        else if (name.equals("form")) {
1511          this.form = new Coding();
1512          return this.form;
1513        }
1514        else if (name.equals("total")) {
1515          this.total = new Money();
1516          return this.total;
1517        }
1518        else if (name.equals("note")) {
1519          return addNote();
1520        }
1521        else
1522          return super.addChild(name);
1523      }
1524
1525  public String fhirType() {
1526    return "PaymentReconciliation";
1527
1528  }
1529
1530      public PaymentReconciliation copy() {
1531        PaymentReconciliation dst = new PaymentReconciliation();
1532        copyValues(dst);
1533        if (identifier != null) {
1534          dst.identifier = new ArrayList<Identifier>();
1535          for (Identifier i : identifier)
1536            dst.identifier.add(i.copy());
1537        };
1538        dst.request = request == null ? null : request.copy();
1539        dst.outcome = outcome == null ? null : outcome.copy();
1540        dst.disposition = disposition == null ? null : disposition.copy();
1541        dst.ruleset = ruleset == null ? null : ruleset.copy();
1542        dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
1543        dst.created = created == null ? null : created.copy();
1544        dst.period = period == null ? null : period.copy();
1545        dst.organization = organization == null ? null : organization.copy();
1546        dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
1547        dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
1548        if (detail != null) {
1549          dst.detail = new ArrayList<DetailsComponent>();
1550          for (DetailsComponent i : detail)
1551            dst.detail.add(i.copy());
1552        };
1553        dst.form = form == null ? null : form.copy();
1554        dst.total = total == null ? null : total.copy();
1555        if (note != null) {
1556          dst.note = new ArrayList<NotesComponent>();
1557          for (NotesComponent i : note)
1558            dst.note.add(i.copy());
1559        };
1560        return dst;
1561      }
1562
1563      protected PaymentReconciliation typedCopy() {
1564        return copy();
1565      }
1566
1567      @Override
1568      public boolean equalsDeep(Base other) {
1569        if (!super.equalsDeep(other))
1570          return false;
1571        if (!(other instanceof PaymentReconciliation))
1572          return false;
1573        PaymentReconciliation o = (PaymentReconciliation) other;
1574        return compareDeep(identifier, o.identifier, true) && compareDeep(request, o.request, true) && compareDeep(outcome, o.outcome, true)
1575           && compareDeep(disposition, o.disposition, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
1576           && compareDeep(created, o.created, true) && compareDeep(period, o.period, true) && compareDeep(organization, o.organization, true)
1577           && compareDeep(requestProvider, o.requestProvider, true) && compareDeep(requestOrganization, o.requestOrganization, true)
1578           && compareDeep(detail, o.detail, true) && compareDeep(form, o.form, true) && compareDeep(total, o.total, true)
1579           && compareDeep(note, o.note, true);
1580      }
1581
1582      @Override
1583      public boolean equalsShallow(Base other) {
1584        if (!super.equalsShallow(other))
1585          return false;
1586        if (!(other instanceof PaymentReconciliation))
1587          return false;
1588        PaymentReconciliation o = (PaymentReconciliation) other;
1589        return compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(created, o.created, true)
1590          ;
1591      }
1592
1593      public boolean isEmpty() {
1594        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (request == null || request.isEmpty())
1595           && (outcome == null || outcome.isEmpty()) && (disposition == null || disposition.isEmpty())
1596           && (ruleset == null || ruleset.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
1597           && (created == null || created.isEmpty()) && (period == null || period.isEmpty()) && (organization == null || organization.isEmpty())
1598           && (requestProvider == null || requestProvider.isEmpty()) && (requestOrganization == null || requestOrganization.isEmpty())
1599           && (detail == null || detail.isEmpty()) && (form == null || form.isEmpty()) && (total == null || total.isEmpty())
1600           && (note == null || note.isEmpty());
1601      }
1602
1603  @Override
1604  public ResourceType getResourceType() {
1605    return ResourceType.PaymentReconciliation;
1606   }
1607
1608  @SearchParamDefinition(name="identifier", path="PaymentReconciliation.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
1609  public static final String SP_IDENTIFIER = "identifier";
1610
1611}
1612