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