001package org.hl7.fhir.instance.model;
002
003import java.math.BigDecimal;
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
035import java.util.*;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.*;
042/**
043 * A formal agreement between parties regarding the conduct of business, exchange of information or other matters.
044 */
045@ResourceDef(name="Contract", profile="http://hl7.org/fhir/Profile/Contract")
046public class Contract extends DomainResource {
047
048    @Block()
049    public static class ActorComponent extends BackboneElement implements IBaseBackboneElement {
050        /**
051         * Who or what actors are assigned roles in this Contract.
052         */
053        @Child(name = "entity", type = {Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class}, order=1, min=1, max=1, modifier=false, summary=false)
054        @Description(shortDefinition="Contract Actor Type", formalDefinition="Who or what actors are assigned roles in this Contract." )
055        protected Reference entity;
056
057        /**
058         * The actual object that is the target of the reference (Who or what actors are assigned roles in this Contract.)
059         */
060        protected Resource entityTarget;
061
062        /**
063         * Role type of actors assigned roles in this Contract.
064         */
065        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
066        @Description(shortDefinition="Contract  Actor Role", formalDefinition="Role type of actors assigned roles in this Contract." )
067        protected List<CodeableConcept> role;
068
069        private static final long serialVersionUID = 1371245689L;
070
071    /*
072     * Constructor
073     */
074      public ActorComponent() {
075        super();
076      }
077
078    /*
079     * Constructor
080     */
081      public ActorComponent(Reference entity) {
082        super();
083        this.entity = entity;
084      }
085
086        /**
087         * @return {@link #entity} (Who or what actors are assigned roles in this Contract.)
088         */
089        public Reference getEntity() { 
090          if (this.entity == null)
091            if (Configuration.errorOnAutoCreate())
092              throw new Error("Attempt to auto-create ActorComponent.entity");
093            else if (Configuration.doAutoCreate())
094              this.entity = new Reference(); // cc
095          return this.entity;
096        }
097
098        public boolean hasEntity() { 
099          return this.entity != null && !this.entity.isEmpty();
100        }
101
102        /**
103         * @param value {@link #entity} (Who or what actors are assigned roles in this Contract.)
104         */
105        public ActorComponent setEntity(Reference value) { 
106          this.entity = value;
107          return this;
108        }
109
110        /**
111         * @return {@link #entity} 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. (Who or what actors are assigned roles in this Contract.)
112         */
113        public Resource getEntityTarget() { 
114          return this.entityTarget;
115        }
116
117        /**
118         * @param value {@link #entity} 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. (Who or what actors are assigned roles in this Contract.)
119         */
120        public ActorComponent setEntityTarget(Resource value) { 
121          this.entityTarget = value;
122          return this;
123        }
124
125        /**
126         * @return {@link #role} (Role type of actors assigned roles in this Contract.)
127         */
128        public List<CodeableConcept> getRole() { 
129          if (this.role == null)
130            this.role = new ArrayList<CodeableConcept>();
131          return this.role;
132        }
133
134        public boolean hasRole() { 
135          if (this.role == null)
136            return false;
137          for (CodeableConcept item : this.role)
138            if (!item.isEmpty())
139              return true;
140          return false;
141        }
142
143        /**
144         * @return {@link #role} (Role type of actors assigned roles in this Contract.)
145         */
146    // syntactic sugar
147        public CodeableConcept addRole() { //3
148          CodeableConcept t = new CodeableConcept();
149          if (this.role == null)
150            this.role = new ArrayList<CodeableConcept>();
151          this.role.add(t);
152          return t;
153        }
154
155    // syntactic sugar
156        public ActorComponent addRole(CodeableConcept t) { //3
157          if (t == null)
158            return this;
159          if (this.role == null)
160            this.role = new ArrayList<CodeableConcept>();
161          this.role.add(t);
162          return this;
163        }
164
165        protected void listChildren(List<Property> childrenList) {
166          super.listChildren(childrenList);
167          childrenList.add(new Property("entity", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "Who or what actors are assigned roles in this Contract.", 0, java.lang.Integer.MAX_VALUE, entity));
168          childrenList.add(new Property("role", "CodeableConcept", "Role type of actors assigned roles in this Contract.", 0, java.lang.Integer.MAX_VALUE, role));
169        }
170
171      @Override
172      public void setProperty(String name, Base value) throws FHIRException {
173        if (name.equals("entity"))
174          this.entity = castToReference(value); // Reference
175        else if (name.equals("role"))
176          this.getRole().add(castToCodeableConcept(value));
177        else
178          super.setProperty(name, value);
179      }
180
181      @Override
182      public Base addChild(String name) throws FHIRException {
183        if (name.equals("entity")) {
184          this.entity = new Reference();
185          return this.entity;
186        }
187        else if (name.equals("role")) {
188          return addRole();
189        }
190        else
191          return super.addChild(name);
192      }
193
194      public ActorComponent copy() {
195        ActorComponent dst = new ActorComponent();
196        copyValues(dst);
197        dst.entity = entity == null ? null : entity.copy();
198        if (role != null) {
199          dst.role = new ArrayList<CodeableConcept>();
200          for (CodeableConcept i : role)
201            dst.role.add(i.copy());
202        };
203        return dst;
204      }
205
206      @Override
207      public boolean equalsDeep(Base other) {
208        if (!super.equalsDeep(other))
209          return false;
210        if (!(other instanceof ActorComponent))
211          return false;
212        ActorComponent o = (ActorComponent) other;
213        return compareDeep(entity, o.entity, true) && compareDeep(role, o.role, true);
214      }
215
216      @Override
217      public boolean equalsShallow(Base other) {
218        if (!super.equalsShallow(other))
219          return false;
220        if (!(other instanceof ActorComponent))
221          return false;
222        ActorComponent o = (ActorComponent) other;
223        return true;
224      }
225
226      public boolean isEmpty() {
227        return super.isEmpty() && (entity == null || entity.isEmpty()) && (role == null || role.isEmpty())
228          ;
229      }
230
231  public String fhirType() {
232    return "Contract.actor";
233
234  }
235
236  }
237
238    @Block()
239    public static class ValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
240        /**
241         * Specific type of Contract Valued Item that may be priced.
242         */
243        @Child(name = "entity", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
244        @Description(shortDefinition="Contract Valued Item Type", formalDefinition="Specific type of Contract Valued Item that may be priced." )
245        protected Type entity;
246
247        /**
248         * Identifies a Contract Valued Item instance.
249         */
250        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
251        @Description(shortDefinition="Contract Valued Item Identifier", formalDefinition="Identifies a Contract Valued Item instance." )
252        protected Identifier identifier;
253
254        /**
255         * Indicates the time during which this Contract ValuedItem information is effective.
256         */
257        @Child(name = "effectiveTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
258        @Description(shortDefinition="Contract Valued Item Effective Tiem", formalDefinition="Indicates the time during which this Contract ValuedItem information is effective." )
259        protected DateTimeType effectiveTime;
260
261        /**
262         * Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.
263         */
264        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
265        @Description(shortDefinition="Count of Contract Valued Items", formalDefinition="Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances." )
266        protected SimpleQuantity quantity;
267
268        /**
269         * A Contract Valued Item unit valuation measure.
270         */
271        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
272        @Description(shortDefinition="Contract Valued Item fee, charge, or cost", formalDefinition="A Contract Valued Item unit valuation measure." )
273        protected Money unitPrice;
274
275        /**
276         * A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
277         */
278        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
279        @Description(shortDefinition="Contract Valued Item Price Scaling Factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
280        protected DecimalType factor;
281
282        /**
283         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
284         */
285        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
286        @Description(shortDefinition="Contract Valued Item Difficulty Scaling Factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point." )
287        protected DecimalType points;
288
289        /**
290         * Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
291         */
292        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
293        @Description(shortDefinition="Total Contract Valued Item Value", formalDefinition="Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
294        protected Money net;
295
296        private static final long serialVersionUID = 1782449516L;
297
298    /*
299     * Constructor
300     */
301      public ValuedItemComponent() {
302        super();
303      }
304
305        /**
306         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
307         */
308        public Type getEntity() { 
309          return this.entity;
310        }
311
312        /**
313         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
314         */
315        public CodeableConcept getEntityCodeableConcept() throws FHIRException { 
316          if (!(this.entity instanceof CodeableConcept))
317            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.entity.getClass().getName()+" was encountered");
318          return (CodeableConcept) this.entity;
319        }
320
321        public boolean hasEntityCodeableConcept() { 
322          return this.entity instanceof CodeableConcept;
323        }
324
325        /**
326         * @return {@link #entity} (Specific type of Contract Valued Item that may be priced.)
327         */
328        public Reference getEntityReference() throws FHIRException { 
329          if (!(this.entity instanceof Reference))
330            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.entity.getClass().getName()+" was encountered");
331          return (Reference) this.entity;
332        }
333
334        public boolean hasEntityReference() { 
335          return this.entity instanceof Reference;
336        }
337
338        public boolean hasEntity() { 
339          return this.entity != null && !this.entity.isEmpty();
340        }
341
342        /**
343         * @param value {@link #entity} (Specific type of Contract Valued Item that may be priced.)
344         */
345        public ValuedItemComponent setEntity(Type value) { 
346          this.entity = value;
347          return this;
348        }
349
350        /**
351         * @return {@link #identifier} (Identifies a Contract Valued Item instance.)
352         */
353        public Identifier getIdentifier() { 
354          if (this.identifier == null)
355            if (Configuration.errorOnAutoCreate())
356              throw new Error("Attempt to auto-create ValuedItemComponent.identifier");
357            else if (Configuration.doAutoCreate())
358              this.identifier = new Identifier(); // cc
359          return this.identifier;
360        }
361
362        public boolean hasIdentifier() { 
363          return this.identifier != null && !this.identifier.isEmpty();
364        }
365
366        /**
367         * @param value {@link #identifier} (Identifies a Contract Valued Item instance.)
368         */
369        public ValuedItemComponent setIdentifier(Identifier value) { 
370          this.identifier = value;
371          return this;
372        }
373
374        /**
375         * @return {@link #effectiveTime} (Indicates the time during which this Contract ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
376         */
377        public DateTimeType getEffectiveTimeElement() { 
378          if (this.effectiveTime == null)
379            if (Configuration.errorOnAutoCreate())
380              throw new Error("Attempt to auto-create ValuedItemComponent.effectiveTime");
381            else if (Configuration.doAutoCreate())
382              this.effectiveTime = new DateTimeType(); // bb
383          return this.effectiveTime;
384        }
385
386        public boolean hasEffectiveTimeElement() { 
387          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
388        }
389
390        public boolean hasEffectiveTime() { 
391          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
392        }
393
394        /**
395         * @param value {@link #effectiveTime} (Indicates the time during which this Contract ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
396         */
397        public ValuedItemComponent setEffectiveTimeElement(DateTimeType value) { 
398          this.effectiveTime = value;
399          return this;
400        }
401
402        /**
403         * @return Indicates the time during which this Contract ValuedItem information is effective.
404         */
405        public Date getEffectiveTime() { 
406          return this.effectiveTime == null ? null : this.effectiveTime.getValue();
407        }
408
409        /**
410         * @param value Indicates the time during which this Contract ValuedItem information is effective.
411         */
412        public ValuedItemComponent setEffectiveTime(Date value) { 
413          if (value == null)
414            this.effectiveTime = null;
415          else {
416            if (this.effectiveTime == null)
417              this.effectiveTime = new DateTimeType();
418            this.effectiveTime.setValue(value);
419          }
420          return this;
421        }
422
423        /**
424         * @return {@link #quantity} (Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.)
425         */
426        public SimpleQuantity getQuantity() { 
427          if (this.quantity == null)
428            if (Configuration.errorOnAutoCreate())
429              throw new Error("Attempt to auto-create ValuedItemComponent.quantity");
430            else if (Configuration.doAutoCreate())
431              this.quantity = new SimpleQuantity(); // cc
432          return this.quantity;
433        }
434
435        public boolean hasQuantity() { 
436          return this.quantity != null && !this.quantity.isEmpty();
437        }
438
439        /**
440         * @param value {@link #quantity} (Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.)
441         */
442        public ValuedItemComponent setQuantity(SimpleQuantity value) { 
443          this.quantity = value;
444          return this;
445        }
446
447        /**
448         * @return {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
449         */
450        public Money getUnitPrice() { 
451          if (this.unitPrice == null)
452            if (Configuration.errorOnAutoCreate())
453              throw new Error("Attempt to auto-create ValuedItemComponent.unitPrice");
454            else if (Configuration.doAutoCreate())
455              this.unitPrice = new Money(); // cc
456          return this.unitPrice;
457        }
458
459        public boolean hasUnitPrice() { 
460          return this.unitPrice != null && !this.unitPrice.isEmpty();
461        }
462
463        /**
464         * @param value {@link #unitPrice} (A Contract Valued Item unit valuation measure.)
465         */
466        public ValuedItemComponent setUnitPrice(Money value) { 
467          this.unitPrice = value;
468          return this;
469        }
470
471        /**
472         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
473         */
474        public DecimalType getFactorElement() { 
475          if (this.factor == null)
476            if (Configuration.errorOnAutoCreate())
477              throw new Error("Attempt to auto-create ValuedItemComponent.factor");
478            else if (Configuration.doAutoCreate())
479              this.factor = new DecimalType(); // bb
480          return this.factor;
481        }
482
483        public boolean hasFactorElement() { 
484          return this.factor != null && !this.factor.isEmpty();
485        }
486
487        public boolean hasFactor() { 
488          return this.factor != null && !this.factor.isEmpty();
489        }
490
491        /**
492         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
493         */
494        public ValuedItemComponent setFactorElement(DecimalType value) { 
495          this.factor = value;
496          return this;
497        }
498
499        /**
500         * @return A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
501         */
502        public BigDecimal getFactor() { 
503          return this.factor == null ? null : this.factor.getValue();
504        }
505
506        /**
507         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
508         */
509        public ValuedItemComponent setFactor(BigDecimal value) { 
510          if (value == null)
511            this.factor = null;
512          else {
513            if (this.factor == null)
514              this.factor = new DecimalType();
515            this.factor.setValue(value);
516          }
517          return this;
518        }
519
520        /**
521         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
522         */
523        public DecimalType getPointsElement() { 
524          if (this.points == null)
525            if (Configuration.errorOnAutoCreate())
526              throw new Error("Attempt to auto-create ValuedItemComponent.points");
527            else if (Configuration.doAutoCreate())
528              this.points = new DecimalType(); // bb
529          return this.points;
530        }
531
532        public boolean hasPointsElement() { 
533          return this.points != null && !this.points.isEmpty();
534        }
535
536        public boolean hasPoints() { 
537          return this.points != null && !this.points.isEmpty();
538        }
539
540        /**
541         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
542         */
543        public ValuedItemComponent setPointsElement(DecimalType value) { 
544          this.points = value;
545          return this;
546        }
547
548        /**
549         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
550         */
551        public BigDecimal getPoints() { 
552          return this.points == null ? null : this.points.getValue();
553        }
554
555        /**
556         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.
557         */
558        public ValuedItemComponent setPoints(BigDecimal value) { 
559          if (value == null)
560            this.points = null;
561          else {
562            if (this.points == null)
563              this.points = new DecimalType();
564            this.points.setValue(value);
565          }
566          return this;
567        }
568
569        /**
570         * @return {@link #net} (Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
571         */
572        public Money getNet() { 
573          if (this.net == null)
574            if (Configuration.errorOnAutoCreate())
575              throw new Error("Attempt to auto-create ValuedItemComponent.net");
576            else if (Configuration.doAutoCreate())
577              this.net = new Money(); // cc
578          return this.net;
579        }
580
581        public boolean hasNet() { 
582          return this.net != null && !this.net.isEmpty();
583        }
584
585        /**
586         * @param value {@link #net} (Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
587         */
588        public ValuedItemComponent setNet(Money value) { 
589          this.net = value;
590          return this;
591        }
592
593        protected void listChildren(List<Property> childrenList) {
594          super.listChildren(childrenList);
595          childrenList.add(new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Valued Item that may be priced.", 0, java.lang.Integer.MAX_VALUE, entity));
596          childrenList.add(new Property("identifier", "Identifier", "Identifies a Contract Valued Item instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
597          childrenList.add(new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract ValuedItem information is effective.", 0, java.lang.Integer.MAX_VALUE, effectiveTime));
598          childrenList.add(new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.", 0, java.lang.Integer.MAX_VALUE, quantity));
599          childrenList.add(new Property("unitPrice", "Money", "A Contract Valued Item unit valuation measure.", 0, java.lang.Integer.MAX_VALUE, unitPrice));
600          childrenList.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, java.lang.Integer.MAX_VALUE, factor));
601          childrenList.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.", 0, java.lang.Integer.MAX_VALUE, points));
602          childrenList.add(new Property("net", "Money", "Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, java.lang.Integer.MAX_VALUE, net));
603        }
604
605      @Override
606      public void setProperty(String name, Base value) throws FHIRException {
607        if (name.equals("entity[x]"))
608          this.entity = (Type) value; // Type
609        else if (name.equals("identifier"))
610          this.identifier = castToIdentifier(value); // Identifier
611        else if (name.equals("effectiveTime"))
612          this.effectiveTime = castToDateTime(value); // DateTimeType
613        else if (name.equals("quantity"))
614          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
615        else if (name.equals("unitPrice"))
616          this.unitPrice = castToMoney(value); // Money
617        else if (name.equals("factor"))
618          this.factor = castToDecimal(value); // DecimalType
619        else if (name.equals("points"))
620          this.points = castToDecimal(value); // DecimalType
621        else if (name.equals("net"))
622          this.net = castToMoney(value); // Money
623        else
624          super.setProperty(name, value);
625      }
626
627      @Override
628      public Base addChild(String name) throws FHIRException {
629        if (name.equals("entityCodeableConcept")) {
630          this.entity = new CodeableConcept();
631          return this.entity;
632        }
633        else if (name.equals("entityReference")) {
634          this.entity = new Reference();
635          return this.entity;
636        }
637        else if (name.equals("identifier")) {
638          this.identifier = new Identifier();
639          return this.identifier;
640        }
641        else if (name.equals("effectiveTime")) {
642          throw new FHIRException("Cannot call addChild on a primitive type Contract.effectiveTime");
643        }
644        else if (name.equals("quantity")) {
645          this.quantity = new SimpleQuantity();
646          return this.quantity;
647        }
648        else if (name.equals("unitPrice")) {
649          this.unitPrice = new Money();
650          return this.unitPrice;
651        }
652        else if (name.equals("factor")) {
653          throw new FHIRException("Cannot call addChild on a primitive type Contract.factor");
654        }
655        else if (name.equals("points")) {
656          throw new FHIRException("Cannot call addChild on a primitive type Contract.points");
657        }
658        else if (name.equals("net")) {
659          this.net = new Money();
660          return this.net;
661        }
662        else
663          return super.addChild(name);
664      }
665
666      public ValuedItemComponent copy() {
667        ValuedItemComponent dst = new ValuedItemComponent();
668        copyValues(dst);
669        dst.entity = entity == null ? null : entity.copy();
670        dst.identifier = identifier == null ? null : identifier.copy();
671        dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
672        dst.quantity = quantity == null ? null : quantity.copy();
673        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
674        dst.factor = factor == null ? null : factor.copy();
675        dst.points = points == null ? null : points.copy();
676        dst.net = net == null ? null : net.copy();
677        return dst;
678      }
679
680      @Override
681      public boolean equalsDeep(Base other) {
682        if (!super.equalsDeep(other))
683          return false;
684        if (!(other instanceof ValuedItemComponent))
685          return false;
686        ValuedItemComponent o = (ValuedItemComponent) other;
687        return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(effectiveTime, o.effectiveTime, true)
688           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
689           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true);
690      }
691
692      @Override
693      public boolean equalsShallow(Base other) {
694        if (!super.equalsShallow(other))
695          return false;
696        if (!(other instanceof ValuedItemComponent))
697          return false;
698        ValuedItemComponent o = (ValuedItemComponent) other;
699        return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
700           && compareValues(points, o.points, true);
701      }
702
703      public boolean isEmpty() {
704        return super.isEmpty() && (entity == null || entity.isEmpty()) && (identifier == null || identifier.isEmpty())
705           && (effectiveTime == null || effectiveTime.isEmpty()) && (quantity == null || quantity.isEmpty())
706           && (unitPrice == null || unitPrice.isEmpty()) && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty())
707           && (net == null || net.isEmpty());
708      }
709
710  public String fhirType() {
711    return "Contract.valuedItem";
712
713  }
714
715  }
716
717    @Block()
718    public static class SignatoryComponent extends BackboneElement implements IBaseBackboneElement {
719        /**
720         * Role of this Contract signer, e.g. notary, grantee.
721         */
722        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
723        @Description(shortDefinition="Contract Signer Type", formalDefinition="Role of this Contract signer, e.g. notary, grantee." )
724        protected Coding type;
725
726        /**
727         * Party which is a signator to this Contract.
728         */
729        @Child(name = "party", type = {Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=false)
730        @Description(shortDefinition="Contract Signatory Party", formalDefinition="Party which is a signator to this Contract." )
731        protected Reference party;
732
733        /**
734         * The actual object that is the target of the reference (Party which is a signator to this Contract.)
735         */
736        protected Resource partyTarget;
737
738        /**
739         * Legally binding Contract DSIG signature contents in Base64.
740         */
741        @Child(name = "signature", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=false)
742        @Description(shortDefinition="Contract Documentation Signature", formalDefinition="Legally binding Contract DSIG signature contents in Base64." )
743        protected StringType signature;
744
745        private static final long serialVersionUID = -1870392043L;
746
747    /*
748     * Constructor
749     */
750      public SignatoryComponent() {
751        super();
752      }
753
754    /*
755     * Constructor
756     */
757      public SignatoryComponent(Coding type, Reference party, StringType signature) {
758        super();
759        this.type = type;
760        this.party = party;
761        this.signature = signature;
762      }
763
764        /**
765         * @return {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
766         */
767        public Coding getType() { 
768          if (this.type == null)
769            if (Configuration.errorOnAutoCreate())
770              throw new Error("Attempt to auto-create SignatoryComponent.type");
771            else if (Configuration.doAutoCreate())
772              this.type = new Coding(); // cc
773          return this.type;
774        }
775
776        public boolean hasType() { 
777          return this.type != null && !this.type.isEmpty();
778        }
779
780        /**
781         * @param value {@link #type} (Role of this Contract signer, e.g. notary, grantee.)
782         */
783        public SignatoryComponent setType(Coding value) { 
784          this.type = value;
785          return this;
786        }
787
788        /**
789         * @return {@link #party} (Party which is a signator to this Contract.)
790         */
791        public Reference getParty() { 
792          if (this.party == null)
793            if (Configuration.errorOnAutoCreate())
794              throw new Error("Attempt to auto-create SignatoryComponent.party");
795            else if (Configuration.doAutoCreate())
796              this.party = new Reference(); // cc
797          return this.party;
798        }
799
800        public boolean hasParty() { 
801          return this.party != null && !this.party.isEmpty();
802        }
803
804        /**
805         * @param value {@link #party} (Party which is a signator to this Contract.)
806         */
807        public SignatoryComponent setParty(Reference value) { 
808          this.party = value;
809          return this;
810        }
811
812        /**
813         * @return {@link #party} 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. (Party which is a signator to this Contract.)
814         */
815        public Resource getPartyTarget() { 
816          return this.partyTarget;
817        }
818
819        /**
820         * @param value {@link #party} 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. (Party which is a signator to this Contract.)
821         */
822        public SignatoryComponent setPartyTarget(Resource value) { 
823          this.partyTarget = value;
824          return this;
825        }
826
827        /**
828         * @return {@link #signature} (Legally binding Contract DSIG signature contents in Base64.). This is the underlying object with id, value and extensions. The accessor "getSignature" gives direct access to the value
829         */
830        public StringType getSignatureElement() { 
831          if (this.signature == null)
832            if (Configuration.errorOnAutoCreate())
833              throw new Error("Attempt to auto-create SignatoryComponent.signature");
834            else if (Configuration.doAutoCreate())
835              this.signature = new StringType(); // bb
836          return this.signature;
837        }
838
839        public boolean hasSignatureElement() { 
840          return this.signature != null && !this.signature.isEmpty();
841        }
842
843        public boolean hasSignature() { 
844          return this.signature != null && !this.signature.isEmpty();
845        }
846
847        /**
848         * @param value {@link #signature} (Legally binding Contract DSIG signature contents in Base64.). This is the underlying object with id, value and extensions. The accessor "getSignature" gives direct access to the value
849         */
850        public SignatoryComponent setSignatureElement(StringType value) { 
851          this.signature = value;
852          return this;
853        }
854
855        /**
856         * @return Legally binding Contract DSIG signature contents in Base64.
857         */
858        public String getSignature() { 
859          return this.signature == null ? null : this.signature.getValue();
860        }
861
862        /**
863         * @param value Legally binding Contract DSIG signature contents in Base64.
864         */
865        public SignatoryComponent setSignature(String value) { 
866            if (this.signature == null)
867              this.signature = new StringType();
868            this.signature.setValue(value);
869          return this;
870        }
871
872        protected void listChildren(List<Property> childrenList) {
873          super.listChildren(childrenList);
874          childrenList.add(new Property("type", "Coding", "Role of this Contract signer, e.g. notary, grantee.", 0, java.lang.Integer.MAX_VALUE, type));
875          childrenList.add(new Property("party", "Reference(Organization|Patient|Practitioner|RelatedPerson)", "Party which is a signator to this Contract.", 0, java.lang.Integer.MAX_VALUE, party));
876          childrenList.add(new Property("signature", "string", "Legally binding Contract DSIG signature contents in Base64.", 0, java.lang.Integer.MAX_VALUE, signature));
877        }
878
879      @Override
880      public void setProperty(String name, Base value) throws FHIRException {
881        if (name.equals("type"))
882          this.type = castToCoding(value); // Coding
883        else if (name.equals("party"))
884          this.party = castToReference(value); // Reference
885        else if (name.equals("signature"))
886          this.signature = castToString(value); // StringType
887        else
888          super.setProperty(name, value);
889      }
890
891      @Override
892      public Base addChild(String name) throws FHIRException {
893        if (name.equals("type")) {
894          this.type = new Coding();
895          return this.type;
896        }
897        else if (name.equals("party")) {
898          this.party = new Reference();
899          return this.party;
900        }
901        else if (name.equals("signature")) {
902          throw new FHIRException("Cannot call addChild on a primitive type Contract.signature");
903        }
904        else
905          return super.addChild(name);
906      }
907
908      public SignatoryComponent copy() {
909        SignatoryComponent dst = new SignatoryComponent();
910        copyValues(dst);
911        dst.type = type == null ? null : type.copy();
912        dst.party = party == null ? null : party.copy();
913        dst.signature = signature == null ? null : signature.copy();
914        return dst;
915      }
916
917      @Override
918      public boolean equalsDeep(Base other) {
919        if (!super.equalsDeep(other))
920          return false;
921        if (!(other instanceof SignatoryComponent))
922          return false;
923        SignatoryComponent o = (SignatoryComponent) other;
924        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true) && compareDeep(signature, o.signature, true)
925          ;
926      }
927
928      @Override
929      public boolean equalsShallow(Base other) {
930        if (!super.equalsShallow(other))
931          return false;
932        if (!(other instanceof SignatoryComponent))
933          return false;
934        SignatoryComponent o = (SignatoryComponent) other;
935        return compareValues(signature, o.signature, true);
936      }
937
938      public boolean isEmpty() {
939        return super.isEmpty() && (type == null || type.isEmpty()) && (party == null || party.isEmpty())
940           && (signature == null || signature.isEmpty());
941      }
942
943  public String fhirType() {
944    return "Contract.signer";
945
946  }
947
948  }
949
950    @Block()
951    public static class TermComponent extends BackboneElement implements IBaseBackboneElement {
952        /**
953         * Unique identifier for this particular Contract Provision.
954         */
955        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
956        @Description(shortDefinition="Contract Term identifier", formalDefinition="Unique identifier for this particular Contract Provision." )
957        protected Identifier identifier;
958
959        /**
960         * When this Contract Provision was issued.
961         */
962        @Child(name = "issued", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
963        @Description(shortDefinition="Contract Term Issue Date Time", formalDefinition="When this Contract Provision was issued." )
964        protected DateTimeType issued;
965
966        /**
967         * Relevant time or time-period when this Contract Provision is applicable.
968         */
969        @Child(name = "applies", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
970        @Description(shortDefinition="Contract Term Effective Time", formalDefinition="Relevant time or time-period when this Contract Provision is applicable." )
971        protected Period applies;
972
973        /**
974         * Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.
975         */
976        @Child(name = "type", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
977        @Description(shortDefinition="Contract Term Type", formalDefinition="Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit." )
978        protected CodeableConcept type;
979
980        /**
981         * Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.
982         */
983        @Child(name = "subType", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
984        @Description(shortDefinition="Contract Term Subtype", formalDefinition="Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment." )
985        protected CodeableConcept subType;
986
987        /**
988         * Who or what this Contract Provision is about.
989         */
990        @Child(name = "subject", type = {}, order=6, min=0, max=1, modifier=false, summary=false)
991        @Description(shortDefinition="Subject of this Contract Term", formalDefinition="Who or what this Contract Provision is about." )
992        protected Reference subject;
993
994        /**
995         * The actual object that is the target of the reference (Who or what this Contract Provision is about.)
996         */
997        protected Resource subjectTarget;
998
999        /**
1000         * Action stipulated by this Contract Provision.
1001         */
1002        @Child(name = "action", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1003        @Description(shortDefinition="Contract Term Action", formalDefinition="Action stipulated by this Contract Provision." )
1004        protected List<CodeableConcept> action;
1005
1006        /**
1007         * Reason or purpose for the action stipulated by this Contract Provision.
1008         */
1009        @Child(name = "actionReason", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1010        @Description(shortDefinition="Contract Term Action Reason", formalDefinition="Reason or purpose for the action stipulated by this Contract Provision." )
1011        protected List<CodeableConcept> actionReason;
1012
1013        /**
1014         * List of actors participating in this Contract Provision.
1015         */
1016        @Child(name = "actor", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1017        @Description(shortDefinition="Contract Term Actor List", formalDefinition="List of actors participating in this Contract Provision." )
1018        protected List<TermActorComponent> actor;
1019
1020        /**
1021         * Human readable form of this Contract Provision.
1022         */
1023        @Child(name = "text", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false)
1024        @Description(shortDefinition="Human readable Contract term text", formalDefinition="Human readable form of this Contract Provision." )
1025        protected StringType text;
1026
1027        /**
1028         * Contract Provision Valued Item List.
1029         */
1030        @Child(name = "valuedItem", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1031        @Description(shortDefinition="Contract Term Valued Item", formalDefinition="Contract Provision Valued Item List." )
1032        protected List<TermValuedItemComponent> valuedItem;
1033
1034        /**
1035         * Nested group of Contract Provisions.
1036         */
1037        @Child(name = "group", type = {TermComponent.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1038        @Description(shortDefinition="Nested Contract Term Group", formalDefinition="Nested group of Contract Provisions." )
1039        protected List<TermComponent> group;
1040
1041        private static final long serialVersionUID = -1137577465L;
1042
1043    /*
1044     * Constructor
1045     */
1046      public TermComponent() {
1047        super();
1048      }
1049
1050        /**
1051         * @return {@link #identifier} (Unique identifier for this particular Contract Provision.)
1052         */
1053        public Identifier getIdentifier() { 
1054          if (this.identifier == null)
1055            if (Configuration.errorOnAutoCreate())
1056              throw new Error("Attempt to auto-create TermComponent.identifier");
1057            else if (Configuration.doAutoCreate())
1058              this.identifier = new Identifier(); // cc
1059          return this.identifier;
1060        }
1061
1062        public boolean hasIdentifier() { 
1063          return this.identifier != null && !this.identifier.isEmpty();
1064        }
1065
1066        /**
1067         * @param value {@link #identifier} (Unique identifier for this particular Contract Provision.)
1068         */
1069        public TermComponent setIdentifier(Identifier value) { 
1070          this.identifier = value;
1071          return this;
1072        }
1073
1074        /**
1075         * @return {@link #issued} (When this Contract Provision was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
1076         */
1077        public DateTimeType getIssuedElement() { 
1078          if (this.issued == null)
1079            if (Configuration.errorOnAutoCreate())
1080              throw new Error("Attempt to auto-create TermComponent.issued");
1081            else if (Configuration.doAutoCreate())
1082              this.issued = new DateTimeType(); // bb
1083          return this.issued;
1084        }
1085
1086        public boolean hasIssuedElement() { 
1087          return this.issued != null && !this.issued.isEmpty();
1088        }
1089
1090        public boolean hasIssued() { 
1091          return this.issued != null && !this.issued.isEmpty();
1092        }
1093
1094        /**
1095         * @param value {@link #issued} (When this Contract Provision was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
1096         */
1097        public TermComponent setIssuedElement(DateTimeType value) { 
1098          this.issued = value;
1099          return this;
1100        }
1101
1102        /**
1103         * @return When this Contract Provision was issued.
1104         */
1105        public Date getIssued() { 
1106          return this.issued == null ? null : this.issued.getValue();
1107        }
1108
1109        /**
1110         * @param value When this Contract Provision was issued.
1111         */
1112        public TermComponent setIssued(Date value) { 
1113          if (value == null)
1114            this.issued = null;
1115          else {
1116            if (this.issued == null)
1117              this.issued = new DateTimeType();
1118            this.issued.setValue(value);
1119          }
1120          return this;
1121        }
1122
1123        /**
1124         * @return {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1125         */
1126        public Period getApplies() { 
1127          if (this.applies == null)
1128            if (Configuration.errorOnAutoCreate())
1129              throw new Error("Attempt to auto-create TermComponent.applies");
1130            else if (Configuration.doAutoCreate())
1131              this.applies = new Period(); // cc
1132          return this.applies;
1133        }
1134
1135        public boolean hasApplies() { 
1136          return this.applies != null && !this.applies.isEmpty();
1137        }
1138
1139        /**
1140         * @param value {@link #applies} (Relevant time or time-period when this Contract Provision is applicable.)
1141         */
1142        public TermComponent setApplies(Period value) { 
1143          this.applies = value;
1144          return this;
1145        }
1146
1147        /**
1148         * @return {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
1149         */
1150        public CodeableConcept getType() { 
1151          if (this.type == null)
1152            if (Configuration.errorOnAutoCreate())
1153              throw new Error("Attempt to auto-create TermComponent.type");
1154            else if (Configuration.doAutoCreate())
1155              this.type = new CodeableConcept(); // cc
1156          return this.type;
1157        }
1158
1159        public boolean hasType() { 
1160          return this.type != null && !this.type.isEmpty();
1161        }
1162
1163        /**
1164         * @param value {@link #type} (Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.)
1165         */
1166        public TermComponent setType(CodeableConcept value) { 
1167          this.type = value;
1168          return this;
1169        }
1170
1171        /**
1172         * @return {@link #subType} (Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.)
1173         */
1174        public CodeableConcept getSubType() { 
1175          if (this.subType == null)
1176            if (Configuration.errorOnAutoCreate())
1177              throw new Error("Attempt to auto-create TermComponent.subType");
1178            else if (Configuration.doAutoCreate())
1179              this.subType = new CodeableConcept(); // cc
1180          return this.subType;
1181        }
1182
1183        public boolean hasSubType() { 
1184          return this.subType != null && !this.subType.isEmpty();
1185        }
1186
1187        /**
1188         * @param value {@link #subType} (Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.)
1189         */
1190        public TermComponent setSubType(CodeableConcept value) { 
1191          this.subType = value;
1192          return this;
1193        }
1194
1195        /**
1196         * @return {@link #subject} (Who or what this Contract Provision is about.)
1197         */
1198        public Reference getSubject() { 
1199          if (this.subject == null)
1200            if (Configuration.errorOnAutoCreate())
1201              throw new Error("Attempt to auto-create TermComponent.subject");
1202            else if (Configuration.doAutoCreate())
1203              this.subject = new Reference(); // cc
1204          return this.subject;
1205        }
1206
1207        public boolean hasSubject() { 
1208          return this.subject != null && !this.subject.isEmpty();
1209        }
1210
1211        /**
1212         * @param value {@link #subject} (Who or what this Contract Provision is about.)
1213         */
1214        public TermComponent setSubject(Reference value) { 
1215          this.subject = value;
1216          return this;
1217        }
1218
1219        /**
1220         * @return {@link #subject} 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. (Who or what this Contract Provision is about.)
1221         */
1222        public Resource getSubjectTarget() { 
1223          return this.subjectTarget;
1224        }
1225
1226        /**
1227         * @param value {@link #subject} 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. (Who or what this Contract Provision is about.)
1228         */
1229        public TermComponent setSubjectTarget(Resource value) { 
1230          this.subjectTarget = value;
1231          return this;
1232        }
1233
1234        /**
1235         * @return {@link #action} (Action stipulated by this Contract Provision.)
1236         */
1237        public List<CodeableConcept> getAction() { 
1238          if (this.action == null)
1239            this.action = new ArrayList<CodeableConcept>();
1240          return this.action;
1241        }
1242
1243        public boolean hasAction() { 
1244          if (this.action == null)
1245            return false;
1246          for (CodeableConcept item : this.action)
1247            if (!item.isEmpty())
1248              return true;
1249          return false;
1250        }
1251
1252        /**
1253         * @return {@link #action} (Action stipulated by this Contract Provision.)
1254         */
1255    // syntactic sugar
1256        public CodeableConcept addAction() { //3
1257          CodeableConcept t = new CodeableConcept();
1258          if (this.action == null)
1259            this.action = new ArrayList<CodeableConcept>();
1260          this.action.add(t);
1261          return t;
1262        }
1263
1264    // syntactic sugar
1265        public TermComponent addAction(CodeableConcept t) { //3
1266          if (t == null)
1267            return this;
1268          if (this.action == null)
1269            this.action = new ArrayList<CodeableConcept>();
1270          this.action.add(t);
1271          return this;
1272        }
1273
1274        /**
1275         * @return {@link #actionReason} (Reason or purpose for the action stipulated by this Contract Provision.)
1276         */
1277        public List<CodeableConcept> getActionReason() { 
1278          if (this.actionReason == null)
1279            this.actionReason = new ArrayList<CodeableConcept>();
1280          return this.actionReason;
1281        }
1282
1283        public boolean hasActionReason() { 
1284          if (this.actionReason == null)
1285            return false;
1286          for (CodeableConcept item : this.actionReason)
1287            if (!item.isEmpty())
1288              return true;
1289          return false;
1290        }
1291
1292        /**
1293         * @return {@link #actionReason} (Reason or purpose for the action stipulated by this Contract Provision.)
1294         */
1295    // syntactic sugar
1296        public CodeableConcept addActionReason() { //3
1297          CodeableConcept t = new CodeableConcept();
1298          if (this.actionReason == null)
1299            this.actionReason = new ArrayList<CodeableConcept>();
1300          this.actionReason.add(t);
1301          return t;
1302        }
1303
1304    // syntactic sugar
1305        public TermComponent addActionReason(CodeableConcept t) { //3
1306          if (t == null)
1307            return this;
1308          if (this.actionReason == null)
1309            this.actionReason = new ArrayList<CodeableConcept>();
1310          this.actionReason.add(t);
1311          return this;
1312        }
1313
1314        /**
1315         * @return {@link #actor} (List of actors participating in this Contract Provision.)
1316         */
1317        public List<TermActorComponent> getActor() { 
1318          if (this.actor == null)
1319            this.actor = new ArrayList<TermActorComponent>();
1320          return this.actor;
1321        }
1322
1323        public boolean hasActor() { 
1324          if (this.actor == null)
1325            return false;
1326          for (TermActorComponent item : this.actor)
1327            if (!item.isEmpty())
1328              return true;
1329          return false;
1330        }
1331
1332        /**
1333         * @return {@link #actor} (List of actors participating in this Contract Provision.)
1334         */
1335    // syntactic sugar
1336        public TermActorComponent addActor() { //3
1337          TermActorComponent t = new TermActorComponent();
1338          if (this.actor == null)
1339            this.actor = new ArrayList<TermActorComponent>();
1340          this.actor.add(t);
1341          return t;
1342        }
1343
1344    // syntactic sugar
1345        public TermComponent addActor(TermActorComponent t) { //3
1346          if (t == null)
1347            return this;
1348          if (this.actor == null)
1349            this.actor = new ArrayList<TermActorComponent>();
1350          this.actor.add(t);
1351          return this;
1352        }
1353
1354        /**
1355         * @return {@link #text} (Human readable form of this Contract Provision.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
1356         */
1357        public StringType getTextElement() { 
1358          if (this.text == null)
1359            if (Configuration.errorOnAutoCreate())
1360              throw new Error("Attempt to auto-create TermComponent.text");
1361            else if (Configuration.doAutoCreate())
1362              this.text = new StringType(); // bb
1363          return this.text;
1364        }
1365
1366        public boolean hasTextElement() { 
1367          return this.text != null && !this.text.isEmpty();
1368        }
1369
1370        public boolean hasText() { 
1371          return this.text != null && !this.text.isEmpty();
1372        }
1373
1374        /**
1375         * @param value {@link #text} (Human readable form of this Contract Provision.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
1376         */
1377        public TermComponent setTextElement(StringType value) { 
1378          this.text = value;
1379          return this;
1380        }
1381
1382        /**
1383         * @return Human readable form of this Contract Provision.
1384         */
1385        public String getText() { 
1386          return this.text == null ? null : this.text.getValue();
1387        }
1388
1389        /**
1390         * @param value Human readable form of this Contract Provision.
1391         */
1392        public TermComponent setText(String value) { 
1393          if (Utilities.noString(value))
1394            this.text = null;
1395          else {
1396            if (this.text == null)
1397              this.text = new StringType();
1398            this.text.setValue(value);
1399          }
1400          return this;
1401        }
1402
1403        /**
1404         * @return {@link #valuedItem} (Contract Provision Valued Item List.)
1405         */
1406        public List<TermValuedItemComponent> getValuedItem() { 
1407          if (this.valuedItem == null)
1408            this.valuedItem = new ArrayList<TermValuedItemComponent>();
1409          return this.valuedItem;
1410        }
1411
1412        public boolean hasValuedItem() { 
1413          if (this.valuedItem == null)
1414            return false;
1415          for (TermValuedItemComponent item : this.valuedItem)
1416            if (!item.isEmpty())
1417              return true;
1418          return false;
1419        }
1420
1421        /**
1422         * @return {@link #valuedItem} (Contract Provision Valued Item List.)
1423         */
1424    // syntactic sugar
1425        public TermValuedItemComponent addValuedItem() { //3
1426          TermValuedItemComponent t = new TermValuedItemComponent();
1427          if (this.valuedItem == null)
1428            this.valuedItem = new ArrayList<TermValuedItemComponent>();
1429          this.valuedItem.add(t);
1430          return t;
1431        }
1432
1433    // syntactic sugar
1434        public TermComponent addValuedItem(TermValuedItemComponent t) { //3
1435          if (t == null)
1436            return this;
1437          if (this.valuedItem == null)
1438            this.valuedItem = new ArrayList<TermValuedItemComponent>();
1439          this.valuedItem.add(t);
1440          return this;
1441        }
1442
1443        /**
1444         * @return {@link #group} (Nested group of Contract Provisions.)
1445         */
1446        public List<TermComponent> getGroup() { 
1447          if (this.group == null)
1448            this.group = new ArrayList<TermComponent>();
1449          return this.group;
1450        }
1451
1452        public boolean hasGroup() { 
1453          if (this.group == null)
1454            return false;
1455          for (TermComponent item : this.group)
1456            if (!item.isEmpty())
1457              return true;
1458          return false;
1459        }
1460
1461        /**
1462         * @return {@link #group} (Nested group of Contract Provisions.)
1463         */
1464    // syntactic sugar
1465        public TermComponent addGroup() { //3
1466          TermComponent t = new TermComponent();
1467          if (this.group == null)
1468            this.group = new ArrayList<TermComponent>();
1469          this.group.add(t);
1470          return t;
1471        }
1472
1473    // syntactic sugar
1474        public TermComponent addGroup(TermComponent t) { //3
1475          if (t == null)
1476            return this;
1477          if (this.group == null)
1478            this.group = new ArrayList<TermComponent>();
1479          this.group.add(t);
1480          return this;
1481        }
1482
1483        protected void listChildren(List<Property> childrenList) {
1484          super.listChildren(childrenList);
1485          childrenList.add(new Property("identifier", "Identifier", "Unique identifier for this particular Contract Provision.", 0, java.lang.Integer.MAX_VALUE, identifier));
1486          childrenList.add(new Property("issued", "dateTime", "When this Contract Provision was issued.", 0, java.lang.Integer.MAX_VALUE, issued));
1487          childrenList.add(new Property("applies", "Period", "Relevant time or time-period when this Contract Provision is applicable.", 0, java.lang.Integer.MAX_VALUE, applies));
1488          childrenList.add(new Property("type", "CodeableConcept", "Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.", 0, java.lang.Integer.MAX_VALUE, type));
1489          childrenList.add(new Property("subType", "CodeableConcept", "Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.", 0, java.lang.Integer.MAX_VALUE, subType));
1490          childrenList.add(new Property("subject", "Reference(Any)", "Who or what this Contract Provision is about.", 0, java.lang.Integer.MAX_VALUE, subject));
1491          childrenList.add(new Property("action", "CodeableConcept", "Action stipulated by this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, action));
1492          childrenList.add(new Property("actionReason", "CodeableConcept", "Reason or purpose for the action stipulated by this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, actionReason));
1493          childrenList.add(new Property("actor", "", "List of actors participating in this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, actor));
1494          childrenList.add(new Property("text", "string", "Human readable form of this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, text));
1495          childrenList.add(new Property("valuedItem", "", "Contract Provision Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
1496          childrenList.add(new Property("group", "@Contract.term", "Nested group of Contract Provisions.", 0, java.lang.Integer.MAX_VALUE, group));
1497        }
1498
1499      @Override
1500      public void setProperty(String name, Base value) throws FHIRException {
1501        if (name.equals("identifier"))
1502          this.identifier = castToIdentifier(value); // Identifier
1503        else if (name.equals("issued"))
1504          this.issued = castToDateTime(value); // DateTimeType
1505        else if (name.equals("applies"))
1506          this.applies = castToPeriod(value); // Period
1507        else if (name.equals("type"))
1508          this.type = castToCodeableConcept(value); // CodeableConcept
1509        else if (name.equals("subType"))
1510          this.subType = castToCodeableConcept(value); // CodeableConcept
1511        else if (name.equals("subject"))
1512          this.subject = castToReference(value); // Reference
1513        else if (name.equals("action"))
1514          this.getAction().add(castToCodeableConcept(value));
1515        else if (name.equals("actionReason"))
1516          this.getActionReason().add(castToCodeableConcept(value));
1517        else if (name.equals("actor"))
1518          this.getActor().add((TermActorComponent) value);
1519        else if (name.equals("text"))
1520          this.text = castToString(value); // StringType
1521        else if (name.equals("valuedItem"))
1522          this.getValuedItem().add((TermValuedItemComponent) value);
1523        else if (name.equals("group"))
1524          this.getGroup().add((TermComponent) value);
1525        else
1526          super.setProperty(name, value);
1527      }
1528
1529      @Override
1530      public Base addChild(String name) throws FHIRException {
1531        if (name.equals("identifier")) {
1532          this.identifier = new Identifier();
1533          return this.identifier;
1534        }
1535        else if (name.equals("issued")) {
1536          throw new FHIRException("Cannot call addChild on a primitive type Contract.issued");
1537        }
1538        else if (name.equals("applies")) {
1539          this.applies = new Period();
1540          return this.applies;
1541        }
1542        else if (name.equals("type")) {
1543          this.type = new CodeableConcept();
1544          return this.type;
1545        }
1546        else if (name.equals("subType")) {
1547          this.subType = new CodeableConcept();
1548          return this.subType;
1549        }
1550        else if (name.equals("subject")) {
1551          this.subject = new Reference();
1552          return this.subject;
1553        }
1554        else if (name.equals("action")) {
1555          return addAction();
1556        }
1557        else if (name.equals("actionReason")) {
1558          return addActionReason();
1559        }
1560        else if (name.equals("actor")) {
1561          return addActor();
1562        }
1563        else if (name.equals("text")) {
1564          throw new FHIRException("Cannot call addChild on a primitive type Contract.text");
1565        }
1566        else if (name.equals("valuedItem")) {
1567          return addValuedItem();
1568        }
1569        else if (name.equals("group")) {
1570          return addGroup();
1571        }
1572        else
1573          return super.addChild(name);
1574      }
1575
1576      public TermComponent copy() {
1577        TermComponent dst = new TermComponent();
1578        copyValues(dst);
1579        dst.identifier = identifier == null ? null : identifier.copy();
1580        dst.issued = issued == null ? null : issued.copy();
1581        dst.applies = applies == null ? null : applies.copy();
1582        dst.type = type == null ? null : type.copy();
1583        dst.subType = subType == null ? null : subType.copy();
1584        dst.subject = subject == null ? null : subject.copy();
1585        if (action != null) {
1586          dst.action = new ArrayList<CodeableConcept>();
1587          for (CodeableConcept i : action)
1588            dst.action.add(i.copy());
1589        };
1590        if (actionReason != null) {
1591          dst.actionReason = new ArrayList<CodeableConcept>();
1592          for (CodeableConcept i : actionReason)
1593            dst.actionReason.add(i.copy());
1594        };
1595        if (actor != null) {
1596          dst.actor = new ArrayList<TermActorComponent>();
1597          for (TermActorComponent i : actor)
1598            dst.actor.add(i.copy());
1599        };
1600        dst.text = text == null ? null : text.copy();
1601        if (valuedItem != null) {
1602          dst.valuedItem = new ArrayList<TermValuedItemComponent>();
1603          for (TermValuedItemComponent i : valuedItem)
1604            dst.valuedItem.add(i.copy());
1605        };
1606        if (group != null) {
1607          dst.group = new ArrayList<TermComponent>();
1608          for (TermComponent i : group)
1609            dst.group.add(i.copy());
1610        };
1611        return dst;
1612      }
1613
1614      @Override
1615      public boolean equalsDeep(Base other) {
1616        if (!super.equalsDeep(other))
1617          return false;
1618        if (!(other instanceof TermComponent))
1619          return false;
1620        TermComponent o = (TermComponent) other;
1621        return compareDeep(identifier, o.identifier, true) && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true)
1622           && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(subject, o.subject, true)
1623           && compareDeep(action, o.action, true) && compareDeep(actionReason, o.actionReason, true) && compareDeep(actor, o.actor, true)
1624           && compareDeep(text, o.text, true) && compareDeep(valuedItem, o.valuedItem, true) && compareDeep(group, o.group, true)
1625          ;
1626      }
1627
1628      @Override
1629      public boolean equalsShallow(Base other) {
1630        if (!super.equalsShallow(other))
1631          return false;
1632        if (!(other instanceof TermComponent))
1633          return false;
1634        TermComponent o = (TermComponent) other;
1635        return compareValues(issued, o.issued, true) && compareValues(text, o.text, true);
1636      }
1637
1638      public boolean isEmpty() {
1639        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (issued == null || issued.isEmpty())
1640           && (applies == null || applies.isEmpty()) && (type == null || type.isEmpty()) && (subType == null || subType.isEmpty())
1641           && (subject == null || subject.isEmpty()) && (action == null || action.isEmpty()) && (actionReason == null || actionReason.isEmpty())
1642           && (actor == null || actor.isEmpty()) && (text == null || text.isEmpty()) && (valuedItem == null || valuedItem.isEmpty())
1643           && (group == null || group.isEmpty());
1644      }
1645
1646  public String fhirType() {
1647    return "Contract.term";
1648
1649  }
1650
1651  }
1652
1653    @Block()
1654    public static class TermActorComponent extends BackboneElement implements IBaseBackboneElement {
1655        /**
1656         * The actor assigned a role in this Contract Provision.
1657         */
1658        @Child(name = "entity", type = {Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class}, order=1, min=1, max=1, modifier=false, summary=false)
1659        @Description(shortDefinition="Contract Term Actor", formalDefinition="The actor assigned a role in this Contract Provision." )
1660        protected Reference entity;
1661
1662        /**
1663         * The actual object that is the target of the reference (The actor assigned a role in this Contract Provision.)
1664         */
1665        protected Resource entityTarget;
1666
1667        /**
1668         * Role played by the actor assigned this role in this Contract Provision.
1669         */
1670        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1671        @Description(shortDefinition="Contract Term Actor Role", formalDefinition="Role played by the actor assigned this role in this Contract Provision." )
1672        protected List<CodeableConcept> role;
1673
1674        private static final long serialVersionUID = 1371245689L;
1675
1676    /*
1677     * Constructor
1678     */
1679      public TermActorComponent() {
1680        super();
1681      }
1682
1683    /*
1684     * Constructor
1685     */
1686      public TermActorComponent(Reference entity) {
1687        super();
1688        this.entity = entity;
1689      }
1690
1691        /**
1692         * @return {@link #entity} (The actor assigned a role in this Contract Provision.)
1693         */
1694        public Reference getEntity() { 
1695          if (this.entity == null)
1696            if (Configuration.errorOnAutoCreate())
1697              throw new Error("Attempt to auto-create TermActorComponent.entity");
1698            else if (Configuration.doAutoCreate())
1699              this.entity = new Reference(); // cc
1700          return this.entity;
1701        }
1702
1703        public boolean hasEntity() { 
1704          return this.entity != null && !this.entity.isEmpty();
1705        }
1706
1707        /**
1708         * @param value {@link #entity} (The actor assigned a role in this Contract Provision.)
1709         */
1710        public TermActorComponent setEntity(Reference value) { 
1711          this.entity = value;
1712          return this;
1713        }
1714
1715        /**
1716         * @return {@link #entity} 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 actor assigned a role in this Contract Provision.)
1717         */
1718        public Resource getEntityTarget() { 
1719          return this.entityTarget;
1720        }
1721
1722        /**
1723         * @param value {@link #entity} 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 actor assigned a role in this Contract Provision.)
1724         */
1725        public TermActorComponent setEntityTarget(Resource value) { 
1726          this.entityTarget = value;
1727          return this;
1728        }
1729
1730        /**
1731         * @return {@link #role} (Role played by the actor assigned this role in this Contract Provision.)
1732         */
1733        public List<CodeableConcept> getRole() { 
1734          if (this.role == null)
1735            this.role = new ArrayList<CodeableConcept>();
1736          return this.role;
1737        }
1738
1739        public boolean hasRole() { 
1740          if (this.role == null)
1741            return false;
1742          for (CodeableConcept item : this.role)
1743            if (!item.isEmpty())
1744              return true;
1745          return false;
1746        }
1747
1748        /**
1749         * @return {@link #role} (Role played by the actor assigned this role in this Contract Provision.)
1750         */
1751    // syntactic sugar
1752        public CodeableConcept addRole() { //3
1753          CodeableConcept t = new CodeableConcept();
1754          if (this.role == null)
1755            this.role = new ArrayList<CodeableConcept>();
1756          this.role.add(t);
1757          return t;
1758        }
1759
1760    // syntactic sugar
1761        public TermActorComponent addRole(CodeableConcept t) { //3
1762          if (t == null)
1763            return this;
1764          if (this.role == null)
1765            this.role = new ArrayList<CodeableConcept>();
1766          this.role.add(t);
1767          return this;
1768        }
1769
1770        protected void listChildren(List<Property> childrenList) {
1771          super.listChildren(childrenList);
1772          childrenList.add(new Property("entity", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "The actor assigned a role in this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, entity));
1773          childrenList.add(new Property("role", "CodeableConcept", "Role played by the actor assigned this role in this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, role));
1774        }
1775
1776      @Override
1777      public void setProperty(String name, Base value) throws FHIRException {
1778        if (name.equals("entity"))
1779          this.entity = castToReference(value); // Reference
1780        else if (name.equals("role"))
1781          this.getRole().add(castToCodeableConcept(value));
1782        else
1783          super.setProperty(name, value);
1784      }
1785
1786      @Override
1787      public Base addChild(String name) throws FHIRException {
1788        if (name.equals("entity")) {
1789          this.entity = new Reference();
1790          return this.entity;
1791        }
1792        else if (name.equals("role")) {
1793          return addRole();
1794        }
1795        else
1796          return super.addChild(name);
1797      }
1798
1799      public TermActorComponent copy() {
1800        TermActorComponent dst = new TermActorComponent();
1801        copyValues(dst);
1802        dst.entity = entity == null ? null : entity.copy();
1803        if (role != null) {
1804          dst.role = new ArrayList<CodeableConcept>();
1805          for (CodeableConcept i : role)
1806            dst.role.add(i.copy());
1807        };
1808        return dst;
1809      }
1810
1811      @Override
1812      public boolean equalsDeep(Base other) {
1813        if (!super.equalsDeep(other))
1814          return false;
1815        if (!(other instanceof TermActorComponent))
1816          return false;
1817        TermActorComponent o = (TermActorComponent) other;
1818        return compareDeep(entity, o.entity, true) && compareDeep(role, o.role, true);
1819      }
1820
1821      @Override
1822      public boolean equalsShallow(Base other) {
1823        if (!super.equalsShallow(other))
1824          return false;
1825        if (!(other instanceof TermActorComponent))
1826          return false;
1827        TermActorComponent o = (TermActorComponent) other;
1828        return true;
1829      }
1830
1831      public boolean isEmpty() {
1832        return super.isEmpty() && (entity == null || entity.isEmpty()) && (role == null || role.isEmpty())
1833          ;
1834      }
1835
1836  public String fhirType() {
1837    return "Contract.term.actor";
1838
1839  }
1840
1841  }
1842
1843    @Block()
1844    public static class TermValuedItemComponent extends BackboneElement implements IBaseBackboneElement {
1845        /**
1846         * Specific type of Contract Provision Valued Item that may be priced.
1847         */
1848        @Child(name = "entity", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1849        @Description(shortDefinition="Contract Term Valued Item Type", formalDefinition="Specific type of Contract Provision Valued Item that may be priced." )
1850        protected Type entity;
1851
1852        /**
1853         * Identifies a Contract Provision Valued Item instance.
1854         */
1855        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
1856        @Description(shortDefinition="Contract Term Valued Item Identifier", formalDefinition="Identifies a Contract Provision Valued Item instance." )
1857        protected Identifier identifier;
1858
1859        /**
1860         * Indicates the time during which this Contract Term ValuedItem information is effective.
1861         */
1862        @Child(name = "effectiveTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1863        @Description(shortDefinition="Contract Term Valued Item Effective Tiem", formalDefinition="Indicates the time during which this Contract Term ValuedItem information is effective." )
1864        protected DateTimeType effectiveTime;
1865
1866        /**
1867         * Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.
1868         */
1869        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
1870        @Description(shortDefinition="Contract Term Valued Item Count", formalDefinition="Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances." )
1871        protected SimpleQuantity quantity;
1872
1873        /**
1874         * A Contract Provision Valued Item unit valuation measure.
1875         */
1876        @Child(name = "unitPrice", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
1877        @Description(shortDefinition="Contract Term Valued Item fee, charge, or cost", formalDefinition="A Contract Provision Valued Item unit valuation measure." )
1878        protected Money unitPrice;
1879
1880        /**
1881         * A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
1882         */
1883        @Child(name = "factor", type = {DecimalType.class}, order=6, min=0, max=1, modifier=false, summary=false)
1884        @Description(shortDefinition="Contract Term Valued Item Price Scaling Factor", formalDefinition="A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount." )
1885        protected DecimalType factor;
1886
1887        /**
1888         * An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
1889         */
1890        @Child(name = "points", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
1891        @Description(shortDefinition="Contract Term Valued Item Difficulty Scaling Factor", formalDefinition="An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point." )
1892        protected DecimalType points;
1893
1894        /**
1895         * Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
1896         */
1897        @Child(name = "net", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
1898        @Description(shortDefinition="Total Contract Term Valued Item Value", formalDefinition="Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
1899        protected Money net;
1900
1901        private static final long serialVersionUID = 1782449516L;
1902
1903    /*
1904     * Constructor
1905     */
1906      public TermValuedItemComponent() {
1907        super();
1908      }
1909
1910        /**
1911         * @return {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
1912         */
1913        public Type getEntity() { 
1914          return this.entity;
1915        }
1916
1917        /**
1918         * @return {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
1919         */
1920        public CodeableConcept getEntityCodeableConcept() throws FHIRException { 
1921          if (!(this.entity instanceof CodeableConcept))
1922            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.entity.getClass().getName()+" was encountered");
1923          return (CodeableConcept) this.entity;
1924        }
1925
1926        public boolean hasEntityCodeableConcept() { 
1927          return this.entity instanceof CodeableConcept;
1928        }
1929
1930        /**
1931         * @return {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
1932         */
1933        public Reference getEntityReference() throws FHIRException { 
1934          if (!(this.entity instanceof Reference))
1935            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.entity.getClass().getName()+" was encountered");
1936          return (Reference) this.entity;
1937        }
1938
1939        public boolean hasEntityReference() { 
1940          return this.entity instanceof Reference;
1941        }
1942
1943        public boolean hasEntity() { 
1944          return this.entity != null && !this.entity.isEmpty();
1945        }
1946
1947        /**
1948         * @param value {@link #entity} (Specific type of Contract Provision Valued Item that may be priced.)
1949         */
1950        public TermValuedItemComponent setEntity(Type value) { 
1951          this.entity = value;
1952          return this;
1953        }
1954
1955        /**
1956         * @return {@link #identifier} (Identifies a Contract Provision Valued Item instance.)
1957         */
1958        public Identifier getIdentifier() { 
1959          if (this.identifier == null)
1960            if (Configuration.errorOnAutoCreate())
1961              throw new Error("Attempt to auto-create TermValuedItemComponent.identifier");
1962            else if (Configuration.doAutoCreate())
1963              this.identifier = new Identifier(); // cc
1964          return this.identifier;
1965        }
1966
1967        public boolean hasIdentifier() { 
1968          return this.identifier != null && !this.identifier.isEmpty();
1969        }
1970
1971        /**
1972         * @param value {@link #identifier} (Identifies a Contract Provision Valued Item instance.)
1973         */
1974        public TermValuedItemComponent setIdentifier(Identifier value) { 
1975          this.identifier = value;
1976          return this;
1977        }
1978
1979        /**
1980         * @return {@link #effectiveTime} (Indicates the time during which this Contract Term ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
1981         */
1982        public DateTimeType getEffectiveTimeElement() { 
1983          if (this.effectiveTime == null)
1984            if (Configuration.errorOnAutoCreate())
1985              throw new Error("Attempt to auto-create TermValuedItemComponent.effectiveTime");
1986            else if (Configuration.doAutoCreate())
1987              this.effectiveTime = new DateTimeType(); // bb
1988          return this.effectiveTime;
1989        }
1990
1991        public boolean hasEffectiveTimeElement() { 
1992          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
1993        }
1994
1995        public boolean hasEffectiveTime() { 
1996          return this.effectiveTime != null && !this.effectiveTime.isEmpty();
1997        }
1998
1999        /**
2000         * @param value {@link #effectiveTime} (Indicates the time during which this Contract Term ValuedItem information is effective.). This is the underlying object with id, value and extensions. The accessor "getEffectiveTime" gives direct access to the value
2001         */
2002        public TermValuedItemComponent setEffectiveTimeElement(DateTimeType value) { 
2003          this.effectiveTime = value;
2004          return this;
2005        }
2006
2007        /**
2008         * @return Indicates the time during which this Contract Term ValuedItem information is effective.
2009         */
2010        public Date getEffectiveTime() { 
2011          return this.effectiveTime == null ? null : this.effectiveTime.getValue();
2012        }
2013
2014        /**
2015         * @param value Indicates the time during which this Contract Term ValuedItem information is effective.
2016         */
2017        public TermValuedItemComponent setEffectiveTime(Date value) { 
2018          if (value == null)
2019            this.effectiveTime = null;
2020          else {
2021            if (this.effectiveTime == null)
2022              this.effectiveTime = new DateTimeType();
2023            this.effectiveTime.setValue(value);
2024          }
2025          return this;
2026        }
2027
2028        /**
2029         * @return {@link #quantity} (Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.)
2030         */
2031        public SimpleQuantity getQuantity() { 
2032          if (this.quantity == null)
2033            if (Configuration.errorOnAutoCreate())
2034              throw new Error("Attempt to auto-create TermValuedItemComponent.quantity");
2035            else if (Configuration.doAutoCreate())
2036              this.quantity = new SimpleQuantity(); // cc
2037          return this.quantity;
2038        }
2039
2040        public boolean hasQuantity() { 
2041          return this.quantity != null && !this.quantity.isEmpty();
2042        }
2043
2044        /**
2045         * @param value {@link #quantity} (Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.)
2046         */
2047        public TermValuedItemComponent setQuantity(SimpleQuantity value) { 
2048          this.quantity = value;
2049          return this;
2050        }
2051
2052        /**
2053         * @return {@link #unitPrice} (A Contract Provision Valued Item unit valuation measure.)
2054         */
2055        public Money getUnitPrice() { 
2056          if (this.unitPrice == null)
2057            if (Configuration.errorOnAutoCreate())
2058              throw new Error("Attempt to auto-create TermValuedItemComponent.unitPrice");
2059            else if (Configuration.doAutoCreate())
2060              this.unitPrice = new Money(); // cc
2061          return this.unitPrice;
2062        }
2063
2064        public boolean hasUnitPrice() { 
2065          return this.unitPrice != null && !this.unitPrice.isEmpty();
2066        }
2067
2068        /**
2069         * @param value {@link #unitPrice} (A Contract Provision Valued Item unit valuation measure.)
2070         */
2071        public TermValuedItemComponent setUnitPrice(Money value) { 
2072          this.unitPrice = value;
2073          return this;
2074        }
2075
2076        /**
2077         * @return {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
2078         */
2079        public DecimalType getFactorElement() { 
2080          if (this.factor == null)
2081            if (Configuration.errorOnAutoCreate())
2082              throw new Error("Attempt to auto-create TermValuedItemComponent.factor");
2083            else if (Configuration.doAutoCreate())
2084              this.factor = new DecimalType(); // bb
2085          return this.factor;
2086        }
2087
2088        public boolean hasFactorElement() { 
2089          return this.factor != null && !this.factor.isEmpty();
2090        }
2091
2092        public boolean hasFactor() { 
2093          return this.factor != null && !this.factor.isEmpty();
2094        }
2095
2096        /**
2097         * @param value {@link #factor} (A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
2098         */
2099        public TermValuedItemComponent setFactorElement(DecimalType value) { 
2100          this.factor = value;
2101          return this;
2102        }
2103
2104        /**
2105         * @return A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
2106         */
2107        public BigDecimal getFactor() { 
2108          return this.factor == null ? null : this.factor.getValue();
2109        }
2110
2111        /**
2112         * @param value A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
2113         */
2114        public TermValuedItemComponent setFactor(BigDecimal value) { 
2115          if (value == null)
2116            this.factor = null;
2117          else {
2118            if (this.factor == null)
2119              this.factor = new DecimalType();
2120            this.factor.setValue(value);
2121          }
2122          return this;
2123        }
2124
2125        /**
2126         * @return {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
2127         */
2128        public DecimalType getPointsElement() { 
2129          if (this.points == null)
2130            if (Configuration.errorOnAutoCreate())
2131              throw new Error("Attempt to auto-create TermValuedItemComponent.points");
2132            else if (Configuration.doAutoCreate())
2133              this.points = new DecimalType(); // bb
2134          return this.points;
2135        }
2136
2137        public boolean hasPointsElement() { 
2138          return this.points != null && !this.points.isEmpty();
2139        }
2140
2141        public boolean hasPoints() { 
2142          return this.points != null && !this.points.isEmpty();
2143        }
2144
2145        /**
2146         * @param value {@link #points} (An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.). This is the underlying object with id, value and extensions. The accessor "getPoints" gives direct access to the value
2147         */
2148        public TermValuedItemComponent setPointsElement(DecimalType value) { 
2149          this.points = value;
2150          return this;
2151        }
2152
2153        /**
2154         * @return An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
2155         */
2156        public BigDecimal getPoints() { 
2157          return this.points == null ? null : this.points.getValue();
2158        }
2159
2160        /**
2161         * @param value An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.
2162         */
2163        public TermValuedItemComponent setPoints(BigDecimal value) { 
2164          if (value == null)
2165            this.points = null;
2166          else {
2167            if (this.points == null)
2168              this.points = new DecimalType();
2169            this.points.setValue(value);
2170          }
2171          return this;
2172        }
2173
2174        /**
2175         * @return {@link #net} (Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
2176         */
2177        public Money getNet() { 
2178          if (this.net == null)
2179            if (Configuration.errorOnAutoCreate())
2180              throw new Error("Attempt to auto-create TermValuedItemComponent.net");
2181            else if (Configuration.doAutoCreate())
2182              this.net = new Money(); // cc
2183          return this.net;
2184        }
2185
2186        public boolean hasNet() { 
2187          return this.net != null && !this.net.isEmpty();
2188        }
2189
2190        /**
2191         * @param value {@link #net} (Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
2192         */
2193        public TermValuedItemComponent setNet(Money value) { 
2194          this.net = value;
2195          return this;
2196        }
2197
2198        protected void listChildren(List<Property> childrenList) {
2199          super.listChildren(childrenList);
2200          childrenList.add(new Property("entity[x]", "CodeableConcept|Reference(Any)", "Specific type of Contract Provision Valued Item that may be priced.", 0, java.lang.Integer.MAX_VALUE, entity));
2201          childrenList.add(new Property("identifier", "Identifier", "Identifies a Contract Provision Valued Item instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
2202          childrenList.add(new Property("effectiveTime", "dateTime", "Indicates the time during which this Contract Term ValuedItem information is effective.", 0, java.lang.Integer.MAX_VALUE, effectiveTime));
2203          childrenList.add(new Property("quantity", "SimpleQuantity", "Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.", 0, java.lang.Integer.MAX_VALUE, quantity));
2204          childrenList.add(new Property("unitPrice", "Money", "A Contract Provision Valued Item unit valuation measure.", 0, java.lang.Integer.MAX_VALUE, unitPrice));
2205          childrenList.add(new Property("factor", "decimal", "A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.", 0, java.lang.Integer.MAX_VALUE, factor));
2206          childrenList.add(new Property("points", "decimal", "An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.", 0, java.lang.Integer.MAX_VALUE, points));
2207          childrenList.add(new Property("net", "Money", "Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, java.lang.Integer.MAX_VALUE, net));
2208        }
2209
2210      @Override
2211      public void setProperty(String name, Base value) throws FHIRException {
2212        if (name.equals("entity[x]"))
2213          this.entity = (Type) value; // Type
2214        else if (name.equals("identifier"))
2215          this.identifier = castToIdentifier(value); // Identifier
2216        else if (name.equals("effectiveTime"))
2217          this.effectiveTime = castToDateTime(value); // DateTimeType
2218        else if (name.equals("quantity"))
2219          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2220        else if (name.equals("unitPrice"))
2221          this.unitPrice = castToMoney(value); // Money
2222        else if (name.equals("factor"))
2223          this.factor = castToDecimal(value); // DecimalType
2224        else if (name.equals("points"))
2225          this.points = castToDecimal(value); // DecimalType
2226        else if (name.equals("net"))
2227          this.net = castToMoney(value); // Money
2228        else
2229          super.setProperty(name, value);
2230      }
2231
2232      @Override
2233      public Base addChild(String name) throws FHIRException {
2234        if (name.equals("entityCodeableConcept")) {
2235          this.entity = new CodeableConcept();
2236          return this.entity;
2237        }
2238        else if (name.equals("entityReference")) {
2239          this.entity = new Reference();
2240          return this.entity;
2241        }
2242        else if (name.equals("identifier")) {
2243          this.identifier = new Identifier();
2244          return this.identifier;
2245        }
2246        else if (name.equals("effectiveTime")) {
2247          throw new FHIRException("Cannot call addChild on a primitive type Contract.effectiveTime");
2248        }
2249        else if (name.equals("quantity")) {
2250          this.quantity = new SimpleQuantity();
2251          return this.quantity;
2252        }
2253        else if (name.equals("unitPrice")) {
2254          this.unitPrice = new Money();
2255          return this.unitPrice;
2256        }
2257        else if (name.equals("factor")) {
2258          throw new FHIRException("Cannot call addChild on a primitive type Contract.factor");
2259        }
2260        else if (name.equals("points")) {
2261          throw new FHIRException("Cannot call addChild on a primitive type Contract.points");
2262        }
2263        else if (name.equals("net")) {
2264          this.net = new Money();
2265          return this.net;
2266        }
2267        else
2268          return super.addChild(name);
2269      }
2270
2271      public TermValuedItemComponent copy() {
2272        TermValuedItemComponent dst = new TermValuedItemComponent();
2273        copyValues(dst);
2274        dst.entity = entity == null ? null : entity.copy();
2275        dst.identifier = identifier == null ? null : identifier.copy();
2276        dst.effectiveTime = effectiveTime == null ? null : effectiveTime.copy();
2277        dst.quantity = quantity == null ? null : quantity.copy();
2278        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
2279        dst.factor = factor == null ? null : factor.copy();
2280        dst.points = points == null ? null : points.copy();
2281        dst.net = net == null ? null : net.copy();
2282        return dst;
2283      }
2284
2285      @Override
2286      public boolean equalsDeep(Base other) {
2287        if (!super.equalsDeep(other))
2288          return false;
2289        if (!(other instanceof TermValuedItemComponent))
2290          return false;
2291        TermValuedItemComponent o = (TermValuedItemComponent) other;
2292        return compareDeep(entity, o.entity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(effectiveTime, o.effectiveTime, true)
2293           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
2294           && compareDeep(points, o.points, true) && compareDeep(net, o.net, true);
2295      }
2296
2297      @Override
2298      public boolean equalsShallow(Base other) {
2299        if (!super.equalsShallow(other))
2300          return false;
2301        if (!(other instanceof TermValuedItemComponent))
2302          return false;
2303        TermValuedItemComponent o = (TermValuedItemComponent) other;
2304        return compareValues(effectiveTime, o.effectiveTime, true) && compareValues(factor, o.factor, true)
2305           && compareValues(points, o.points, true);
2306      }
2307
2308      public boolean isEmpty() {
2309        return super.isEmpty() && (entity == null || entity.isEmpty()) && (identifier == null || identifier.isEmpty())
2310           && (effectiveTime == null || effectiveTime.isEmpty()) && (quantity == null || quantity.isEmpty())
2311           && (unitPrice == null || unitPrice.isEmpty()) && (factor == null || factor.isEmpty()) && (points == null || points.isEmpty())
2312           && (net == null || net.isEmpty());
2313      }
2314
2315  public String fhirType() {
2316    return "Contract.term.valuedItem";
2317
2318  }
2319
2320  }
2321
2322    @Block()
2323    public static class FriendlyLanguageComponent extends BackboneElement implements IBaseBackboneElement {
2324        /**
2325         * Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.
2326         */
2327        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
2328        @Description(shortDefinition="Easily comprehended representation of this Contract", formalDefinition="Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability." )
2329        protected Type content;
2330
2331        private static final long serialVersionUID = -1763459053L;
2332
2333    /*
2334     * Constructor
2335     */
2336      public FriendlyLanguageComponent() {
2337        super();
2338      }
2339
2340    /*
2341     * Constructor
2342     */
2343      public FriendlyLanguageComponent(Type content) {
2344        super();
2345        this.content = content;
2346      }
2347
2348        /**
2349         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
2350         */
2351        public Type getContent() { 
2352          return this.content;
2353        }
2354
2355        /**
2356         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
2357         */
2358        public Attachment getContentAttachment() throws FHIRException { 
2359          if (!(this.content instanceof Attachment))
2360            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
2361          return (Attachment) this.content;
2362        }
2363
2364        public boolean hasContentAttachment() { 
2365          return this.content instanceof Attachment;
2366        }
2367
2368        /**
2369         * @return {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
2370         */
2371        public Reference getContentReference() throws FHIRException { 
2372          if (!(this.content instanceof Reference))
2373            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
2374          return (Reference) this.content;
2375        }
2376
2377        public boolean hasContentReference() { 
2378          return this.content instanceof Reference;
2379        }
2380
2381        public boolean hasContent() { 
2382          return this.content != null && !this.content.isEmpty();
2383        }
2384
2385        /**
2386         * @param value {@link #content} (Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.)
2387         */
2388        public FriendlyLanguageComponent setContent(Type value) { 
2389          this.content = value;
2390          return this;
2391        }
2392
2393        protected void listChildren(List<Property> childrenList) {
2394          super.listChildren(childrenList);
2395          childrenList.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, java.lang.Integer.MAX_VALUE, content));
2396        }
2397
2398      @Override
2399      public void setProperty(String name, Base value) throws FHIRException {
2400        if (name.equals("content[x]"))
2401          this.content = (Type) value; // Type
2402        else
2403          super.setProperty(name, value);
2404      }
2405
2406      @Override
2407      public Base addChild(String name) throws FHIRException {
2408        if (name.equals("contentAttachment")) {
2409          this.content = new Attachment();
2410          return this.content;
2411        }
2412        else if (name.equals("contentReference")) {
2413          this.content = new Reference();
2414          return this.content;
2415        }
2416        else
2417          return super.addChild(name);
2418      }
2419
2420      public FriendlyLanguageComponent copy() {
2421        FriendlyLanguageComponent dst = new FriendlyLanguageComponent();
2422        copyValues(dst);
2423        dst.content = content == null ? null : content.copy();
2424        return dst;
2425      }
2426
2427      @Override
2428      public boolean equalsDeep(Base other) {
2429        if (!super.equalsDeep(other))
2430          return false;
2431        if (!(other instanceof FriendlyLanguageComponent))
2432          return false;
2433        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other;
2434        return compareDeep(content, o.content, true);
2435      }
2436
2437      @Override
2438      public boolean equalsShallow(Base other) {
2439        if (!super.equalsShallow(other))
2440          return false;
2441        if (!(other instanceof FriendlyLanguageComponent))
2442          return false;
2443        FriendlyLanguageComponent o = (FriendlyLanguageComponent) other;
2444        return true;
2445      }
2446
2447      public boolean isEmpty() {
2448        return super.isEmpty() && (content == null || content.isEmpty());
2449      }
2450
2451  public String fhirType() {
2452    return "Contract.friendly";
2453
2454  }
2455
2456  }
2457
2458    @Block()
2459    public static class LegalLanguageComponent extends BackboneElement implements IBaseBackboneElement {
2460        /**
2461         * Contract legal text in human renderable form.
2462         */
2463        @Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1, modifier=false, summary=false)
2464        @Description(shortDefinition="Contract Legal Text", formalDefinition="Contract legal text in human renderable form." )
2465        protected Type content;
2466
2467        private static final long serialVersionUID = -1763459053L;
2468
2469    /*
2470     * Constructor
2471     */
2472      public LegalLanguageComponent() {
2473        super();
2474      }
2475
2476    /*
2477     * Constructor
2478     */
2479      public LegalLanguageComponent(Type content) {
2480        super();
2481        this.content = content;
2482      }
2483
2484        /**
2485         * @return {@link #content} (Contract legal text in human renderable form.)
2486         */
2487        public Type getContent() { 
2488          return this.content;
2489        }
2490
2491        /**
2492         * @return {@link #content} (Contract legal text in human renderable form.)
2493         */
2494        public Attachment getContentAttachment() throws FHIRException { 
2495          if (!(this.content instanceof Attachment))
2496            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
2497          return (Attachment) this.content;
2498        }
2499
2500        public boolean hasContentAttachment() { 
2501          return this.content instanceof Attachment;
2502        }
2503
2504        /**
2505         * @return {@link #content} (Contract legal text in human renderable form.)
2506         */
2507        public Reference getContentReference() throws FHIRException { 
2508          if (!(this.content instanceof Reference))
2509            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
2510          return (Reference) this.content;
2511        }
2512
2513        public boolean hasContentReference() { 
2514          return this.content instanceof Reference;
2515        }
2516
2517        public boolean hasContent() { 
2518          return this.content != null && !this.content.isEmpty();
2519        }
2520
2521        /**
2522         * @param value {@link #content} (Contract legal text in human renderable form.)
2523         */
2524        public LegalLanguageComponent setContent(Type value) { 
2525          this.content = value;
2526          return this;
2527        }
2528
2529        protected void listChildren(List<Property> childrenList) {
2530          super.listChildren(childrenList);
2531          childrenList.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, java.lang.Integer.MAX_VALUE, content));
2532        }
2533
2534      @Override
2535      public void setProperty(String name, Base value) throws FHIRException {
2536        if (name.equals("content[x]"))
2537          this.content = (Type) value; // Type
2538        else
2539          super.setProperty(name, value);
2540      }
2541
2542      @Override
2543      public Base addChild(String name) throws FHIRException {
2544        if (name.equals("contentAttachment")) {
2545          this.content = new Attachment();
2546          return this.content;
2547        }
2548        else if (name.equals("contentReference")) {
2549          this.content = new Reference();
2550          return this.content;
2551        }
2552        else
2553          return super.addChild(name);
2554      }
2555
2556      public LegalLanguageComponent copy() {
2557        LegalLanguageComponent dst = new LegalLanguageComponent();
2558        copyValues(dst);
2559        dst.content = content == null ? null : content.copy();
2560        return dst;
2561      }
2562
2563      @Override
2564      public boolean equalsDeep(Base other) {
2565        if (!super.equalsDeep(other))
2566          return false;
2567        if (!(other instanceof LegalLanguageComponent))
2568          return false;
2569        LegalLanguageComponent o = (LegalLanguageComponent) other;
2570        return compareDeep(content, o.content, true);
2571      }
2572
2573      @Override
2574      public boolean equalsShallow(Base other) {
2575        if (!super.equalsShallow(other))
2576          return false;
2577        if (!(other instanceof LegalLanguageComponent))
2578          return false;
2579        LegalLanguageComponent o = (LegalLanguageComponent) other;
2580        return true;
2581      }
2582
2583      public boolean isEmpty() {
2584        return super.isEmpty() && (content == null || content.isEmpty());
2585      }
2586
2587  public String fhirType() {
2588    return "Contract.legal";
2589
2590  }
2591
2592  }
2593
2594    @Block()
2595    public static class ComputableLanguageComponent extends BackboneElement implements IBaseBackboneElement {
2596        /**
2597         * Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).
2598         */
2599        @Child(name = "content", type = {Attachment.class, DocumentReference.class}, order=1, min=1, max=1, modifier=false, summary=false)
2600        @Description(shortDefinition="Computable Contract Rules", formalDefinition="Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal)." )
2601        protected Type content;
2602
2603        private static final long serialVersionUID = -1763459053L;
2604
2605    /*
2606     * Constructor
2607     */
2608      public ComputableLanguageComponent() {
2609        super();
2610      }
2611
2612    /*
2613     * Constructor
2614     */
2615      public ComputableLanguageComponent(Type content) {
2616        super();
2617        this.content = content;
2618      }
2619
2620        /**
2621         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
2622         */
2623        public Type getContent() { 
2624          return this.content;
2625        }
2626
2627        /**
2628         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
2629         */
2630        public Attachment getContentAttachment() throws FHIRException { 
2631          if (!(this.content instanceof Attachment))
2632            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
2633          return (Attachment) this.content;
2634        }
2635
2636        public boolean hasContentAttachment() { 
2637          return this.content instanceof Attachment;
2638        }
2639
2640        /**
2641         * @return {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
2642         */
2643        public Reference getContentReference() throws FHIRException { 
2644          if (!(this.content instanceof Reference))
2645            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered");
2646          return (Reference) this.content;
2647        }
2648
2649        public boolean hasContentReference() { 
2650          return this.content instanceof Reference;
2651        }
2652
2653        public boolean hasContent() { 
2654          return this.content != null && !this.content.isEmpty();
2655        }
2656
2657        /**
2658         * @param value {@link #content} (Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).)
2659         */
2660        public ComputableLanguageComponent setContent(Type value) { 
2661          this.content = value;
2662          return this;
2663        }
2664
2665        protected void listChildren(List<Property> childrenList) {
2666          super.listChildren(childrenList);
2667          childrenList.add(new Property("content[x]", "Attachment|Reference(DocumentReference)", "Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).", 0, java.lang.Integer.MAX_VALUE, content));
2668        }
2669
2670      @Override
2671      public void setProperty(String name, Base value) throws FHIRException {
2672        if (name.equals("content[x]"))
2673          this.content = (Type) value; // Type
2674        else
2675          super.setProperty(name, value);
2676      }
2677
2678      @Override
2679      public Base addChild(String name) throws FHIRException {
2680        if (name.equals("contentAttachment")) {
2681          this.content = new Attachment();
2682          return this.content;
2683        }
2684        else if (name.equals("contentReference")) {
2685          this.content = new Reference();
2686          return this.content;
2687        }
2688        else
2689          return super.addChild(name);
2690      }
2691
2692      public ComputableLanguageComponent copy() {
2693        ComputableLanguageComponent dst = new ComputableLanguageComponent();
2694        copyValues(dst);
2695        dst.content = content == null ? null : content.copy();
2696        return dst;
2697      }
2698
2699      @Override
2700      public boolean equalsDeep(Base other) {
2701        if (!super.equalsDeep(other))
2702          return false;
2703        if (!(other instanceof ComputableLanguageComponent))
2704          return false;
2705        ComputableLanguageComponent o = (ComputableLanguageComponent) other;
2706        return compareDeep(content, o.content, true);
2707      }
2708
2709      @Override
2710      public boolean equalsShallow(Base other) {
2711        if (!super.equalsShallow(other))
2712          return false;
2713        if (!(other instanceof ComputableLanguageComponent))
2714          return false;
2715        ComputableLanguageComponent o = (ComputableLanguageComponent) other;
2716        return true;
2717      }
2718
2719      public boolean isEmpty() {
2720        return super.isEmpty() && (content == null || content.isEmpty());
2721      }
2722
2723  public String fhirType() {
2724    return "Contract.rule";
2725
2726  }
2727
2728  }
2729
2730    /**
2731     * Unique identifier for this Contract.
2732     */
2733    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
2734    @Description(shortDefinition="Contract identifier", formalDefinition="Unique identifier for this Contract." )
2735    protected Identifier identifier;
2736
2737    /**
2738     * When this  Contract was issued.
2739     */
2740    @Child(name = "issued", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
2741    @Description(shortDefinition="When this Contract was issued", formalDefinition="When this  Contract was issued." )
2742    protected DateTimeType issued;
2743
2744    /**
2745     * Relevant time or time-period when this Contract is applicable.
2746     */
2747    @Child(name = "applies", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
2748    @Description(shortDefinition="Effective time", formalDefinition="Relevant time or time-period when this Contract is applicable." )
2749    protected Period applies;
2750
2751    /**
2752     * Who and/or what this Contract is about: typically a Patient, Organization, or valued items such as goods and services.
2753     */
2754    @Child(name = "subject", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2755    @Description(shortDefinition="Subject of this Contract", formalDefinition="Who and/or what this Contract is about: typically a Patient, Organization, or valued items such as goods and services." )
2756    protected List<Reference> subject;
2757    /**
2758     * The actual objects that are the target of the reference (Who and/or what this Contract is about: typically a Patient, Organization, or valued items such as goods and services.)
2759     */
2760    protected List<Resource> subjectTarget;
2761
2762
2763    /**
2764     * A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.
2765     */
2766    @Child(name = "authority", type = {Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2767    @Description(shortDefinition="Authority under which this Contract has standing", formalDefinition="A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies." )
2768    protected List<Reference> authority;
2769    /**
2770     * The actual objects that are the target of the reference (A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.)
2771     */
2772    protected List<Organization> authorityTarget;
2773
2774
2775    /**
2776     * Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.
2777     */
2778    @Child(name = "domain", type = {Location.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2779    @Description(shortDefinition="Domain in which this Contract applies", formalDefinition="Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources." )
2780    protected List<Reference> domain;
2781    /**
2782     * The actual objects that are the target of the reference (Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.)
2783     */
2784    protected List<Location> domainTarget;
2785
2786
2787    /**
2788     * Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.
2789     */
2790    @Child(name = "type", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
2791    @Description(shortDefinition="Contract Tyoe", formalDefinition="Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc." )
2792    protected CodeableConcept type;
2793
2794    /**
2795     * More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.
2796     */
2797    @Child(name = "subType", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2798    @Description(shortDefinition="Contract Subtype", formalDefinition="More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent." )
2799    protected List<CodeableConcept> subType;
2800
2801    /**
2802     * Action stipulated by this Contract.
2803     */
2804    @Child(name = "action", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2805    @Description(shortDefinition="Contract Action", formalDefinition="Action stipulated by this Contract." )
2806    protected List<CodeableConcept> action;
2807
2808    /**
2809     * Reason for action stipulated by this Contract.
2810     */
2811    @Child(name = "actionReason", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2812    @Description(shortDefinition="Contract Action Reason", formalDefinition="Reason for action stipulated by this Contract." )
2813    protected List<CodeableConcept> actionReason;
2814
2815    /**
2816     * List of Contract actors.
2817     */
2818    @Child(name = "actor", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2819    @Description(shortDefinition="Contract Actor", formalDefinition="List of Contract actors." )
2820    protected List<ActorComponent> actor;
2821
2822    /**
2823     * Contract Valued Item List.
2824     */
2825    @Child(name = "valuedItem", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2826    @Description(shortDefinition="Contract Valued Item", formalDefinition="Contract Valued Item List." )
2827    protected List<ValuedItemComponent> valuedItem;
2828
2829    /**
2830     * Party signing this Contract.
2831     */
2832    @Child(name = "signer", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2833    @Description(shortDefinition="Contract Signer", formalDefinition="Party signing this Contract." )
2834    protected List<SignatoryComponent> signer;
2835
2836    /**
2837     * One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.
2838     */
2839    @Child(name = "term", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2840    @Description(shortDefinition="Contract Term List", formalDefinition="One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups." )
2841    protected List<TermComponent> term;
2842
2843    /**
2844     * Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.
2845     */
2846    @Child(name = "binding", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=14, min=0, max=1, modifier=false, summary=false)
2847    @Description(shortDefinition="Binding Contract", formalDefinition="Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract." )
2848    protected Type binding;
2849
2850    /**
2851     * The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.
2852     */
2853    @Child(name = "friendly", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2854    @Description(shortDefinition="Contract Friendly Language", formalDefinition="The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement." )
2855    protected List<FriendlyLanguageComponent> friendly;
2856
2857    /**
2858     * List of Legal expressions or representations of this Contract.
2859     */
2860    @Child(name = "legal", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2861    @Description(shortDefinition="Contract Legal Language", formalDefinition="List of Legal expressions or representations of this Contract." )
2862    protected List<LegalLanguageComponent> legal;
2863
2864    /**
2865     * List of Computable Policy Rule Language Representations of this Contract.
2866     */
2867    @Child(name = "rule", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2868    @Description(shortDefinition="Computable Contract Language", formalDefinition="List of Computable Policy Rule Language Representations of this Contract." )
2869    protected List<ComputableLanguageComponent> rule;
2870
2871    private static final long serialVersionUID = -1785608373L;
2872
2873  /*
2874   * Constructor
2875   */
2876    public Contract() {
2877      super();
2878    }
2879
2880    /**
2881     * @return {@link #identifier} (Unique identifier for this Contract.)
2882     */
2883    public Identifier getIdentifier() { 
2884      if (this.identifier == null)
2885        if (Configuration.errorOnAutoCreate())
2886          throw new Error("Attempt to auto-create Contract.identifier");
2887        else if (Configuration.doAutoCreate())
2888          this.identifier = new Identifier(); // cc
2889      return this.identifier;
2890    }
2891
2892    public boolean hasIdentifier() { 
2893      return this.identifier != null && !this.identifier.isEmpty();
2894    }
2895
2896    /**
2897     * @param value {@link #identifier} (Unique identifier for this Contract.)
2898     */
2899    public Contract setIdentifier(Identifier value) { 
2900      this.identifier = value;
2901      return this;
2902    }
2903
2904    /**
2905     * @return {@link #issued} (When this  Contract was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
2906     */
2907    public DateTimeType getIssuedElement() { 
2908      if (this.issued == null)
2909        if (Configuration.errorOnAutoCreate())
2910          throw new Error("Attempt to auto-create Contract.issued");
2911        else if (Configuration.doAutoCreate())
2912          this.issued = new DateTimeType(); // bb
2913      return this.issued;
2914    }
2915
2916    public boolean hasIssuedElement() { 
2917      return this.issued != null && !this.issued.isEmpty();
2918    }
2919
2920    public boolean hasIssued() { 
2921      return this.issued != null && !this.issued.isEmpty();
2922    }
2923
2924    /**
2925     * @param value {@link #issued} (When this  Contract was issued.). This is the underlying object with id, value and extensions. The accessor "getIssued" gives direct access to the value
2926     */
2927    public Contract setIssuedElement(DateTimeType value) { 
2928      this.issued = value;
2929      return this;
2930    }
2931
2932    /**
2933     * @return When this  Contract was issued.
2934     */
2935    public Date getIssued() { 
2936      return this.issued == null ? null : this.issued.getValue();
2937    }
2938
2939    /**
2940     * @param value When this  Contract was issued.
2941     */
2942    public Contract setIssued(Date value) { 
2943      if (value == null)
2944        this.issued = null;
2945      else {
2946        if (this.issued == null)
2947          this.issued = new DateTimeType();
2948        this.issued.setValue(value);
2949      }
2950      return this;
2951    }
2952
2953    /**
2954     * @return {@link #applies} (Relevant time or time-period when this Contract is applicable.)
2955     */
2956    public Period getApplies() { 
2957      if (this.applies == null)
2958        if (Configuration.errorOnAutoCreate())
2959          throw new Error("Attempt to auto-create Contract.applies");
2960        else if (Configuration.doAutoCreate())
2961          this.applies = new Period(); // cc
2962      return this.applies;
2963    }
2964
2965    public boolean hasApplies() { 
2966      return this.applies != null && !this.applies.isEmpty();
2967    }
2968
2969    /**
2970     * @param value {@link #applies} (Relevant time or time-period when this Contract is applicable.)
2971     */
2972    public Contract setApplies(Period value) { 
2973      this.applies = value;
2974      return this;
2975    }
2976
2977    /**
2978     * @return {@link #subject} (Who and/or what this Contract is about: typically a Patient, Organization, or valued items such as goods and services.)
2979     */
2980    public List<Reference> getSubject() { 
2981      if (this.subject == null)
2982        this.subject = new ArrayList<Reference>();
2983      return this.subject;
2984    }
2985
2986    public boolean hasSubject() { 
2987      if (this.subject == null)
2988        return false;
2989      for (Reference item : this.subject)
2990        if (!item.isEmpty())
2991          return true;
2992      return false;
2993    }
2994
2995    /**
2996     * @return {@link #subject} (Who and/or what this Contract is about: typically a Patient, Organization, or valued items such as goods and services.)
2997     */
2998    // syntactic sugar
2999    public Reference addSubject() { //3
3000      Reference t = new Reference();
3001      if (this.subject == null)
3002        this.subject = new ArrayList<Reference>();
3003      this.subject.add(t);
3004      return t;
3005    }
3006
3007    // syntactic sugar
3008    public Contract addSubject(Reference t) { //3
3009      if (t == null)
3010        return this;
3011      if (this.subject == null)
3012        this.subject = new ArrayList<Reference>();
3013      this.subject.add(t);
3014      return this;
3015    }
3016
3017    /**
3018     * @return {@link #subject} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Who and/or what this Contract is about: typically a Patient, Organization, or valued items such as goods and services.)
3019     */
3020    public List<Resource> getSubjectTarget() { 
3021      if (this.subjectTarget == null)
3022        this.subjectTarget = new ArrayList<Resource>();
3023      return this.subjectTarget;
3024    }
3025
3026    /**
3027     * @return {@link #authority} (A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.)
3028     */
3029    public List<Reference> getAuthority() { 
3030      if (this.authority == null)
3031        this.authority = new ArrayList<Reference>();
3032      return this.authority;
3033    }
3034
3035    public boolean hasAuthority() { 
3036      if (this.authority == null)
3037        return false;
3038      for (Reference item : this.authority)
3039        if (!item.isEmpty())
3040          return true;
3041      return false;
3042    }
3043
3044    /**
3045     * @return {@link #authority} (A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.)
3046     */
3047    // syntactic sugar
3048    public Reference addAuthority() { //3
3049      Reference t = new Reference();
3050      if (this.authority == null)
3051        this.authority = new ArrayList<Reference>();
3052      this.authority.add(t);
3053      return t;
3054    }
3055
3056    // syntactic sugar
3057    public Contract addAuthority(Reference t) { //3
3058      if (t == null)
3059        return this;
3060      if (this.authority == null)
3061        this.authority = new ArrayList<Reference>();
3062      this.authority.add(t);
3063      return this;
3064    }
3065
3066    /**
3067     * @return {@link #authority} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.)
3068     */
3069    public List<Organization> getAuthorityTarget() { 
3070      if (this.authorityTarget == null)
3071        this.authorityTarget = new ArrayList<Organization>();
3072      return this.authorityTarget;
3073    }
3074
3075    // syntactic sugar
3076    /**
3077     * @return {@link #authority} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.)
3078     */
3079    public Organization addAuthorityTarget() { 
3080      Organization r = new Organization();
3081      if (this.authorityTarget == null)
3082        this.authorityTarget = new ArrayList<Organization>();
3083      this.authorityTarget.add(r);
3084      return r;
3085    }
3086
3087    /**
3088     * @return {@link #domain} (Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.)
3089     */
3090    public List<Reference> getDomain() { 
3091      if (this.domain == null)
3092        this.domain = new ArrayList<Reference>();
3093      return this.domain;
3094    }
3095
3096    public boolean hasDomain() { 
3097      if (this.domain == null)
3098        return false;
3099      for (Reference item : this.domain)
3100        if (!item.isEmpty())
3101          return true;
3102      return false;
3103    }
3104
3105    /**
3106     * @return {@link #domain} (Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.)
3107     */
3108    // syntactic sugar
3109    public Reference addDomain() { //3
3110      Reference t = new Reference();
3111      if (this.domain == null)
3112        this.domain = new ArrayList<Reference>();
3113      this.domain.add(t);
3114      return t;
3115    }
3116
3117    // syntactic sugar
3118    public Contract addDomain(Reference t) { //3
3119      if (t == null)
3120        return this;
3121      if (this.domain == null)
3122        this.domain = new ArrayList<Reference>();
3123      this.domain.add(t);
3124      return this;
3125    }
3126
3127    /**
3128     * @return {@link #domain} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.)
3129     */
3130    public List<Location> getDomainTarget() { 
3131      if (this.domainTarget == null)
3132        this.domainTarget = new ArrayList<Location>();
3133      return this.domainTarget;
3134    }
3135
3136    // syntactic sugar
3137    /**
3138     * @return {@link #domain} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.)
3139     */
3140    public Location addDomainTarget() { 
3141      Location r = new Location();
3142      if (this.domainTarget == null)
3143        this.domainTarget = new ArrayList<Location>();
3144      this.domainTarget.add(r);
3145      return r;
3146    }
3147
3148    /**
3149     * @return {@link #type} (Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.)
3150     */
3151    public CodeableConcept getType() { 
3152      if (this.type == null)
3153        if (Configuration.errorOnAutoCreate())
3154          throw new Error("Attempt to auto-create Contract.type");
3155        else if (Configuration.doAutoCreate())
3156          this.type = new CodeableConcept(); // cc
3157      return this.type;
3158    }
3159
3160    public boolean hasType() { 
3161      return this.type != null && !this.type.isEmpty();
3162    }
3163
3164    /**
3165     * @param value {@link #type} (Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.)
3166     */
3167    public Contract setType(CodeableConcept value) { 
3168      this.type = value;
3169      return this;
3170    }
3171
3172    /**
3173     * @return {@link #subType} (More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.)
3174     */
3175    public List<CodeableConcept> getSubType() { 
3176      if (this.subType == null)
3177        this.subType = new ArrayList<CodeableConcept>();
3178      return this.subType;
3179    }
3180
3181    public boolean hasSubType() { 
3182      if (this.subType == null)
3183        return false;
3184      for (CodeableConcept item : this.subType)
3185        if (!item.isEmpty())
3186          return true;
3187      return false;
3188    }
3189
3190    /**
3191     * @return {@link #subType} (More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.)
3192     */
3193    // syntactic sugar
3194    public CodeableConcept addSubType() { //3
3195      CodeableConcept t = new CodeableConcept();
3196      if (this.subType == null)
3197        this.subType = new ArrayList<CodeableConcept>();
3198      this.subType.add(t);
3199      return t;
3200    }
3201
3202    // syntactic sugar
3203    public Contract addSubType(CodeableConcept t) { //3
3204      if (t == null)
3205        return this;
3206      if (this.subType == null)
3207        this.subType = new ArrayList<CodeableConcept>();
3208      this.subType.add(t);
3209      return this;
3210    }
3211
3212    /**
3213     * @return {@link #action} (Action stipulated by this Contract.)
3214     */
3215    public List<CodeableConcept> getAction() { 
3216      if (this.action == null)
3217        this.action = new ArrayList<CodeableConcept>();
3218      return this.action;
3219    }
3220
3221    public boolean hasAction() { 
3222      if (this.action == null)
3223        return false;
3224      for (CodeableConcept item : this.action)
3225        if (!item.isEmpty())
3226          return true;
3227      return false;
3228    }
3229
3230    /**
3231     * @return {@link #action} (Action stipulated by this Contract.)
3232     */
3233    // syntactic sugar
3234    public CodeableConcept addAction() { //3
3235      CodeableConcept t = new CodeableConcept();
3236      if (this.action == null)
3237        this.action = new ArrayList<CodeableConcept>();
3238      this.action.add(t);
3239      return t;
3240    }
3241
3242    // syntactic sugar
3243    public Contract addAction(CodeableConcept t) { //3
3244      if (t == null)
3245        return this;
3246      if (this.action == null)
3247        this.action = new ArrayList<CodeableConcept>();
3248      this.action.add(t);
3249      return this;
3250    }
3251
3252    /**
3253     * @return {@link #actionReason} (Reason for action stipulated by this Contract.)
3254     */
3255    public List<CodeableConcept> getActionReason() { 
3256      if (this.actionReason == null)
3257        this.actionReason = new ArrayList<CodeableConcept>();
3258      return this.actionReason;
3259    }
3260
3261    public boolean hasActionReason() { 
3262      if (this.actionReason == null)
3263        return false;
3264      for (CodeableConcept item : this.actionReason)
3265        if (!item.isEmpty())
3266          return true;
3267      return false;
3268    }
3269
3270    /**
3271     * @return {@link #actionReason} (Reason for action stipulated by this Contract.)
3272     */
3273    // syntactic sugar
3274    public CodeableConcept addActionReason() { //3
3275      CodeableConcept t = new CodeableConcept();
3276      if (this.actionReason == null)
3277        this.actionReason = new ArrayList<CodeableConcept>();
3278      this.actionReason.add(t);
3279      return t;
3280    }
3281
3282    // syntactic sugar
3283    public Contract addActionReason(CodeableConcept t) { //3
3284      if (t == null)
3285        return this;
3286      if (this.actionReason == null)
3287        this.actionReason = new ArrayList<CodeableConcept>();
3288      this.actionReason.add(t);
3289      return this;
3290    }
3291
3292    /**
3293     * @return {@link #actor} (List of Contract actors.)
3294     */
3295    public List<ActorComponent> getActor() { 
3296      if (this.actor == null)
3297        this.actor = new ArrayList<ActorComponent>();
3298      return this.actor;
3299    }
3300
3301    public boolean hasActor() { 
3302      if (this.actor == null)
3303        return false;
3304      for (ActorComponent item : this.actor)
3305        if (!item.isEmpty())
3306          return true;
3307      return false;
3308    }
3309
3310    /**
3311     * @return {@link #actor} (List of Contract actors.)
3312     */
3313    // syntactic sugar
3314    public ActorComponent addActor() { //3
3315      ActorComponent t = new ActorComponent();
3316      if (this.actor == null)
3317        this.actor = new ArrayList<ActorComponent>();
3318      this.actor.add(t);
3319      return t;
3320    }
3321
3322    // syntactic sugar
3323    public Contract addActor(ActorComponent t) { //3
3324      if (t == null)
3325        return this;
3326      if (this.actor == null)
3327        this.actor = new ArrayList<ActorComponent>();
3328      this.actor.add(t);
3329      return this;
3330    }
3331
3332    /**
3333     * @return {@link #valuedItem} (Contract Valued Item List.)
3334     */
3335    public List<ValuedItemComponent> getValuedItem() { 
3336      if (this.valuedItem == null)
3337        this.valuedItem = new ArrayList<ValuedItemComponent>();
3338      return this.valuedItem;
3339    }
3340
3341    public boolean hasValuedItem() { 
3342      if (this.valuedItem == null)
3343        return false;
3344      for (ValuedItemComponent item : this.valuedItem)
3345        if (!item.isEmpty())
3346          return true;
3347      return false;
3348    }
3349
3350    /**
3351     * @return {@link #valuedItem} (Contract Valued Item List.)
3352     */
3353    // syntactic sugar
3354    public ValuedItemComponent addValuedItem() { //3
3355      ValuedItemComponent t = new ValuedItemComponent();
3356      if (this.valuedItem == null)
3357        this.valuedItem = new ArrayList<ValuedItemComponent>();
3358      this.valuedItem.add(t);
3359      return t;
3360    }
3361
3362    // syntactic sugar
3363    public Contract addValuedItem(ValuedItemComponent t) { //3
3364      if (t == null)
3365        return this;
3366      if (this.valuedItem == null)
3367        this.valuedItem = new ArrayList<ValuedItemComponent>();
3368      this.valuedItem.add(t);
3369      return this;
3370    }
3371
3372    /**
3373     * @return {@link #signer} (Party signing this Contract.)
3374     */
3375    public List<SignatoryComponent> getSigner() { 
3376      if (this.signer == null)
3377        this.signer = new ArrayList<SignatoryComponent>();
3378      return this.signer;
3379    }
3380
3381    public boolean hasSigner() { 
3382      if (this.signer == null)
3383        return false;
3384      for (SignatoryComponent item : this.signer)
3385        if (!item.isEmpty())
3386          return true;
3387      return false;
3388    }
3389
3390    /**
3391     * @return {@link #signer} (Party signing this Contract.)
3392     */
3393    // syntactic sugar
3394    public SignatoryComponent addSigner() { //3
3395      SignatoryComponent t = new SignatoryComponent();
3396      if (this.signer == null)
3397        this.signer = new ArrayList<SignatoryComponent>();
3398      this.signer.add(t);
3399      return t;
3400    }
3401
3402    // syntactic sugar
3403    public Contract addSigner(SignatoryComponent t) { //3
3404      if (t == null)
3405        return this;
3406      if (this.signer == null)
3407        this.signer = new ArrayList<SignatoryComponent>();
3408      this.signer.add(t);
3409      return this;
3410    }
3411
3412    /**
3413     * @return {@link #term} (One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.)
3414     */
3415    public List<TermComponent> getTerm() { 
3416      if (this.term == null)
3417        this.term = new ArrayList<TermComponent>();
3418      return this.term;
3419    }
3420
3421    public boolean hasTerm() { 
3422      if (this.term == null)
3423        return false;
3424      for (TermComponent item : this.term)
3425        if (!item.isEmpty())
3426          return true;
3427      return false;
3428    }
3429
3430    /**
3431     * @return {@link #term} (One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.)
3432     */
3433    // syntactic sugar
3434    public TermComponent addTerm() { //3
3435      TermComponent t = new TermComponent();
3436      if (this.term == null)
3437        this.term = new ArrayList<TermComponent>();
3438      this.term.add(t);
3439      return t;
3440    }
3441
3442    // syntactic sugar
3443    public Contract addTerm(TermComponent t) { //3
3444      if (t == null)
3445        return this;
3446      if (this.term == null)
3447        this.term = new ArrayList<TermComponent>();
3448      this.term.add(t);
3449      return this;
3450    }
3451
3452    /**
3453     * @return {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
3454     */
3455    public Type getBinding() { 
3456      return this.binding;
3457    }
3458
3459    /**
3460     * @return {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
3461     */
3462    public Attachment getBindingAttachment() throws FHIRException { 
3463      if (!(this.binding instanceof Attachment))
3464        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.binding.getClass().getName()+" was encountered");
3465      return (Attachment) this.binding;
3466    }
3467
3468    public boolean hasBindingAttachment() { 
3469      return this.binding instanceof Attachment;
3470    }
3471
3472    /**
3473     * @return {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
3474     */
3475    public Reference getBindingReference() throws FHIRException { 
3476      if (!(this.binding instanceof Reference))
3477        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.binding.getClass().getName()+" was encountered");
3478      return (Reference) this.binding;
3479    }
3480
3481    public boolean hasBindingReference() { 
3482      return this.binding instanceof Reference;
3483    }
3484
3485    public boolean hasBinding() { 
3486      return this.binding != null && !this.binding.isEmpty();
3487    }
3488
3489    /**
3490     * @param value {@link #binding} (Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.)
3491     */
3492    public Contract setBinding(Type value) { 
3493      this.binding = value;
3494      return this;
3495    }
3496
3497    /**
3498     * @return {@link #friendly} (The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.)
3499     */
3500    public List<FriendlyLanguageComponent> getFriendly() { 
3501      if (this.friendly == null)
3502        this.friendly = new ArrayList<FriendlyLanguageComponent>();
3503      return this.friendly;
3504    }
3505
3506    public boolean hasFriendly() { 
3507      if (this.friendly == null)
3508        return false;
3509      for (FriendlyLanguageComponent item : this.friendly)
3510        if (!item.isEmpty())
3511          return true;
3512      return false;
3513    }
3514
3515    /**
3516     * @return {@link #friendly} (The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.)
3517     */
3518    // syntactic sugar
3519    public FriendlyLanguageComponent addFriendly() { //3
3520      FriendlyLanguageComponent t = new FriendlyLanguageComponent();
3521      if (this.friendly == null)
3522        this.friendly = new ArrayList<FriendlyLanguageComponent>();
3523      this.friendly.add(t);
3524      return t;
3525    }
3526
3527    // syntactic sugar
3528    public Contract addFriendly(FriendlyLanguageComponent t) { //3
3529      if (t == null)
3530        return this;
3531      if (this.friendly == null)
3532        this.friendly = new ArrayList<FriendlyLanguageComponent>();
3533      this.friendly.add(t);
3534      return this;
3535    }
3536
3537    /**
3538     * @return {@link #legal} (List of Legal expressions or representations of this Contract.)
3539     */
3540    public List<LegalLanguageComponent> getLegal() { 
3541      if (this.legal == null)
3542        this.legal = new ArrayList<LegalLanguageComponent>();
3543      return this.legal;
3544    }
3545
3546    public boolean hasLegal() { 
3547      if (this.legal == null)
3548        return false;
3549      for (LegalLanguageComponent item : this.legal)
3550        if (!item.isEmpty())
3551          return true;
3552      return false;
3553    }
3554
3555    /**
3556     * @return {@link #legal} (List of Legal expressions or representations of this Contract.)
3557     */
3558    // syntactic sugar
3559    public LegalLanguageComponent addLegal() { //3
3560      LegalLanguageComponent t = new LegalLanguageComponent();
3561      if (this.legal == null)
3562        this.legal = new ArrayList<LegalLanguageComponent>();
3563      this.legal.add(t);
3564      return t;
3565    }
3566
3567    // syntactic sugar
3568    public Contract addLegal(LegalLanguageComponent t) { //3
3569      if (t == null)
3570        return this;
3571      if (this.legal == null)
3572        this.legal = new ArrayList<LegalLanguageComponent>();
3573      this.legal.add(t);
3574      return this;
3575    }
3576
3577    /**
3578     * @return {@link #rule} (List of Computable Policy Rule Language Representations of this Contract.)
3579     */
3580    public List<ComputableLanguageComponent> getRule() { 
3581      if (this.rule == null)
3582        this.rule = new ArrayList<ComputableLanguageComponent>();
3583      return this.rule;
3584    }
3585
3586    public boolean hasRule() { 
3587      if (this.rule == null)
3588        return false;
3589      for (ComputableLanguageComponent item : this.rule)
3590        if (!item.isEmpty())
3591          return true;
3592      return false;
3593    }
3594
3595    /**
3596     * @return {@link #rule} (List of Computable Policy Rule Language Representations of this Contract.)
3597     */
3598    // syntactic sugar
3599    public ComputableLanguageComponent addRule() { //3
3600      ComputableLanguageComponent t = new ComputableLanguageComponent();
3601      if (this.rule == null)
3602        this.rule = new ArrayList<ComputableLanguageComponent>();
3603      this.rule.add(t);
3604      return t;
3605    }
3606
3607    // syntactic sugar
3608    public Contract addRule(ComputableLanguageComponent t) { //3
3609      if (t == null)
3610        return this;
3611      if (this.rule == null)
3612        this.rule = new ArrayList<ComputableLanguageComponent>();
3613      this.rule.add(t);
3614      return this;
3615    }
3616
3617      protected void listChildren(List<Property> childrenList) {
3618        super.listChildren(childrenList);
3619        childrenList.add(new Property("identifier", "Identifier", "Unique identifier for this Contract.", 0, java.lang.Integer.MAX_VALUE, identifier));
3620        childrenList.add(new Property("issued", "dateTime", "When this  Contract was issued.", 0, java.lang.Integer.MAX_VALUE, issued));
3621        childrenList.add(new Property("applies", "Period", "Relevant time or time-period when this Contract is applicable.", 0, java.lang.Integer.MAX_VALUE, applies));
3622        childrenList.add(new Property("subject", "Reference(Any)", "Who and/or what this Contract is about: typically a Patient, Organization, or valued items such as goods and services.", 0, java.lang.Integer.MAX_VALUE, subject));
3623        childrenList.add(new Property("authority", "Reference(Organization)", "A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.", 0, java.lang.Integer.MAX_VALUE, authority));
3624        childrenList.add(new Property("domain", "Reference(Location)", "Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.", 0, java.lang.Integer.MAX_VALUE, domain));
3625        childrenList.add(new Property("type", "CodeableConcept", "Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.", 0, java.lang.Integer.MAX_VALUE, type));
3626        childrenList.add(new Property("subType", "CodeableConcept", "More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.", 0, java.lang.Integer.MAX_VALUE, subType));
3627        childrenList.add(new Property("action", "CodeableConcept", "Action stipulated by this Contract.", 0, java.lang.Integer.MAX_VALUE, action));
3628        childrenList.add(new Property("actionReason", "CodeableConcept", "Reason for action stipulated by this Contract.", 0, java.lang.Integer.MAX_VALUE, actionReason));
3629        childrenList.add(new Property("actor", "", "List of Contract actors.", 0, java.lang.Integer.MAX_VALUE, actor));
3630        childrenList.add(new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
3631        childrenList.add(new Property("signer", "", "Party signing this Contract.", 0, java.lang.Integer.MAX_VALUE, signer));
3632        childrenList.add(new Property("term", "", "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.", 0, java.lang.Integer.MAX_VALUE, term));
3633        childrenList.add(new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the \"source of truth\" and which would be the basis for legal action related to enforcement of this Contract.", 0, java.lang.Integer.MAX_VALUE, binding));
3634        childrenList.add(new Property("friendly", "", "The \"patient friendly language\" versionof the Contract in whole or in parts. \"Patient friendly language\" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.", 0, java.lang.Integer.MAX_VALUE, friendly));
3635        childrenList.add(new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal));
3636        childrenList.add(new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule));
3637      }
3638
3639      @Override
3640      public void setProperty(String name, Base value) throws FHIRException {
3641        if (name.equals("identifier"))
3642          this.identifier = castToIdentifier(value); // Identifier
3643        else if (name.equals("issued"))
3644          this.issued = castToDateTime(value); // DateTimeType
3645        else if (name.equals("applies"))
3646          this.applies = castToPeriod(value); // Period
3647        else if (name.equals("subject"))
3648          this.getSubject().add(castToReference(value));
3649        else if (name.equals("authority"))
3650          this.getAuthority().add(castToReference(value));
3651        else if (name.equals("domain"))
3652          this.getDomain().add(castToReference(value));
3653        else if (name.equals("type"))
3654          this.type = castToCodeableConcept(value); // CodeableConcept
3655        else if (name.equals("subType"))
3656          this.getSubType().add(castToCodeableConcept(value));
3657        else if (name.equals("action"))
3658          this.getAction().add(castToCodeableConcept(value));
3659        else if (name.equals("actionReason"))
3660          this.getActionReason().add(castToCodeableConcept(value));
3661        else if (name.equals("actor"))
3662          this.getActor().add((ActorComponent) value);
3663        else if (name.equals("valuedItem"))
3664          this.getValuedItem().add((ValuedItemComponent) value);
3665        else if (name.equals("signer"))
3666          this.getSigner().add((SignatoryComponent) value);
3667        else if (name.equals("term"))
3668          this.getTerm().add((TermComponent) value);
3669        else if (name.equals("binding[x]"))
3670          this.binding = (Type) value; // Type
3671        else if (name.equals("friendly"))
3672          this.getFriendly().add((FriendlyLanguageComponent) value);
3673        else if (name.equals("legal"))
3674          this.getLegal().add((LegalLanguageComponent) value);
3675        else if (name.equals("rule"))
3676          this.getRule().add((ComputableLanguageComponent) value);
3677        else
3678          super.setProperty(name, value);
3679      }
3680
3681      @Override
3682      public Base addChild(String name) throws FHIRException {
3683        if (name.equals("identifier")) {
3684          this.identifier = new Identifier();
3685          return this.identifier;
3686        }
3687        else if (name.equals("issued")) {
3688          throw new FHIRException("Cannot call addChild on a primitive type Contract.issued");
3689        }
3690        else if (name.equals("applies")) {
3691          this.applies = new Period();
3692          return this.applies;
3693        }
3694        else if (name.equals("subject")) {
3695          return addSubject();
3696        }
3697        else if (name.equals("authority")) {
3698          return addAuthority();
3699        }
3700        else if (name.equals("domain")) {
3701          return addDomain();
3702        }
3703        else if (name.equals("type")) {
3704          this.type = new CodeableConcept();
3705          return this.type;
3706        }
3707        else if (name.equals("subType")) {
3708          return addSubType();
3709        }
3710        else if (name.equals("action")) {
3711          return addAction();
3712        }
3713        else if (name.equals("actionReason")) {
3714          return addActionReason();
3715        }
3716        else if (name.equals("actor")) {
3717          return addActor();
3718        }
3719        else if (name.equals("valuedItem")) {
3720          return addValuedItem();
3721        }
3722        else if (name.equals("signer")) {
3723          return addSigner();
3724        }
3725        else if (name.equals("term")) {
3726          return addTerm();
3727        }
3728        else if (name.equals("bindingAttachment")) {
3729          this.binding = new Attachment();
3730          return this.binding;
3731        }
3732        else if (name.equals("bindingReference")) {
3733          this.binding = new Reference();
3734          return this.binding;
3735        }
3736        else if (name.equals("friendly")) {
3737          return addFriendly();
3738        }
3739        else if (name.equals("legal")) {
3740          return addLegal();
3741        }
3742        else if (name.equals("rule")) {
3743          return addRule();
3744        }
3745        else
3746          return super.addChild(name);
3747      }
3748
3749  public String fhirType() {
3750    return "Contract";
3751
3752  }
3753
3754      public Contract copy() {
3755        Contract dst = new Contract();
3756        copyValues(dst);
3757        dst.identifier = identifier == null ? null : identifier.copy();
3758        dst.issued = issued == null ? null : issued.copy();
3759        dst.applies = applies == null ? null : applies.copy();
3760        if (subject != null) {
3761          dst.subject = new ArrayList<Reference>();
3762          for (Reference i : subject)
3763            dst.subject.add(i.copy());
3764        };
3765        if (authority != null) {
3766          dst.authority = new ArrayList<Reference>();
3767          for (Reference i : authority)
3768            dst.authority.add(i.copy());
3769        };
3770        if (domain != null) {
3771          dst.domain = new ArrayList<Reference>();
3772          for (Reference i : domain)
3773            dst.domain.add(i.copy());
3774        };
3775        dst.type = type == null ? null : type.copy();
3776        if (subType != null) {
3777          dst.subType = new ArrayList<CodeableConcept>();
3778          for (CodeableConcept i : subType)
3779            dst.subType.add(i.copy());
3780        };
3781        if (action != null) {
3782          dst.action = new ArrayList<CodeableConcept>();
3783          for (CodeableConcept i : action)
3784            dst.action.add(i.copy());
3785        };
3786        if (actionReason != null) {
3787          dst.actionReason = new ArrayList<CodeableConcept>();
3788          for (CodeableConcept i : actionReason)
3789            dst.actionReason.add(i.copy());
3790        };
3791        if (actor != null) {
3792          dst.actor = new ArrayList<ActorComponent>();
3793          for (ActorComponent i : actor)
3794            dst.actor.add(i.copy());
3795        };
3796        if (valuedItem != null) {
3797          dst.valuedItem = new ArrayList<ValuedItemComponent>();
3798          for (ValuedItemComponent i : valuedItem)
3799            dst.valuedItem.add(i.copy());
3800        };
3801        if (signer != null) {
3802          dst.signer = new ArrayList<SignatoryComponent>();
3803          for (SignatoryComponent i : signer)
3804            dst.signer.add(i.copy());
3805        };
3806        if (term != null) {
3807          dst.term = new ArrayList<TermComponent>();
3808          for (TermComponent i : term)
3809            dst.term.add(i.copy());
3810        };
3811        dst.binding = binding == null ? null : binding.copy();
3812        if (friendly != null) {
3813          dst.friendly = new ArrayList<FriendlyLanguageComponent>();
3814          for (FriendlyLanguageComponent i : friendly)
3815            dst.friendly.add(i.copy());
3816        };
3817        if (legal != null) {
3818          dst.legal = new ArrayList<LegalLanguageComponent>();
3819          for (LegalLanguageComponent i : legal)
3820            dst.legal.add(i.copy());
3821        };
3822        if (rule != null) {
3823          dst.rule = new ArrayList<ComputableLanguageComponent>();
3824          for (ComputableLanguageComponent i : rule)
3825            dst.rule.add(i.copy());
3826        };
3827        return dst;
3828      }
3829
3830      protected Contract typedCopy() {
3831        return copy();
3832      }
3833
3834      @Override
3835      public boolean equalsDeep(Base other) {
3836        if (!super.equalsDeep(other))
3837          return false;
3838        if (!(other instanceof Contract))
3839          return false;
3840        Contract o = (Contract) other;
3841        return compareDeep(identifier, o.identifier, true) && compareDeep(issued, o.issued, true) && compareDeep(applies, o.applies, true)
3842           && compareDeep(subject, o.subject, true) && compareDeep(authority, o.authority, true) && compareDeep(domain, o.domain, true)
3843           && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(action, o.action, true)
3844           && compareDeep(actionReason, o.actionReason, true) && compareDeep(actor, o.actor, true) && compareDeep(valuedItem, o.valuedItem, true)
3845           && compareDeep(signer, o.signer, true) && compareDeep(term, o.term, true) && compareDeep(binding, o.binding, true)
3846           && compareDeep(friendly, o.friendly, true) && compareDeep(legal, o.legal, true) && compareDeep(rule, o.rule, true)
3847          ;
3848      }
3849
3850      @Override
3851      public boolean equalsShallow(Base other) {
3852        if (!super.equalsShallow(other))
3853          return false;
3854        if (!(other instanceof Contract))
3855          return false;
3856        Contract o = (Contract) other;
3857        return compareValues(issued, o.issued, true);
3858      }
3859
3860      public boolean isEmpty() {
3861        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (issued == null || issued.isEmpty())
3862           && (applies == null || applies.isEmpty()) && (subject == null || subject.isEmpty()) && (authority == null || authority.isEmpty())
3863           && (domain == null || domain.isEmpty()) && (type == null || type.isEmpty()) && (subType == null || subType.isEmpty())
3864           && (action == null || action.isEmpty()) && (actionReason == null || actionReason.isEmpty())
3865           && (actor == null || actor.isEmpty()) && (valuedItem == null || valuedItem.isEmpty()) && (signer == null || signer.isEmpty())
3866           && (term == null || term.isEmpty()) && (binding == null || binding.isEmpty()) && (friendly == null || friendly.isEmpty())
3867           && (legal == null || legal.isEmpty()) && (rule == null || rule.isEmpty());
3868      }
3869
3870  @Override
3871  public ResourceType getResourceType() {
3872    return ResourceType.Contract;
3873   }
3874
3875  @SearchParamDefinition(name="actor", path="Contract.actor.entity", description="Contract Actor Type", type="reference" )
3876  public static final String SP_ACTOR = "actor";
3877  @SearchParamDefinition(name="identifier", path="Contract.identifier", description="The identity of the contract", type="token" )
3878  public static final String SP_IDENTIFIER = "identifier";
3879  @SearchParamDefinition(name="subject", path="Contract.subject", description="The identity of the target of the contract", type="reference" )
3880  public static final String SP_SUBJECT = "subject";
3881  @SearchParamDefinition(name="patient", path="Contract.subject", description="The identity of the target of the contract (if a patient)", type="reference" )
3882  public static final String SP_PATIENT = "patient";
3883  @SearchParamDefinition(name="signer", path="Contract.signer.party", description="Contract Signatory Party", type="reference" )
3884  public static final String SP_SIGNER = "signer";
3885
3886}
3887