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