001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 13, 2022 17:53+1100 for FHIR vcurrent
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A record of a healthcare consumer’s  choices  or choices made on their behalf by a third party, which permits or denies identified recipient(s) or recipient role(s) to perform one or more actions within a given policy context, for specific purposes and periods of time.
052 */
053@ResourceDef(name="Consent", profile="http://hl7.org/fhir/StructureDefinition/Consent")
054public class Consent extends DomainResource {
055
056    public enum ConsentState {
057        /**
058         * The consent is in development or awaiting use but is not yet intended to be acted upon.
059         */
060        DRAFT, 
061        /**
062         * The consent is to be followed and enforced.
063         */
064        ACTIVE, 
065        /**
066         * The consent is terminated or replaced.
067         */
068        INACTIVE, 
069        /**
070         * The consent development has been terminated prior to completion.
071         */
072        NOTDONE, 
073        /**
074         * The consent was created wrongly (e.g. wrong patient) and should be ignored.
075         */
076        ENTEREDINERROR, 
077        /**
078         * The resource is in an indeterminate state.
079         */
080        UNKNOWN, 
081        /**
082         * added to help the parsers with the generic types
083         */
084        NULL;
085        public static ConsentState fromCode(String codeString) throws FHIRException {
086            if (codeString == null || "".equals(codeString))
087                return null;
088        if ("draft".equals(codeString))
089          return DRAFT;
090        if ("active".equals(codeString))
091          return ACTIVE;
092        if ("inactive".equals(codeString))
093          return INACTIVE;
094        if ("not-done".equals(codeString))
095          return NOTDONE;
096        if ("entered-in-error".equals(codeString))
097          return ENTEREDINERROR;
098        if ("unknown".equals(codeString))
099          return UNKNOWN;
100        if (Configuration.isAcceptInvalidEnums())
101          return null;
102        else
103          throw new FHIRException("Unknown ConsentState code '"+codeString+"'");
104        }
105        public String toCode() {
106          switch (this) {
107            case DRAFT: return "draft";
108            case ACTIVE: return "active";
109            case INACTIVE: return "inactive";
110            case NOTDONE: return "not-done";
111            case ENTEREDINERROR: return "entered-in-error";
112            case UNKNOWN: return "unknown";
113            case NULL: return null;
114            default: return "?";
115          }
116        }
117        public String getSystem() {
118          switch (this) {
119            case DRAFT: return "http://hl7.org/fhir/consent-state-codes";
120            case ACTIVE: return "http://hl7.org/fhir/consent-state-codes";
121            case INACTIVE: return "http://hl7.org/fhir/consent-state-codes";
122            case NOTDONE: return "http://hl7.org/fhir/consent-state-codes";
123            case ENTEREDINERROR: return "http://hl7.org/fhir/consent-state-codes";
124            case UNKNOWN: return "http://hl7.org/fhir/consent-state-codes";
125            case NULL: return null;
126            default: return "?";
127          }
128        }
129        public String getDefinition() {
130          switch (this) {
131            case DRAFT: return "The consent is in development or awaiting use but is not yet intended to be acted upon.";
132            case ACTIVE: return "The consent is to be followed and enforced.";
133            case INACTIVE: return "The consent is terminated or replaced.";
134            case NOTDONE: return "The consent development has been terminated prior to completion.";
135            case ENTEREDINERROR: return "The consent was created wrongly (e.g. wrong patient) and should be ignored.";
136            case UNKNOWN: return "The resource is in an indeterminate state.";
137            case NULL: return null;
138            default: return "?";
139          }
140        }
141        public String getDisplay() {
142          switch (this) {
143            case DRAFT: return "Pending";
144            case ACTIVE: return "Active";
145            case INACTIVE: return "Inactive";
146            case NOTDONE: return "Abandoned";
147            case ENTEREDINERROR: return "Entered in Error";
148            case UNKNOWN: return "Unknown";
149            case NULL: return null;
150            default: return "?";
151          }
152        }
153    }
154
155  public static class ConsentStateEnumFactory implements EnumFactory<ConsentState> {
156    public ConsentState fromCode(String codeString) throws IllegalArgumentException {
157      if (codeString == null || "".equals(codeString))
158            if (codeString == null || "".equals(codeString))
159                return null;
160        if ("draft".equals(codeString))
161          return ConsentState.DRAFT;
162        if ("active".equals(codeString))
163          return ConsentState.ACTIVE;
164        if ("inactive".equals(codeString))
165          return ConsentState.INACTIVE;
166        if ("not-done".equals(codeString))
167          return ConsentState.NOTDONE;
168        if ("entered-in-error".equals(codeString))
169          return ConsentState.ENTEREDINERROR;
170        if ("unknown".equals(codeString))
171          return ConsentState.UNKNOWN;
172        throw new IllegalArgumentException("Unknown ConsentState code '"+codeString+"'");
173        }
174        public Enumeration<ConsentState> fromType(PrimitiveType<?> code) throws FHIRException {
175          if (code == null)
176            return null;
177          if (code.isEmpty())
178            return new Enumeration<ConsentState>(this, ConsentState.NULL, code);
179          String codeString = ((PrimitiveType) code).asStringValue();
180          if (codeString == null || "".equals(codeString))
181            return new Enumeration<ConsentState>(this, ConsentState.NULL, code);
182        if ("draft".equals(codeString))
183          return new Enumeration<ConsentState>(this, ConsentState.DRAFT, code);
184        if ("active".equals(codeString))
185          return new Enumeration<ConsentState>(this, ConsentState.ACTIVE, code);
186        if ("inactive".equals(codeString))
187          return new Enumeration<ConsentState>(this, ConsentState.INACTIVE, code);
188        if ("not-done".equals(codeString))
189          return new Enumeration<ConsentState>(this, ConsentState.NOTDONE, code);
190        if ("entered-in-error".equals(codeString))
191          return new Enumeration<ConsentState>(this, ConsentState.ENTEREDINERROR, code);
192        if ("unknown".equals(codeString))
193          return new Enumeration<ConsentState>(this, ConsentState.UNKNOWN, code);
194        throw new FHIRException("Unknown ConsentState code '"+codeString+"'");
195        }
196    public String toCode(ConsentState code) {
197      if (code == ConsentState.DRAFT)
198        return "draft";
199      if (code == ConsentState.ACTIVE)
200        return "active";
201      if (code == ConsentState.INACTIVE)
202        return "inactive";
203      if (code == ConsentState.NOTDONE)
204        return "not-done";
205      if (code == ConsentState.ENTEREDINERROR)
206        return "entered-in-error";
207      if (code == ConsentState.UNKNOWN)
208        return "unknown";
209      return "?";
210      }
211    public String toSystem(ConsentState code) {
212      return code.getSystem();
213      }
214    }
215
216    @Block()
217    public static class ConsentPolicyBasisComponent extends BackboneElement implements IBaseBackboneElement {
218        /**
219         * A Reference that identifies the policy the organization will enforce for this Consent.
220         */
221        @Child(name = "reference", type = {Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
222        @Description(shortDefinition="Reference backing policy resource", formalDefinition="A Reference that identifies the policy the organization will enforce for this Consent." )
223        protected Reference reference;
224
225        /**
226         * A URL that links to a computable version of the policy the organization will enforce for this Consent.
227         */
228        @Child(name = "url", type = {UrlType.class}, order=2, min=0, max=1, modifier=false, summary=false)
229        @Description(shortDefinition="URL to a computable backing policy", formalDefinition="A URL that links to a computable version of the policy the organization will enforce for this Consent." )
230        protected UrlType url;
231
232        private static final long serialVersionUID = 252506182L;
233
234    /**
235     * Constructor
236     */
237      public ConsentPolicyBasisComponent() {
238        super();
239      }
240
241        /**
242         * @return {@link #reference} (A Reference that identifies the policy the organization will enforce for this Consent.)
243         */
244        public Reference getReference() { 
245          if (this.reference == null)
246            if (Configuration.errorOnAutoCreate())
247              throw new Error("Attempt to auto-create ConsentPolicyBasisComponent.reference");
248            else if (Configuration.doAutoCreate())
249              this.reference = new Reference(); // cc
250          return this.reference;
251        }
252
253        public boolean hasReference() { 
254          return this.reference != null && !this.reference.isEmpty();
255        }
256
257        /**
258         * @param value {@link #reference} (A Reference that identifies the policy the organization will enforce for this Consent.)
259         */
260        public ConsentPolicyBasisComponent setReference(Reference value) { 
261          this.reference = value;
262          return this;
263        }
264
265        /**
266         * @return {@link #url} (A URL that links to a computable version of the policy the organization will enforce for this Consent.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
267         */
268        public UrlType getUrlElement() { 
269          if (this.url == null)
270            if (Configuration.errorOnAutoCreate())
271              throw new Error("Attempt to auto-create ConsentPolicyBasisComponent.url");
272            else if (Configuration.doAutoCreate())
273              this.url = new UrlType(); // bb
274          return this.url;
275        }
276
277        public boolean hasUrlElement() { 
278          return this.url != null && !this.url.isEmpty();
279        }
280
281        public boolean hasUrl() { 
282          return this.url != null && !this.url.isEmpty();
283        }
284
285        /**
286         * @param value {@link #url} (A URL that links to a computable version of the policy the organization will enforce for this Consent.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
287         */
288        public ConsentPolicyBasisComponent setUrlElement(UrlType value) { 
289          this.url = value;
290          return this;
291        }
292
293        /**
294         * @return A URL that links to a computable version of the policy the organization will enforce for this Consent.
295         */
296        public String getUrl() { 
297          return this.url == null ? null : this.url.getValue();
298        }
299
300        /**
301         * @param value A URL that links to a computable version of the policy the organization will enforce for this Consent.
302         */
303        public ConsentPolicyBasisComponent setUrl(String value) { 
304          if (Utilities.noString(value))
305            this.url = null;
306          else {
307            if (this.url == null)
308              this.url = new UrlType();
309            this.url.setValue(value);
310          }
311          return this;
312        }
313
314        protected void listChildren(List<Property> children) {
315          super.listChildren(children);
316          children.add(new Property("reference", "Reference(Any)", "A Reference that identifies the policy the organization will enforce for this Consent.", 0, 1, reference));
317          children.add(new Property("url", "url", "A URL that links to a computable version of the policy the organization will enforce for this Consent.", 0, 1, url));
318        }
319
320        @Override
321        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
322          switch (_hash) {
323          case -925155509: /*reference*/  return new Property("reference", "Reference(Any)", "A Reference that identifies the policy the organization will enforce for this Consent.", 0, 1, reference);
324          case 116079: /*url*/  return new Property("url", "url", "A URL that links to a computable version of the policy the organization will enforce for this Consent.", 0, 1, url);
325          default: return super.getNamedProperty(_hash, _name, _checkValid);
326          }
327
328        }
329
330      @Override
331      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
332        switch (hash) {
333        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
334        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UrlType
335        default: return super.getProperty(hash, name, checkValid);
336        }
337
338      }
339
340      @Override
341      public Base setProperty(int hash, String name, Base value) throws FHIRException {
342        switch (hash) {
343        case -925155509: // reference
344          this.reference = TypeConvertor.castToReference(value); // Reference
345          return value;
346        case 116079: // url
347          this.url = TypeConvertor.castToUrl(value); // UrlType
348          return value;
349        default: return super.setProperty(hash, name, value);
350        }
351
352      }
353
354      @Override
355      public Base setProperty(String name, Base value) throws FHIRException {
356        if (name.equals("reference")) {
357          this.reference = TypeConvertor.castToReference(value); // Reference
358        } else if (name.equals("url")) {
359          this.url = TypeConvertor.castToUrl(value); // UrlType
360        } else
361          return super.setProperty(name, value);
362        return value;
363      }
364
365      @Override
366      public Base makeProperty(int hash, String name) throws FHIRException {
367        switch (hash) {
368        case -925155509:  return getReference();
369        case 116079:  return getUrlElement();
370        default: return super.makeProperty(hash, name);
371        }
372
373      }
374
375      @Override
376      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
377        switch (hash) {
378        case -925155509: /*reference*/ return new String[] {"Reference"};
379        case 116079: /*url*/ return new String[] {"url"};
380        default: return super.getTypesForProperty(hash, name);
381        }
382
383      }
384
385      @Override
386      public Base addChild(String name) throws FHIRException {
387        if (name.equals("reference")) {
388          this.reference = new Reference();
389          return this.reference;
390        }
391        else if (name.equals("url")) {
392          throw new FHIRException("Cannot call addChild on a primitive type Consent.policyBasis.url");
393        }
394        else
395          return super.addChild(name);
396      }
397
398      public ConsentPolicyBasisComponent copy() {
399        ConsentPolicyBasisComponent dst = new ConsentPolicyBasisComponent();
400        copyValues(dst);
401        return dst;
402      }
403
404      public void copyValues(ConsentPolicyBasisComponent dst) {
405        super.copyValues(dst);
406        dst.reference = reference == null ? null : reference.copy();
407        dst.url = url == null ? null : url.copy();
408      }
409
410      @Override
411      public boolean equalsDeep(Base other_) {
412        if (!super.equalsDeep(other_))
413          return false;
414        if (!(other_ instanceof ConsentPolicyBasisComponent))
415          return false;
416        ConsentPolicyBasisComponent o = (ConsentPolicyBasisComponent) other_;
417        return compareDeep(reference, o.reference, true) && compareDeep(url, o.url, true);
418      }
419
420      @Override
421      public boolean equalsShallow(Base other_) {
422        if (!super.equalsShallow(other_))
423          return false;
424        if (!(other_ instanceof ConsentPolicyBasisComponent))
425          return false;
426        ConsentPolicyBasisComponent o = (ConsentPolicyBasisComponent) other_;
427        return compareValues(url, o.url, true);
428      }
429
430      public boolean isEmpty() {
431        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, url);
432      }
433
434  public String fhirType() {
435    return "Consent.policyBasis";
436
437  }
438
439  }
440
441    @Block()
442    public static class ConsentVerificationComponent extends BackboneElement implements IBaseBackboneElement {
443        /**
444         * Has the instruction been verified.
445         */
446        @Child(name = "verified", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
447        @Description(shortDefinition="Has been verified", formalDefinition="Has the instruction been verified." )
448        protected BooleanType verified;
449
450        /**
451         * Extensible list of verification type starting with verification and re-validation.
452         */
453        @Child(name = "verificationType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
454        @Description(shortDefinition="Business case of verification", formalDefinition="Extensible list of verification type starting with verification and re-validation." )
455        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-verification")
456        protected CodeableConcept verificationType;
457
458        /**
459         * The person who conducted the verification/validation of the Grantor decision.
460         */
461        @Child(name = "verifiedBy", type = {Organization.class, Practitioner.class, PractitionerRole.class}, order=3, min=0, max=1, modifier=false, summary=false)
462        @Description(shortDefinition="Person conducting verification", formalDefinition="The person who conducted the verification/validation of the Grantor decision." )
463        protected Reference verifiedBy;
464
465        /**
466         * Who verified the instruction (Patient, Relative or other Authorized Person).
467         */
468        @Child(name = "verifiedWith", type = {Patient.class, RelatedPerson.class}, order=4, min=0, max=1, modifier=false, summary=false)
469        @Description(shortDefinition="Person who verified", formalDefinition="Who verified the instruction (Patient, Relative or other Authorized Person)." )
470        protected Reference verifiedWith;
471
472        /**
473         * Date(s) verification was collected.
474         */
475        @Child(name = "verificationDate", type = {DateTimeType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
476        @Description(shortDefinition="When consent verified", formalDefinition="Date(s) verification was collected." )
477        protected List<DateTimeType> verificationDate;
478
479        private static final long serialVersionUID = -1266157329L;
480
481    /**
482     * Constructor
483     */
484      public ConsentVerificationComponent() {
485        super();
486      }
487
488    /**
489     * Constructor
490     */
491      public ConsentVerificationComponent(boolean verified) {
492        super();
493        this.setVerified(verified);
494      }
495
496        /**
497         * @return {@link #verified} (Has the instruction been verified.). This is the underlying object with id, value and extensions. The accessor "getVerified" gives direct access to the value
498         */
499        public BooleanType getVerifiedElement() { 
500          if (this.verified == null)
501            if (Configuration.errorOnAutoCreate())
502              throw new Error("Attempt to auto-create ConsentVerificationComponent.verified");
503            else if (Configuration.doAutoCreate())
504              this.verified = new BooleanType(); // bb
505          return this.verified;
506        }
507
508        public boolean hasVerifiedElement() { 
509          return this.verified != null && !this.verified.isEmpty();
510        }
511
512        public boolean hasVerified() { 
513          return this.verified != null && !this.verified.isEmpty();
514        }
515
516        /**
517         * @param value {@link #verified} (Has the instruction been verified.). This is the underlying object with id, value and extensions. The accessor "getVerified" gives direct access to the value
518         */
519        public ConsentVerificationComponent setVerifiedElement(BooleanType value) { 
520          this.verified = value;
521          return this;
522        }
523
524        /**
525         * @return Has the instruction been verified.
526         */
527        public boolean getVerified() { 
528          return this.verified == null || this.verified.isEmpty() ? false : this.verified.getValue();
529        }
530
531        /**
532         * @param value Has the instruction been verified.
533         */
534        public ConsentVerificationComponent setVerified(boolean value) { 
535            if (this.verified == null)
536              this.verified = new BooleanType();
537            this.verified.setValue(value);
538          return this;
539        }
540
541        /**
542         * @return {@link #verificationType} (Extensible list of verification type starting with verification and re-validation.)
543         */
544        public CodeableConcept getVerificationType() { 
545          if (this.verificationType == null)
546            if (Configuration.errorOnAutoCreate())
547              throw new Error("Attempt to auto-create ConsentVerificationComponent.verificationType");
548            else if (Configuration.doAutoCreate())
549              this.verificationType = new CodeableConcept(); // cc
550          return this.verificationType;
551        }
552
553        public boolean hasVerificationType() { 
554          return this.verificationType != null && !this.verificationType.isEmpty();
555        }
556
557        /**
558         * @param value {@link #verificationType} (Extensible list of verification type starting with verification and re-validation.)
559         */
560        public ConsentVerificationComponent setVerificationType(CodeableConcept value) { 
561          this.verificationType = value;
562          return this;
563        }
564
565        /**
566         * @return {@link #verifiedBy} (The person who conducted the verification/validation of the Grantor decision.)
567         */
568        public Reference getVerifiedBy() { 
569          if (this.verifiedBy == null)
570            if (Configuration.errorOnAutoCreate())
571              throw new Error("Attempt to auto-create ConsentVerificationComponent.verifiedBy");
572            else if (Configuration.doAutoCreate())
573              this.verifiedBy = new Reference(); // cc
574          return this.verifiedBy;
575        }
576
577        public boolean hasVerifiedBy() { 
578          return this.verifiedBy != null && !this.verifiedBy.isEmpty();
579        }
580
581        /**
582         * @param value {@link #verifiedBy} (The person who conducted the verification/validation of the Grantor decision.)
583         */
584        public ConsentVerificationComponent setVerifiedBy(Reference value) { 
585          this.verifiedBy = value;
586          return this;
587        }
588
589        /**
590         * @return {@link #verifiedWith} (Who verified the instruction (Patient, Relative or other Authorized Person).)
591         */
592        public Reference getVerifiedWith() { 
593          if (this.verifiedWith == null)
594            if (Configuration.errorOnAutoCreate())
595              throw new Error("Attempt to auto-create ConsentVerificationComponent.verifiedWith");
596            else if (Configuration.doAutoCreate())
597              this.verifiedWith = new Reference(); // cc
598          return this.verifiedWith;
599        }
600
601        public boolean hasVerifiedWith() { 
602          return this.verifiedWith != null && !this.verifiedWith.isEmpty();
603        }
604
605        /**
606         * @param value {@link #verifiedWith} (Who verified the instruction (Patient, Relative or other Authorized Person).)
607         */
608        public ConsentVerificationComponent setVerifiedWith(Reference value) { 
609          this.verifiedWith = value;
610          return this;
611        }
612
613        /**
614         * @return {@link #verificationDate} (Date(s) verification was collected.)
615         */
616        public List<DateTimeType> getVerificationDate() { 
617          if (this.verificationDate == null)
618            this.verificationDate = new ArrayList<DateTimeType>();
619          return this.verificationDate;
620        }
621
622        /**
623         * @return Returns a reference to <code>this</code> for easy method chaining
624         */
625        public ConsentVerificationComponent setVerificationDate(List<DateTimeType> theVerificationDate) { 
626          this.verificationDate = theVerificationDate;
627          return this;
628        }
629
630        public boolean hasVerificationDate() { 
631          if (this.verificationDate == null)
632            return false;
633          for (DateTimeType item : this.verificationDate)
634            if (!item.isEmpty())
635              return true;
636          return false;
637        }
638
639        /**
640         * @return {@link #verificationDate} (Date(s) verification was collected.)
641         */
642        public DateTimeType addVerificationDateElement() {//2 
643          DateTimeType t = new DateTimeType();
644          if (this.verificationDate == null)
645            this.verificationDate = new ArrayList<DateTimeType>();
646          this.verificationDate.add(t);
647          return t;
648        }
649
650        /**
651         * @param value {@link #verificationDate} (Date(s) verification was collected.)
652         */
653        public ConsentVerificationComponent addVerificationDate(Date value) { //1
654          DateTimeType t = new DateTimeType();
655          t.setValue(value);
656          if (this.verificationDate == null)
657            this.verificationDate = new ArrayList<DateTimeType>();
658          this.verificationDate.add(t);
659          return this;
660        }
661
662        /**
663         * @param value {@link #verificationDate} (Date(s) verification was collected.)
664         */
665        public boolean hasVerificationDate(Date value) { 
666          if (this.verificationDate == null)
667            return false;
668          for (DateTimeType v : this.verificationDate)
669            if (v.getValue().equals(value)) // dateTime
670              return true;
671          return false;
672        }
673
674        protected void listChildren(List<Property> children) {
675          super.listChildren(children);
676          children.add(new Property("verified", "boolean", "Has the instruction been verified.", 0, 1, verified));
677          children.add(new Property("verificationType", "CodeableConcept", "Extensible list of verification type starting with verification and re-validation.", 0, 1, verificationType));
678          children.add(new Property("verifiedBy", "Reference(Organization|Practitioner|PractitionerRole)", "The person who conducted the verification/validation of the Grantor decision.", 0, 1, verifiedBy));
679          children.add(new Property("verifiedWith", "Reference(Patient|RelatedPerson)", "Who verified the instruction (Patient, Relative or other Authorized Person).", 0, 1, verifiedWith));
680          children.add(new Property("verificationDate", "dateTime", "Date(s) verification was collected.", 0, java.lang.Integer.MAX_VALUE, verificationDate));
681        }
682
683        @Override
684        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
685          switch (_hash) {
686          case -1994383672: /*verified*/  return new Property("verified", "boolean", "Has the instruction been verified.", 0, 1, verified);
687          case 642733045: /*verificationType*/  return new Property("verificationType", "CodeableConcept", "Extensible list of verification type starting with verification and re-validation.", 0, 1, verificationType);
688          case -1047292609: /*verifiedBy*/  return new Property("verifiedBy", "Reference(Organization|Practitioner|PractitionerRole)", "The person who conducted the verification/validation of the Grantor decision.", 0, 1, verifiedBy);
689          case -1425236050: /*verifiedWith*/  return new Property("verifiedWith", "Reference(Patient|RelatedPerson)", "Who verified the instruction (Patient, Relative or other Authorized Person).", 0, 1, verifiedWith);
690          case 642233449: /*verificationDate*/  return new Property("verificationDate", "dateTime", "Date(s) verification was collected.", 0, java.lang.Integer.MAX_VALUE, verificationDate);
691          default: return super.getNamedProperty(_hash, _name, _checkValid);
692          }
693
694        }
695
696      @Override
697      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
698        switch (hash) {
699        case -1994383672: /*verified*/ return this.verified == null ? new Base[0] : new Base[] {this.verified}; // BooleanType
700        case 642733045: /*verificationType*/ return this.verificationType == null ? new Base[0] : new Base[] {this.verificationType}; // CodeableConcept
701        case -1047292609: /*verifiedBy*/ return this.verifiedBy == null ? new Base[0] : new Base[] {this.verifiedBy}; // Reference
702        case -1425236050: /*verifiedWith*/ return this.verifiedWith == null ? new Base[0] : new Base[] {this.verifiedWith}; // Reference
703        case 642233449: /*verificationDate*/ return this.verificationDate == null ? new Base[0] : this.verificationDate.toArray(new Base[this.verificationDate.size()]); // DateTimeType
704        default: return super.getProperty(hash, name, checkValid);
705        }
706
707      }
708
709      @Override
710      public Base setProperty(int hash, String name, Base value) throws FHIRException {
711        switch (hash) {
712        case -1994383672: // verified
713          this.verified = TypeConvertor.castToBoolean(value); // BooleanType
714          return value;
715        case 642733045: // verificationType
716          this.verificationType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
717          return value;
718        case -1047292609: // verifiedBy
719          this.verifiedBy = TypeConvertor.castToReference(value); // Reference
720          return value;
721        case -1425236050: // verifiedWith
722          this.verifiedWith = TypeConvertor.castToReference(value); // Reference
723          return value;
724        case 642233449: // verificationDate
725          this.getVerificationDate().add(TypeConvertor.castToDateTime(value)); // DateTimeType
726          return value;
727        default: return super.setProperty(hash, name, value);
728        }
729
730      }
731
732      @Override
733      public Base setProperty(String name, Base value) throws FHIRException {
734        if (name.equals("verified")) {
735          this.verified = TypeConvertor.castToBoolean(value); // BooleanType
736        } else if (name.equals("verificationType")) {
737          this.verificationType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
738        } else if (name.equals("verifiedBy")) {
739          this.verifiedBy = TypeConvertor.castToReference(value); // Reference
740        } else if (name.equals("verifiedWith")) {
741          this.verifiedWith = TypeConvertor.castToReference(value); // Reference
742        } else if (name.equals("verificationDate")) {
743          this.getVerificationDate().add(TypeConvertor.castToDateTime(value));
744        } else
745          return super.setProperty(name, value);
746        return value;
747      }
748
749      @Override
750      public Base makeProperty(int hash, String name) throws FHIRException {
751        switch (hash) {
752        case -1994383672:  return getVerifiedElement();
753        case 642733045:  return getVerificationType();
754        case -1047292609:  return getVerifiedBy();
755        case -1425236050:  return getVerifiedWith();
756        case 642233449:  return addVerificationDateElement();
757        default: return super.makeProperty(hash, name);
758        }
759
760      }
761
762      @Override
763      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
764        switch (hash) {
765        case -1994383672: /*verified*/ return new String[] {"boolean"};
766        case 642733045: /*verificationType*/ return new String[] {"CodeableConcept"};
767        case -1047292609: /*verifiedBy*/ return new String[] {"Reference"};
768        case -1425236050: /*verifiedWith*/ return new String[] {"Reference"};
769        case 642233449: /*verificationDate*/ return new String[] {"dateTime"};
770        default: return super.getTypesForProperty(hash, name);
771        }
772
773      }
774
775      @Override
776      public Base addChild(String name) throws FHIRException {
777        if (name.equals("verified")) {
778          throw new FHIRException("Cannot call addChild on a primitive type Consent.verification.verified");
779        }
780        else if (name.equals("verificationType")) {
781          this.verificationType = new CodeableConcept();
782          return this.verificationType;
783        }
784        else if (name.equals("verifiedBy")) {
785          this.verifiedBy = new Reference();
786          return this.verifiedBy;
787        }
788        else if (name.equals("verifiedWith")) {
789          this.verifiedWith = new Reference();
790          return this.verifiedWith;
791        }
792        else if (name.equals("verificationDate")) {
793          throw new FHIRException("Cannot call addChild on a primitive type Consent.verification.verificationDate");
794        }
795        else
796          return super.addChild(name);
797      }
798
799      public ConsentVerificationComponent copy() {
800        ConsentVerificationComponent dst = new ConsentVerificationComponent();
801        copyValues(dst);
802        return dst;
803      }
804
805      public void copyValues(ConsentVerificationComponent dst) {
806        super.copyValues(dst);
807        dst.verified = verified == null ? null : verified.copy();
808        dst.verificationType = verificationType == null ? null : verificationType.copy();
809        dst.verifiedBy = verifiedBy == null ? null : verifiedBy.copy();
810        dst.verifiedWith = verifiedWith == null ? null : verifiedWith.copy();
811        if (verificationDate != null) {
812          dst.verificationDate = new ArrayList<DateTimeType>();
813          for (DateTimeType i : verificationDate)
814            dst.verificationDate.add(i.copy());
815        };
816      }
817
818      @Override
819      public boolean equalsDeep(Base other_) {
820        if (!super.equalsDeep(other_))
821          return false;
822        if (!(other_ instanceof ConsentVerificationComponent))
823          return false;
824        ConsentVerificationComponent o = (ConsentVerificationComponent) other_;
825        return compareDeep(verified, o.verified, true) && compareDeep(verificationType, o.verificationType, true)
826           && compareDeep(verifiedBy, o.verifiedBy, true) && compareDeep(verifiedWith, o.verifiedWith, true)
827           && compareDeep(verificationDate, o.verificationDate, true);
828      }
829
830      @Override
831      public boolean equalsShallow(Base other_) {
832        if (!super.equalsShallow(other_))
833          return false;
834        if (!(other_ instanceof ConsentVerificationComponent))
835          return false;
836        ConsentVerificationComponent o = (ConsentVerificationComponent) other_;
837        return compareValues(verified, o.verified, true) && compareValues(verificationDate, o.verificationDate, true)
838          ;
839      }
840
841      public boolean isEmpty() {
842        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(verified, verificationType
843          , verifiedBy, verifiedWith, verificationDate);
844      }
845
846  public String fhirType() {
847    return "Consent.verification";
848
849  }
850
851  }
852
853    @Block()
854    public static class ProvisionComponent extends BackboneElement implements IBaseBackboneElement {
855        /**
856         * Action  to take - permit or deny - when the provision conditions are met.
857         */
858        @Child(name = "type", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
859        @Description(shortDefinition="deny | permit", formalDefinition="Action  to take - permit or deny - when the provision conditions are met." )
860        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-provision-type")
861        protected Enumeration<ConsentProvisionType> type;
862
863        /**
864         * Timeframe for this provision.
865         */
866        @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
867        @Description(shortDefinition="Timeframe for this provision", formalDefinition="Timeframe for this provision." )
868        protected Period period;
869
870        /**
871         * Who or what is controlled by this provision. Use group to identify a set of actors by some property they share (e.g. 'admitting officers').
872         */
873        @Child(name = "actor", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
874        @Description(shortDefinition="Who|what controlled by this provision (or group, by role)", formalDefinition="Who or what is controlled by this provision. Use group to identify a set of actors by some property they share (e.g. 'admitting officers')." )
875        protected List<ProvisionActorComponent> actor;
876
877        /**
878         * Actions controlled by this provision.
879         */
880        @Child(name = "action", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
881        @Description(shortDefinition="Actions controlled by this provision", formalDefinition="Actions controlled by this provision." )
882        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-action")
883        protected List<CodeableConcept> action;
884
885        /**
886         * A security label, comprised of 0..* security label fields (Privacy tags), which define which resources are controlled by this exception.
887         */
888        @Child(name = "securityLabel", type = {Coding.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
889        @Description(shortDefinition="Security Labels that define affected resources", formalDefinition="A security label, comprised of 0..* security label fields (Privacy tags), which define which resources are controlled by this exception." )
890        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-label-examples")
891        protected List<Coding> securityLabel;
892
893        /**
894         * The context of the activities a user is taking - why the user is accessing the data - that are controlled by this provision.
895         */
896        @Child(name = "purpose", type = {Coding.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
897        @Description(shortDefinition="Context of activities covered by this provision", formalDefinition="The context of the activities a user is taking - why the user is accessing the data - that are controlled by this provision." )
898        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
899        protected List<Coding> purpose;
900
901        /**
902         * The documentType(s) covered by this provision. The type can be a CDA document, or some other type that indicates what sort of information the consent relates to.
903         */
904        @Child(name = "documentType", type = {Coding.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
905        @Description(shortDefinition="e.g. Resource Type, Profile, CDA, etc.", formalDefinition="The documentType(s) covered by this provision. The type can be a CDA document, or some other type that indicates what sort of information the consent relates to." )
906        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-content-class")
907        protected List<Coding> documentType;
908
909        /**
910         * The resourceType(s) covered by this provision. The type can be a FHIR resource type or a profile on a type that indicates what information the consent relates to.
911         */
912        @Child(name = "resourceType", type = {Coding.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
913        @Description(shortDefinition="e.g. Resource Type, Profile, etc.", formalDefinition="The resourceType(s) covered by this provision. The type can be a FHIR resource type or a profile on a type that indicates what information the consent relates to." )
914        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
915        protected List<Coding> resourceType;
916
917        /**
918         * If this code is found in an instance, then the provision applies.
919         */
920        @Child(name = "code", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
921        @Description(shortDefinition="e.g. LOINC or SNOMED CT code, etc. in the content", formalDefinition="If this code is found in an instance, then the provision applies." )
922        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-content-code")
923        protected List<CodeableConcept> code;
924
925        /**
926         * Clinical or Operational Relevant period of time that bounds the data controlled by this provision.
927         */
928        @Child(name = "dataPeriod", type = {Period.class}, order=10, min=0, max=1, modifier=false, summary=true)
929        @Description(shortDefinition="Timeframe for data controlled by this provision", formalDefinition="Clinical or Operational Relevant period of time that bounds the data controlled by this provision." )
930        protected Period dataPeriod;
931
932        /**
933         * The resources controlled by this provision if specific resources are referenced.
934         */
935        @Child(name = "data", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
936        @Description(shortDefinition="Data controlled by this provision", formalDefinition="The resources controlled by this provision if specific resources are referenced." )
937        protected List<ProvisionDataComponent> data;
938
939        /**
940         * A computable (FHIRPath or other) definition of what is controlled by this consent.
941         */
942        @Child(name = "expression", type = {Expression.class}, order=12, min=0, max=1, modifier=false, summary=false)
943        @Description(shortDefinition="A computable expression of the consent", formalDefinition="A computable (FHIRPath or other) definition of what is controlled by this consent." )
944        protected Expression expression;
945
946        /**
947         * Provisions which provide exceptions to the base provision or subprovisions.
948         */
949        @Child(name = "provision", type = {ProvisionComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
950        @Description(shortDefinition="Nested Exception Provisions", formalDefinition="Provisions which provide exceptions to the base provision or subprovisions." )
951        protected List<ProvisionComponent> provision;
952
953        private static final long serialVersionUID = -1668990115L;
954
955    /**
956     * Constructor
957     */
958      public ProvisionComponent() {
959        super();
960      }
961
962        /**
963         * @return {@link #type} (Action  to take - permit or deny - when the provision conditions are met.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
964         */
965        public Enumeration<ConsentProvisionType> getTypeElement() { 
966          if (this.type == null)
967            if (Configuration.errorOnAutoCreate())
968              throw new Error("Attempt to auto-create ProvisionComponent.type");
969            else if (Configuration.doAutoCreate())
970              this.type = new Enumeration<ConsentProvisionType>(new ConsentProvisionTypeEnumFactory()); // bb
971          return this.type;
972        }
973
974        public boolean hasTypeElement() { 
975          return this.type != null && !this.type.isEmpty();
976        }
977
978        public boolean hasType() { 
979          return this.type != null && !this.type.isEmpty();
980        }
981
982        /**
983         * @param value {@link #type} (Action  to take - permit or deny - when the provision conditions are met.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
984         */
985        public ProvisionComponent setTypeElement(Enumeration<ConsentProvisionType> value) { 
986          this.type = value;
987          return this;
988        }
989
990        /**
991         * @return Action  to take - permit or deny - when the provision conditions are met.
992         */
993        public ConsentProvisionType getType() { 
994          return this.type == null ? null : this.type.getValue();
995        }
996
997        /**
998         * @param value Action  to take - permit or deny - when the provision conditions are met.
999         */
1000        public ProvisionComponent setType(ConsentProvisionType value) { 
1001          if (value == null)
1002            this.type = null;
1003          else {
1004            if (this.type == null)
1005              this.type = new Enumeration<ConsentProvisionType>(new ConsentProvisionTypeEnumFactory());
1006            this.type.setValue(value);
1007          }
1008          return this;
1009        }
1010
1011        /**
1012         * @return {@link #period} (Timeframe for this provision.)
1013         */
1014        public Period getPeriod() { 
1015          if (this.period == null)
1016            if (Configuration.errorOnAutoCreate())
1017              throw new Error("Attempt to auto-create ProvisionComponent.period");
1018            else if (Configuration.doAutoCreate())
1019              this.period = new Period(); // cc
1020          return this.period;
1021        }
1022
1023        public boolean hasPeriod() { 
1024          return this.period != null && !this.period.isEmpty();
1025        }
1026
1027        /**
1028         * @param value {@link #period} (Timeframe for this provision.)
1029         */
1030        public ProvisionComponent setPeriod(Period value) { 
1031          this.period = value;
1032          return this;
1033        }
1034
1035        /**
1036         * @return {@link #actor} (Who or what is controlled by this provision. Use group to identify a set of actors by some property they share (e.g. 'admitting officers').)
1037         */
1038        public List<ProvisionActorComponent> getActor() { 
1039          if (this.actor == null)
1040            this.actor = new ArrayList<ProvisionActorComponent>();
1041          return this.actor;
1042        }
1043
1044        /**
1045         * @return Returns a reference to <code>this</code> for easy method chaining
1046         */
1047        public ProvisionComponent setActor(List<ProvisionActorComponent> theActor) { 
1048          this.actor = theActor;
1049          return this;
1050        }
1051
1052        public boolean hasActor() { 
1053          if (this.actor == null)
1054            return false;
1055          for (ProvisionActorComponent item : this.actor)
1056            if (!item.isEmpty())
1057              return true;
1058          return false;
1059        }
1060
1061        public ProvisionActorComponent addActor() { //3
1062          ProvisionActorComponent t = new ProvisionActorComponent();
1063          if (this.actor == null)
1064            this.actor = new ArrayList<ProvisionActorComponent>();
1065          this.actor.add(t);
1066          return t;
1067        }
1068
1069        public ProvisionComponent addActor(ProvisionActorComponent t) { //3
1070          if (t == null)
1071            return this;
1072          if (this.actor == null)
1073            this.actor = new ArrayList<ProvisionActorComponent>();
1074          this.actor.add(t);
1075          return this;
1076        }
1077
1078        /**
1079         * @return The first repetition of repeating field {@link #actor}, creating it if it does not already exist {3}
1080         */
1081        public ProvisionActorComponent getActorFirstRep() { 
1082          if (getActor().isEmpty()) {
1083            addActor();
1084          }
1085          return getActor().get(0);
1086        }
1087
1088        /**
1089         * @return {@link #action} (Actions controlled by this provision.)
1090         */
1091        public List<CodeableConcept> getAction() { 
1092          if (this.action == null)
1093            this.action = new ArrayList<CodeableConcept>();
1094          return this.action;
1095        }
1096
1097        /**
1098         * @return Returns a reference to <code>this</code> for easy method chaining
1099         */
1100        public ProvisionComponent setAction(List<CodeableConcept> theAction) { 
1101          this.action = theAction;
1102          return this;
1103        }
1104
1105        public boolean hasAction() { 
1106          if (this.action == null)
1107            return false;
1108          for (CodeableConcept item : this.action)
1109            if (!item.isEmpty())
1110              return true;
1111          return false;
1112        }
1113
1114        public CodeableConcept addAction() { //3
1115          CodeableConcept t = new CodeableConcept();
1116          if (this.action == null)
1117            this.action = new ArrayList<CodeableConcept>();
1118          this.action.add(t);
1119          return t;
1120        }
1121
1122        public ProvisionComponent addAction(CodeableConcept t) { //3
1123          if (t == null)
1124            return this;
1125          if (this.action == null)
1126            this.action = new ArrayList<CodeableConcept>();
1127          this.action.add(t);
1128          return this;
1129        }
1130
1131        /**
1132         * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist {3}
1133         */
1134        public CodeableConcept getActionFirstRep() { 
1135          if (getAction().isEmpty()) {
1136            addAction();
1137          }
1138          return getAction().get(0);
1139        }
1140
1141        /**
1142         * @return {@link #securityLabel} (A security label, comprised of 0..* security label fields (Privacy tags), which define which resources are controlled by this exception.)
1143         */
1144        public List<Coding> getSecurityLabel() { 
1145          if (this.securityLabel == null)
1146            this.securityLabel = new ArrayList<Coding>();
1147          return this.securityLabel;
1148        }
1149
1150        /**
1151         * @return Returns a reference to <code>this</code> for easy method chaining
1152         */
1153        public ProvisionComponent setSecurityLabel(List<Coding> theSecurityLabel) { 
1154          this.securityLabel = theSecurityLabel;
1155          return this;
1156        }
1157
1158        public boolean hasSecurityLabel() { 
1159          if (this.securityLabel == null)
1160            return false;
1161          for (Coding item : this.securityLabel)
1162            if (!item.isEmpty())
1163              return true;
1164          return false;
1165        }
1166
1167        public Coding addSecurityLabel() { //3
1168          Coding t = new Coding();
1169          if (this.securityLabel == null)
1170            this.securityLabel = new ArrayList<Coding>();
1171          this.securityLabel.add(t);
1172          return t;
1173        }
1174
1175        public ProvisionComponent addSecurityLabel(Coding t) { //3
1176          if (t == null)
1177            return this;
1178          if (this.securityLabel == null)
1179            this.securityLabel = new ArrayList<Coding>();
1180          this.securityLabel.add(t);
1181          return this;
1182        }
1183
1184        /**
1185         * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist {3}
1186         */
1187        public Coding getSecurityLabelFirstRep() { 
1188          if (getSecurityLabel().isEmpty()) {
1189            addSecurityLabel();
1190          }
1191          return getSecurityLabel().get(0);
1192        }
1193
1194        /**
1195         * @return {@link #purpose} (The context of the activities a user is taking - why the user is accessing the data - that are controlled by this provision.)
1196         */
1197        public List<Coding> getPurpose() { 
1198          if (this.purpose == null)
1199            this.purpose = new ArrayList<Coding>();
1200          return this.purpose;
1201        }
1202
1203        /**
1204         * @return Returns a reference to <code>this</code> for easy method chaining
1205         */
1206        public ProvisionComponent setPurpose(List<Coding> thePurpose) { 
1207          this.purpose = thePurpose;
1208          return this;
1209        }
1210
1211        public boolean hasPurpose() { 
1212          if (this.purpose == null)
1213            return false;
1214          for (Coding item : this.purpose)
1215            if (!item.isEmpty())
1216              return true;
1217          return false;
1218        }
1219
1220        public Coding addPurpose() { //3
1221          Coding t = new Coding();
1222          if (this.purpose == null)
1223            this.purpose = new ArrayList<Coding>();
1224          this.purpose.add(t);
1225          return t;
1226        }
1227
1228        public ProvisionComponent addPurpose(Coding t) { //3
1229          if (t == null)
1230            return this;
1231          if (this.purpose == null)
1232            this.purpose = new ArrayList<Coding>();
1233          this.purpose.add(t);
1234          return this;
1235        }
1236
1237        /**
1238         * @return The first repetition of repeating field {@link #purpose}, creating it if it does not already exist {3}
1239         */
1240        public Coding getPurposeFirstRep() { 
1241          if (getPurpose().isEmpty()) {
1242            addPurpose();
1243          }
1244          return getPurpose().get(0);
1245        }
1246
1247        /**
1248         * @return {@link #documentType} (The documentType(s) covered by this provision. The type can be a CDA document, or some other type that indicates what sort of information the consent relates to.)
1249         */
1250        public List<Coding> getDocumentType() { 
1251          if (this.documentType == null)
1252            this.documentType = new ArrayList<Coding>();
1253          return this.documentType;
1254        }
1255
1256        /**
1257         * @return Returns a reference to <code>this</code> for easy method chaining
1258         */
1259        public ProvisionComponent setDocumentType(List<Coding> theDocumentType) { 
1260          this.documentType = theDocumentType;
1261          return this;
1262        }
1263
1264        public boolean hasDocumentType() { 
1265          if (this.documentType == null)
1266            return false;
1267          for (Coding item : this.documentType)
1268            if (!item.isEmpty())
1269              return true;
1270          return false;
1271        }
1272
1273        public Coding addDocumentType() { //3
1274          Coding t = new Coding();
1275          if (this.documentType == null)
1276            this.documentType = new ArrayList<Coding>();
1277          this.documentType.add(t);
1278          return t;
1279        }
1280
1281        public ProvisionComponent addDocumentType(Coding t) { //3
1282          if (t == null)
1283            return this;
1284          if (this.documentType == null)
1285            this.documentType = new ArrayList<Coding>();
1286          this.documentType.add(t);
1287          return this;
1288        }
1289
1290        /**
1291         * @return The first repetition of repeating field {@link #documentType}, creating it if it does not already exist {3}
1292         */
1293        public Coding getDocumentTypeFirstRep() { 
1294          if (getDocumentType().isEmpty()) {
1295            addDocumentType();
1296          }
1297          return getDocumentType().get(0);
1298        }
1299
1300        /**
1301         * @return {@link #resourceType} (The resourceType(s) covered by this provision. The type can be a FHIR resource type or a profile on a type that indicates what information the consent relates to.)
1302         */
1303        public List<Coding> getResourceType() { 
1304          if (this.resourceType == null)
1305            this.resourceType = new ArrayList<Coding>();
1306          return this.resourceType;
1307        }
1308
1309        /**
1310         * @return Returns a reference to <code>this</code> for easy method chaining
1311         */
1312        public ProvisionComponent setResourceType(List<Coding> theResourceType) { 
1313          this.resourceType = theResourceType;
1314          return this;
1315        }
1316
1317        public boolean hasResourceType() { 
1318          if (this.resourceType == null)
1319            return false;
1320          for (Coding item : this.resourceType)
1321            if (!item.isEmpty())
1322              return true;
1323          return false;
1324        }
1325
1326        public Coding addResourceType() { //3
1327          Coding t = new Coding();
1328          if (this.resourceType == null)
1329            this.resourceType = new ArrayList<Coding>();
1330          this.resourceType.add(t);
1331          return t;
1332        }
1333
1334        public ProvisionComponent addResourceType(Coding t) { //3
1335          if (t == null)
1336            return this;
1337          if (this.resourceType == null)
1338            this.resourceType = new ArrayList<Coding>();
1339          this.resourceType.add(t);
1340          return this;
1341        }
1342
1343        /**
1344         * @return The first repetition of repeating field {@link #resourceType}, creating it if it does not already exist {3}
1345         */
1346        public Coding getResourceTypeFirstRep() { 
1347          if (getResourceType().isEmpty()) {
1348            addResourceType();
1349          }
1350          return getResourceType().get(0);
1351        }
1352
1353        /**
1354         * @return {@link #code} (If this code is found in an instance, then the provision applies.)
1355         */
1356        public List<CodeableConcept> getCode() { 
1357          if (this.code == null)
1358            this.code = new ArrayList<CodeableConcept>();
1359          return this.code;
1360        }
1361
1362        /**
1363         * @return Returns a reference to <code>this</code> for easy method chaining
1364         */
1365        public ProvisionComponent setCode(List<CodeableConcept> theCode) { 
1366          this.code = theCode;
1367          return this;
1368        }
1369
1370        public boolean hasCode() { 
1371          if (this.code == null)
1372            return false;
1373          for (CodeableConcept item : this.code)
1374            if (!item.isEmpty())
1375              return true;
1376          return false;
1377        }
1378
1379        public CodeableConcept addCode() { //3
1380          CodeableConcept t = new CodeableConcept();
1381          if (this.code == null)
1382            this.code = new ArrayList<CodeableConcept>();
1383          this.code.add(t);
1384          return t;
1385        }
1386
1387        public ProvisionComponent addCode(CodeableConcept t) { //3
1388          if (t == null)
1389            return this;
1390          if (this.code == null)
1391            this.code = new ArrayList<CodeableConcept>();
1392          this.code.add(t);
1393          return this;
1394        }
1395
1396        /**
1397         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
1398         */
1399        public CodeableConcept getCodeFirstRep() { 
1400          if (getCode().isEmpty()) {
1401            addCode();
1402          }
1403          return getCode().get(0);
1404        }
1405
1406        /**
1407         * @return {@link #dataPeriod} (Clinical or Operational Relevant period of time that bounds the data controlled by this provision.)
1408         */
1409        public Period getDataPeriod() { 
1410          if (this.dataPeriod == null)
1411            if (Configuration.errorOnAutoCreate())
1412              throw new Error("Attempt to auto-create ProvisionComponent.dataPeriod");
1413            else if (Configuration.doAutoCreate())
1414              this.dataPeriod = new Period(); // cc
1415          return this.dataPeriod;
1416        }
1417
1418        public boolean hasDataPeriod() { 
1419          return this.dataPeriod != null && !this.dataPeriod.isEmpty();
1420        }
1421
1422        /**
1423         * @param value {@link #dataPeriod} (Clinical or Operational Relevant period of time that bounds the data controlled by this provision.)
1424         */
1425        public ProvisionComponent setDataPeriod(Period value) { 
1426          this.dataPeriod = value;
1427          return this;
1428        }
1429
1430        /**
1431         * @return {@link #data} (The resources controlled by this provision if specific resources are referenced.)
1432         */
1433        public List<ProvisionDataComponent> getData() { 
1434          if (this.data == null)
1435            this.data = new ArrayList<ProvisionDataComponent>();
1436          return this.data;
1437        }
1438
1439        /**
1440         * @return Returns a reference to <code>this</code> for easy method chaining
1441         */
1442        public ProvisionComponent setData(List<ProvisionDataComponent> theData) { 
1443          this.data = theData;
1444          return this;
1445        }
1446
1447        public boolean hasData() { 
1448          if (this.data == null)
1449            return false;
1450          for (ProvisionDataComponent item : this.data)
1451            if (!item.isEmpty())
1452              return true;
1453          return false;
1454        }
1455
1456        public ProvisionDataComponent addData() { //3
1457          ProvisionDataComponent t = new ProvisionDataComponent();
1458          if (this.data == null)
1459            this.data = new ArrayList<ProvisionDataComponent>();
1460          this.data.add(t);
1461          return t;
1462        }
1463
1464        public ProvisionComponent addData(ProvisionDataComponent t) { //3
1465          if (t == null)
1466            return this;
1467          if (this.data == null)
1468            this.data = new ArrayList<ProvisionDataComponent>();
1469          this.data.add(t);
1470          return this;
1471        }
1472
1473        /**
1474         * @return The first repetition of repeating field {@link #data}, creating it if it does not already exist {3}
1475         */
1476        public ProvisionDataComponent getDataFirstRep() { 
1477          if (getData().isEmpty()) {
1478            addData();
1479          }
1480          return getData().get(0);
1481        }
1482
1483        /**
1484         * @return {@link #expression} (A computable (FHIRPath or other) definition of what is controlled by this consent.)
1485         */
1486        public Expression getExpression() { 
1487          if (this.expression == null)
1488            if (Configuration.errorOnAutoCreate())
1489              throw new Error("Attempt to auto-create ProvisionComponent.expression");
1490            else if (Configuration.doAutoCreate())
1491              this.expression = new Expression(); // cc
1492          return this.expression;
1493        }
1494
1495        public boolean hasExpression() { 
1496          return this.expression != null && !this.expression.isEmpty();
1497        }
1498
1499        /**
1500         * @param value {@link #expression} (A computable (FHIRPath or other) definition of what is controlled by this consent.)
1501         */
1502        public ProvisionComponent setExpression(Expression value) { 
1503          this.expression = value;
1504          return this;
1505        }
1506
1507        /**
1508         * @return {@link #provision} (Provisions which provide exceptions to the base provision or subprovisions.)
1509         */
1510        public List<ProvisionComponent> getProvision() { 
1511          if (this.provision == null)
1512            this.provision = new ArrayList<ProvisionComponent>();
1513          return this.provision;
1514        }
1515
1516        /**
1517         * @return Returns a reference to <code>this</code> for easy method chaining
1518         */
1519        public ProvisionComponent setProvision(List<ProvisionComponent> theProvision) { 
1520          this.provision = theProvision;
1521          return this;
1522        }
1523
1524        public boolean hasProvision() { 
1525          if (this.provision == null)
1526            return false;
1527          for (ProvisionComponent item : this.provision)
1528            if (!item.isEmpty())
1529              return true;
1530          return false;
1531        }
1532
1533        public ProvisionComponent addProvision() { //3
1534          ProvisionComponent t = new ProvisionComponent();
1535          if (this.provision == null)
1536            this.provision = new ArrayList<ProvisionComponent>();
1537          this.provision.add(t);
1538          return t;
1539        }
1540
1541        public ProvisionComponent addProvision(ProvisionComponent t) { //3
1542          if (t == null)
1543            return this;
1544          if (this.provision == null)
1545            this.provision = new ArrayList<ProvisionComponent>();
1546          this.provision.add(t);
1547          return this;
1548        }
1549
1550        /**
1551         * @return The first repetition of repeating field {@link #provision}, creating it if it does not already exist {3}
1552         */
1553        public ProvisionComponent getProvisionFirstRep() { 
1554          if (getProvision().isEmpty()) {
1555            addProvision();
1556          }
1557          return getProvision().get(0);
1558        }
1559
1560        protected void listChildren(List<Property> children) {
1561          super.listChildren(children);
1562          children.add(new Property("type", "code", "Action  to take - permit or deny - when the provision conditions are met.", 0, 1, type));
1563          children.add(new Property("period", "Period", "Timeframe for this provision.", 0, 1, period));
1564          children.add(new Property("actor", "", "Who or what is controlled by this provision. Use group to identify a set of actors by some property they share (e.g. 'admitting officers').", 0, java.lang.Integer.MAX_VALUE, actor));
1565          children.add(new Property("action", "CodeableConcept", "Actions controlled by this provision.", 0, java.lang.Integer.MAX_VALUE, action));
1566          children.add(new Property("securityLabel", "Coding", "A security label, comprised of 0..* security label fields (Privacy tags), which define which resources are controlled by this exception.", 0, java.lang.Integer.MAX_VALUE, securityLabel));
1567          children.add(new Property("purpose", "Coding", "The context of the activities a user is taking - why the user is accessing the data - that are controlled by this provision.", 0, java.lang.Integer.MAX_VALUE, purpose));
1568          children.add(new Property("documentType", "Coding", "The documentType(s) covered by this provision. The type can be a CDA document, or some other type that indicates what sort of information the consent relates to.", 0, java.lang.Integer.MAX_VALUE, documentType));
1569          children.add(new Property("resourceType", "Coding", "The resourceType(s) covered by this provision. The type can be a FHIR resource type or a profile on a type that indicates what information the consent relates to.", 0, java.lang.Integer.MAX_VALUE, resourceType));
1570          children.add(new Property("code", "CodeableConcept", "If this code is found in an instance, then the provision applies.", 0, java.lang.Integer.MAX_VALUE, code));
1571          children.add(new Property("dataPeriod", "Period", "Clinical or Operational Relevant period of time that bounds the data controlled by this provision.", 0, 1, dataPeriod));
1572          children.add(new Property("data", "", "The resources controlled by this provision if specific resources are referenced.", 0, java.lang.Integer.MAX_VALUE, data));
1573          children.add(new Property("expression", "Expression", "A computable (FHIRPath or other) definition of what is controlled by this consent.", 0, 1, expression));
1574          children.add(new Property("provision", "@Consent.provision", "Provisions which provide exceptions to the base provision or subprovisions.", 0, java.lang.Integer.MAX_VALUE, provision));
1575        }
1576
1577        @Override
1578        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1579          switch (_hash) {
1580          case 3575610: /*type*/  return new Property("type", "code", "Action  to take - permit or deny - when the provision conditions are met.", 0, 1, type);
1581          case -991726143: /*period*/  return new Property("period", "Period", "Timeframe for this provision.", 0, 1, period);
1582          case 92645877: /*actor*/  return new Property("actor", "", "Who or what is controlled by this provision. Use group to identify a set of actors by some property they share (e.g. 'admitting officers').", 0, java.lang.Integer.MAX_VALUE, actor);
1583          case -1422950858: /*action*/  return new Property("action", "CodeableConcept", "Actions controlled by this provision.", 0, java.lang.Integer.MAX_VALUE, action);
1584          case -722296940: /*securityLabel*/  return new Property("securityLabel", "Coding", "A security label, comprised of 0..* security label fields (Privacy tags), which define which resources are controlled by this exception.", 0, java.lang.Integer.MAX_VALUE, securityLabel);
1585          case -220463842: /*purpose*/  return new Property("purpose", "Coding", "The context of the activities a user is taking - why the user is accessing the data - that are controlled by this provision.", 0, java.lang.Integer.MAX_VALUE, purpose);
1586          case -1473196299: /*documentType*/  return new Property("documentType", "Coding", "The documentType(s) covered by this provision. The type can be a CDA document, or some other type that indicates what sort of information the consent relates to.", 0, java.lang.Integer.MAX_VALUE, documentType);
1587          case -384364440: /*resourceType*/  return new Property("resourceType", "Coding", "The resourceType(s) covered by this provision. The type can be a FHIR resource type or a profile on a type that indicates what information the consent relates to.", 0, java.lang.Integer.MAX_VALUE, resourceType);
1588          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "If this code is found in an instance, then the provision applies.", 0, java.lang.Integer.MAX_VALUE, code);
1589          case 1177250315: /*dataPeriod*/  return new Property("dataPeriod", "Period", "Clinical or Operational Relevant period of time that bounds the data controlled by this provision.", 0, 1, dataPeriod);
1590          case 3076010: /*data*/  return new Property("data", "", "The resources controlled by this provision if specific resources are referenced.", 0, java.lang.Integer.MAX_VALUE, data);
1591          case -1795452264: /*expression*/  return new Property("expression", "Expression", "A computable (FHIRPath or other) definition of what is controlled by this consent.", 0, 1, expression);
1592          case -547120939: /*provision*/  return new Property("provision", "@Consent.provision", "Provisions which provide exceptions to the base provision or subprovisions.", 0, java.lang.Integer.MAX_VALUE, provision);
1593          default: return super.getNamedProperty(_hash, _name, _checkValid);
1594          }
1595
1596        }
1597
1598      @Override
1599      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1600        switch (hash) {
1601        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<ConsentProvisionType>
1602        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1603        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : this.actor.toArray(new Base[this.actor.size()]); // ProvisionActorComponent
1604        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // CodeableConcept
1605        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // Coding
1606        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : this.purpose.toArray(new Base[this.purpose.size()]); // Coding
1607        case -1473196299: /*documentType*/ return this.documentType == null ? new Base[0] : this.documentType.toArray(new Base[this.documentType.size()]); // Coding
1608        case -384364440: /*resourceType*/ return this.resourceType == null ? new Base[0] : this.resourceType.toArray(new Base[this.resourceType.size()]); // Coding
1609        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
1610        case 1177250315: /*dataPeriod*/ return this.dataPeriod == null ? new Base[0] : new Base[] {this.dataPeriod}; // Period
1611        case 3076010: /*data*/ return this.data == null ? new Base[0] : this.data.toArray(new Base[this.data.size()]); // ProvisionDataComponent
1612        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // Expression
1613        case -547120939: /*provision*/ return this.provision == null ? new Base[0] : this.provision.toArray(new Base[this.provision.size()]); // ProvisionComponent
1614        default: return super.getProperty(hash, name, checkValid);
1615        }
1616
1617      }
1618
1619      @Override
1620      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1621        switch (hash) {
1622        case 3575610: // type
1623          value = new ConsentProvisionTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1624          this.type = (Enumeration) value; // Enumeration<ConsentProvisionType>
1625          return value;
1626        case -991726143: // period
1627          this.period = TypeConvertor.castToPeriod(value); // Period
1628          return value;
1629        case 92645877: // actor
1630          this.getActor().add((ProvisionActorComponent) value); // ProvisionActorComponent
1631          return value;
1632        case -1422950858: // action
1633          this.getAction().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1634          return value;
1635        case -722296940: // securityLabel
1636          this.getSecurityLabel().add(TypeConvertor.castToCoding(value)); // Coding
1637          return value;
1638        case -220463842: // purpose
1639          this.getPurpose().add(TypeConvertor.castToCoding(value)); // Coding
1640          return value;
1641        case -1473196299: // documentType
1642          this.getDocumentType().add(TypeConvertor.castToCoding(value)); // Coding
1643          return value;
1644        case -384364440: // resourceType
1645          this.getResourceType().add(TypeConvertor.castToCoding(value)); // Coding
1646          return value;
1647        case 3059181: // code
1648          this.getCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1649          return value;
1650        case 1177250315: // dataPeriod
1651          this.dataPeriod = TypeConvertor.castToPeriod(value); // Period
1652          return value;
1653        case 3076010: // data
1654          this.getData().add((ProvisionDataComponent) value); // ProvisionDataComponent
1655          return value;
1656        case -1795452264: // expression
1657          this.expression = TypeConvertor.castToExpression(value); // Expression
1658          return value;
1659        case -547120939: // provision
1660          this.getProvision().add((ProvisionComponent) value); // ProvisionComponent
1661          return value;
1662        default: return super.setProperty(hash, name, value);
1663        }
1664
1665      }
1666
1667      @Override
1668      public Base setProperty(String name, Base value) throws FHIRException {
1669        if (name.equals("type")) {
1670          value = new ConsentProvisionTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1671          this.type = (Enumeration) value; // Enumeration<ConsentProvisionType>
1672        } else if (name.equals("period")) {
1673          this.period = TypeConvertor.castToPeriod(value); // Period
1674        } else if (name.equals("actor")) {
1675          this.getActor().add((ProvisionActorComponent) value);
1676        } else if (name.equals("action")) {
1677          this.getAction().add(TypeConvertor.castToCodeableConcept(value));
1678        } else if (name.equals("securityLabel")) {
1679          this.getSecurityLabel().add(TypeConvertor.castToCoding(value));
1680        } else if (name.equals("purpose")) {
1681          this.getPurpose().add(TypeConvertor.castToCoding(value));
1682        } else if (name.equals("documentType")) {
1683          this.getDocumentType().add(TypeConvertor.castToCoding(value));
1684        } else if (name.equals("resourceType")) {
1685          this.getResourceType().add(TypeConvertor.castToCoding(value));
1686        } else if (name.equals("code")) {
1687          this.getCode().add(TypeConvertor.castToCodeableConcept(value));
1688        } else if (name.equals("dataPeriod")) {
1689          this.dataPeriod = TypeConvertor.castToPeriod(value); // Period
1690        } else if (name.equals("data")) {
1691          this.getData().add((ProvisionDataComponent) value);
1692        } else if (name.equals("expression")) {
1693          this.expression = TypeConvertor.castToExpression(value); // Expression
1694        } else if (name.equals("provision")) {
1695          this.getProvision().add((ProvisionComponent) value);
1696        } else
1697          return super.setProperty(name, value);
1698        return value;
1699      }
1700
1701      @Override
1702      public Base makeProperty(int hash, String name) throws FHIRException {
1703        switch (hash) {
1704        case 3575610:  return getTypeElement();
1705        case -991726143:  return getPeriod();
1706        case 92645877:  return addActor(); 
1707        case -1422950858:  return addAction(); 
1708        case -722296940:  return addSecurityLabel(); 
1709        case -220463842:  return addPurpose(); 
1710        case -1473196299:  return addDocumentType(); 
1711        case -384364440:  return addResourceType(); 
1712        case 3059181:  return addCode(); 
1713        case 1177250315:  return getDataPeriod();
1714        case 3076010:  return addData(); 
1715        case -1795452264:  return getExpression();
1716        case -547120939:  return addProvision(); 
1717        default: return super.makeProperty(hash, name);
1718        }
1719
1720      }
1721
1722      @Override
1723      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1724        switch (hash) {
1725        case 3575610: /*type*/ return new String[] {"code"};
1726        case -991726143: /*period*/ return new String[] {"Period"};
1727        case 92645877: /*actor*/ return new String[] {};
1728        case -1422950858: /*action*/ return new String[] {"CodeableConcept"};
1729        case -722296940: /*securityLabel*/ return new String[] {"Coding"};
1730        case -220463842: /*purpose*/ return new String[] {"Coding"};
1731        case -1473196299: /*documentType*/ return new String[] {"Coding"};
1732        case -384364440: /*resourceType*/ return new String[] {"Coding"};
1733        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1734        case 1177250315: /*dataPeriod*/ return new String[] {"Period"};
1735        case 3076010: /*data*/ return new String[] {};
1736        case -1795452264: /*expression*/ return new String[] {"Expression"};
1737        case -547120939: /*provision*/ return new String[] {"@Consent.provision"};
1738        default: return super.getTypesForProperty(hash, name);
1739        }
1740
1741      }
1742
1743      @Override
1744      public Base addChild(String name) throws FHIRException {
1745        if (name.equals("type")) {
1746          throw new FHIRException("Cannot call addChild on a primitive type Consent.provision.type");
1747        }
1748        else if (name.equals("period")) {
1749          this.period = new Period();
1750          return this.period;
1751        }
1752        else if (name.equals("actor")) {
1753          return addActor();
1754        }
1755        else if (name.equals("action")) {
1756          return addAction();
1757        }
1758        else if (name.equals("securityLabel")) {
1759          return addSecurityLabel();
1760        }
1761        else if (name.equals("purpose")) {
1762          return addPurpose();
1763        }
1764        else if (name.equals("documentType")) {
1765          return addDocumentType();
1766        }
1767        else if (name.equals("resourceType")) {
1768          return addResourceType();
1769        }
1770        else if (name.equals("code")) {
1771          return addCode();
1772        }
1773        else if (name.equals("dataPeriod")) {
1774          this.dataPeriod = new Period();
1775          return this.dataPeriod;
1776        }
1777        else if (name.equals("data")) {
1778          return addData();
1779        }
1780        else if (name.equals("expression")) {
1781          this.expression = new Expression();
1782          return this.expression;
1783        }
1784        else if (name.equals("provision")) {
1785          return addProvision();
1786        }
1787        else
1788          return super.addChild(name);
1789      }
1790
1791      public ProvisionComponent copy() {
1792        ProvisionComponent dst = new ProvisionComponent();
1793        copyValues(dst);
1794        return dst;
1795      }
1796
1797      public void copyValues(ProvisionComponent dst) {
1798        super.copyValues(dst);
1799        dst.type = type == null ? null : type.copy();
1800        dst.period = period == null ? null : period.copy();
1801        if (actor != null) {
1802          dst.actor = new ArrayList<ProvisionActorComponent>();
1803          for (ProvisionActorComponent i : actor)
1804            dst.actor.add(i.copy());
1805        };
1806        if (action != null) {
1807          dst.action = new ArrayList<CodeableConcept>();
1808          for (CodeableConcept i : action)
1809            dst.action.add(i.copy());
1810        };
1811        if (securityLabel != null) {
1812          dst.securityLabel = new ArrayList<Coding>();
1813          for (Coding i : securityLabel)
1814            dst.securityLabel.add(i.copy());
1815        };
1816        if (purpose != null) {
1817          dst.purpose = new ArrayList<Coding>();
1818          for (Coding i : purpose)
1819            dst.purpose.add(i.copy());
1820        };
1821        if (documentType != null) {
1822          dst.documentType = new ArrayList<Coding>();
1823          for (Coding i : documentType)
1824            dst.documentType.add(i.copy());
1825        };
1826        if (resourceType != null) {
1827          dst.resourceType = new ArrayList<Coding>();
1828          for (Coding i : resourceType)
1829            dst.resourceType.add(i.copy());
1830        };
1831        if (code != null) {
1832          dst.code = new ArrayList<CodeableConcept>();
1833          for (CodeableConcept i : code)
1834            dst.code.add(i.copy());
1835        };
1836        dst.dataPeriod = dataPeriod == null ? null : dataPeriod.copy();
1837        if (data != null) {
1838          dst.data = new ArrayList<ProvisionDataComponent>();
1839          for (ProvisionDataComponent i : data)
1840            dst.data.add(i.copy());
1841        };
1842        dst.expression = expression == null ? null : expression.copy();
1843        if (provision != null) {
1844          dst.provision = new ArrayList<ProvisionComponent>();
1845          for (ProvisionComponent i : provision)
1846            dst.provision.add(i.copy());
1847        };
1848      }
1849
1850      @Override
1851      public boolean equalsDeep(Base other_) {
1852        if (!super.equalsDeep(other_))
1853          return false;
1854        if (!(other_ instanceof ProvisionComponent))
1855          return false;
1856        ProvisionComponent o = (ProvisionComponent) other_;
1857        return compareDeep(type, o.type, true) && compareDeep(period, o.period, true) && compareDeep(actor, o.actor, true)
1858           && compareDeep(action, o.action, true) && compareDeep(securityLabel, o.securityLabel, true) && compareDeep(purpose, o.purpose, true)
1859           && compareDeep(documentType, o.documentType, true) && compareDeep(resourceType, o.resourceType, true)
1860           && compareDeep(code, o.code, true) && compareDeep(dataPeriod, o.dataPeriod, true) && compareDeep(data, o.data, true)
1861           && compareDeep(expression, o.expression, true) && compareDeep(provision, o.provision, true);
1862      }
1863
1864      @Override
1865      public boolean equalsShallow(Base other_) {
1866        if (!super.equalsShallow(other_))
1867          return false;
1868        if (!(other_ instanceof ProvisionComponent))
1869          return false;
1870        ProvisionComponent o = (ProvisionComponent) other_;
1871        return compareValues(type, o.type, true);
1872      }
1873
1874      public boolean isEmpty() {
1875        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, period, actor, action
1876          , securityLabel, purpose, documentType, resourceType, code, dataPeriod, data, expression
1877          , provision);
1878      }
1879
1880  public String fhirType() {
1881    return "Consent.provision";
1882
1883  }
1884
1885  }
1886
1887    @Block()
1888    public static class ProvisionActorComponent extends BackboneElement implements IBaseBackboneElement {
1889        /**
1890         * How the individual is involved in the resources content that is described in the exception.
1891         */
1892        @Child(name = "role", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1893        @Description(shortDefinition="How the actor is involved", formalDefinition="How the individual is involved in the resources content that is described in the exception." )
1894        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participation-role-type")
1895        protected CodeableConcept role;
1896
1897        /**
1898         * The resource that identifies the actor. To identify actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').
1899         */
1900        @Child(name = "reference", type = {Device.class, Group.class, CareTeam.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, PractitionerRole.class}, order=2, min=0, max=1, modifier=false, summary=false)
1901        @Description(shortDefinition="Resource for the actor (or group, by role)", formalDefinition="The resource that identifies the actor. To identify actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers')." )
1902        protected Reference reference;
1903
1904        private static final long serialVersionUID = -1992921787L;
1905
1906    /**
1907     * Constructor
1908     */
1909      public ProvisionActorComponent() {
1910        super();
1911      }
1912
1913        /**
1914         * @return {@link #role} (How the individual is involved in the resources content that is described in the exception.)
1915         */
1916        public CodeableConcept getRole() { 
1917          if (this.role == null)
1918            if (Configuration.errorOnAutoCreate())
1919              throw new Error("Attempt to auto-create ProvisionActorComponent.role");
1920            else if (Configuration.doAutoCreate())
1921              this.role = new CodeableConcept(); // cc
1922          return this.role;
1923        }
1924
1925        public boolean hasRole() { 
1926          return this.role != null && !this.role.isEmpty();
1927        }
1928
1929        /**
1930         * @param value {@link #role} (How the individual is involved in the resources content that is described in the exception.)
1931         */
1932        public ProvisionActorComponent setRole(CodeableConcept value) { 
1933          this.role = value;
1934          return this;
1935        }
1936
1937        /**
1938         * @return {@link #reference} (The resource that identifies the actor. To identify actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').)
1939         */
1940        public Reference getReference() { 
1941          if (this.reference == null)
1942            if (Configuration.errorOnAutoCreate())
1943              throw new Error("Attempt to auto-create ProvisionActorComponent.reference");
1944            else if (Configuration.doAutoCreate())
1945              this.reference = new Reference(); // cc
1946          return this.reference;
1947        }
1948
1949        public boolean hasReference() { 
1950          return this.reference != null && !this.reference.isEmpty();
1951        }
1952
1953        /**
1954         * @param value {@link #reference} (The resource that identifies the actor. To identify actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').)
1955         */
1956        public ProvisionActorComponent setReference(Reference value) { 
1957          this.reference = value;
1958          return this;
1959        }
1960
1961        protected void listChildren(List<Property> children) {
1962          super.listChildren(children);
1963          children.add(new Property("role", "CodeableConcept", "How the individual is involved in the resources content that is described in the exception.", 0, 1, role));
1964          children.add(new Property("reference", "Reference(Device|Group|CareTeam|Organization|Patient|Practitioner|RelatedPerson|PractitionerRole)", "The resource that identifies the actor. To identify actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').", 0, 1, reference));
1965        }
1966
1967        @Override
1968        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1969          switch (_hash) {
1970          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "How the individual is involved in the resources content that is described in the exception.", 0, 1, role);
1971          case -925155509: /*reference*/  return new Property("reference", "Reference(Device|Group|CareTeam|Organization|Patient|Practitioner|RelatedPerson|PractitionerRole)", "The resource that identifies the actor. To identify actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').", 0, 1, reference);
1972          default: return super.getNamedProperty(_hash, _name, _checkValid);
1973          }
1974
1975        }
1976
1977      @Override
1978      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1979        switch (hash) {
1980        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1981        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
1982        default: return super.getProperty(hash, name, checkValid);
1983        }
1984
1985      }
1986
1987      @Override
1988      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1989        switch (hash) {
1990        case 3506294: // role
1991          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1992          return value;
1993        case -925155509: // reference
1994          this.reference = TypeConvertor.castToReference(value); // Reference
1995          return value;
1996        default: return super.setProperty(hash, name, value);
1997        }
1998
1999      }
2000
2001      @Override
2002      public Base setProperty(String name, Base value) throws FHIRException {
2003        if (name.equals("role")) {
2004          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2005        } else if (name.equals("reference")) {
2006          this.reference = TypeConvertor.castToReference(value); // Reference
2007        } else
2008          return super.setProperty(name, value);
2009        return value;
2010      }
2011
2012      @Override
2013      public Base makeProperty(int hash, String name) throws FHIRException {
2014        switch (hash) {
2015        case 3506294:  return getRole();
2016        case -925155509:  return getReference();
2017        default: return super.makeProperty(hash, name);
2018        }
2019
2020      }
2021
2022      @Override
2023      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2024        switch (hash) {
2025        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
2026        case -925155509: /*reference*/ return new String[] {"Reference"};
2027        default: return super.getTypesForProperty(hash, name);
2028        }
2029
2030      }
2031
2032      @Override
2033      public Base addChild(String name) throws FHIRException {
2034        if (name.equals("role")) {
2035          this.role = new CodeableConcept();
2036          return this.role;
2037        }
2038        else if (name.equals("reference")) {
2039          this.reference = new Reference();
2040          return this.reference;
2041        }
2042        else
2043          return super.addChild(name);
2044      }
2045
2046      public ProvisionActorComponent copy() {
2047        ProvisionActorComponent dst = new ProvisionActorComponent();
2048        copyValues(dst);
2049        return dst;
2050      }
2051
2052      public void copyValues(ProvisionActorComponent dst) {
2053        super.copyValues(dst);
2054        dst.role = role == null ? null : role.copy();
2055        dst.reference = reference == null ? null : reference.copy();
2056      }
2057
2058      @Override
2059      public boolean equalsDeep(Base other_) {
2060        if (!super.equalsDeep(other_))
2061          return false;
2062        if (!(other_ instanceof ProvisionActorComponent))
2063          return false;
2064        ProvisionActorComponent o = (ProvisionActorComponent) other_;
2065        return compareDeep(role, o.role, true) && compareDeep(reference, o.reference, true);
2066      }
2067
2068      @Override
2069      public boolean equalsShallow(Base other_) {
2070        if (!super.equalsShallow(other_))
2071          return false;
2072        if (!(other_ instanceof ProvisionActorComponent))
2073          return false;
2074        ProvisionActorComponent o = (ProvisionActorComponent) other_;
2075        return true;
2076      }
2077
2078      public boolean isEmpty() {
2079        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, reference);
2080      }
2081
2082  public String fhirType() {
2083    return "Consent.provision.actor";
2084
2085  }
2086
2087  }
2088
2089    @Block()
2090    public static class ProvisionDataComponent extends BackboneElement implements IBaseBackboneElement {
2091        /**
2092         * How the resource reference is interpreted when testing consent restrictions.
2093         */
2094        @Child(name = "meaning", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2095        @Description(shortDefinition="instance | related | dependents | authoredby", formalDefinition="How the resource reference is interpreted when testing consent restrictions." )
2096        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-data-meaning")
2097        protected Enumeration<ConsentDataMeaning> meaning;
2098
2099        /**
2100         * A reference to a specific resource that defines which resources are covered by this consent.
2101         */
2102        @Child(name = "reference", type = {Reference.class}, order=2, min=1, max=1, modifier=false, summary=true)
2103        @Description(shortDefinition="The actual data reference", formalDefinition="A reference to a specific resource that defines which resources are covered by this consent." )
2104        protected Reference reference;
2105
2106        private static final long serialVersionUID = 1735979153L;
2107
2108    /**
2109     * Constructor
2110     */
2111      public ProvisionDataComponent() {
2112        super();
2113      }
2114
2115    /**
2116     * Constructor
2117     */
2118      public ProvisionDataComponent(ConsentDataMeaning meaning, Reference reference) {
2119        super();
2120        this.setMeaning(meaning);
2121        this.setReference(reference);
2122      }
2123
2124        /**
2125         * @return {@link #meaning} (How the resource reference is interpreted when testing consent restrictions.). This is the underlying object with id, value and extensions. The accessor "getMeaning" gives direct access to the value
2126         */
2127        public Enumeration<ConsentDataMeaning> getMeaningElement() { 
2128          if (this.meaning == null)
2129            if (Configuration.errorOnAutoCreate())
2130              throw new Error("Attempt to auto-create ProvisionDataComponent.meaning");
2131            else if (Configuration.doAutoCreate())
2132              this.meaning = new Enumeration<ConsentDataMeaning>(new ConsentDataMeaningEnumFactory()); // bb
2133          return this.meaning;
2134        }
2135
2136        public boolean hasMeaningElement() { 
2137          return this.meaning != null && !this.meaning.isEmpty();
2138        }
2139
2140        public boolean hasMeaning() { 
2141          return this.meaning != null && !this.meaning.isEmpty();
2142        }
2143
2144        /**
2145         * @param value {@link #meaning} (How the resource reference is interpreted when testing consent restrictions.). This is the underlying object with id, value and extensions. The accessor "getMeaning" gives direct access to the value
2146         */
2147        public ProvisionDataComponent setMeaningElement(Enumeration<ConsentDataMeaning> value) { 
2148          this.meaning = value;
2149          return this;
2150        }
2151
2152        /**
2153         * @return How the resource reference is interpreted when testing consent restrictions.
2154         */
2155        public ConsentDataMeaning getMeaning() { 
2156          return this.meaning == null ? null : this.meaning.getValue();
2157        }
2158
2159        /**
2160         * @param value How the resource reference is interpreted when testing consent restrictions.
2161         */
2162        public ProvisionDataComponent setMeaning(ConsentDataMeaning value) { 
2163            if (this.meaning == null)
2164              this.meaning = new Enumeration<ConsentDataMeaning>(new ConsentDataMeaningEnumFactory());
2165            this.meaning.setValue(value);
2166          return this;
2167        }
2168
2169        /**
2170         * @return {@link #reference} (A reference to a specific resource that defines which resources are covered by this consent.)
2171         */
2172        public Reference getReference() { 
2173          if (this.reference == null)
2174            if (Configuration.errorOnAutoCreate())
2175              throw new Error("Attempt to auto-create ProvisionDataComponent.reference");
2176            else if (Configuration.doAutoCreate())
2177              this.reference = new Reference(); // cc
2178          return this.reference;
2179        }
2180
2181        public boolean hasReference() { 
2182          return this.reference != null && !this.reference.isEmpty();
2183        }
2184
2185        /**
2186         * @param value {@link #reference} (A reference to a specific resource that defines which resources are covered by this consent.)
2187         */
2188        public ProvisionDataComponent setReference(Reference value) { 
2189          this.reference = value;
2190          return this;
2191        }
2192
2193        protected void listChildren(List<Property> children) {
2194          super.listChildren(children);
2195          children.add(new Property("meaning", "code", "How the resource reference is interpreted when testing consent restrictions.", 0, 1, meaning));
2196          children.add(new Property("reference", "Reference(Any)", "A reference to a specific resource that defines which resources are covered by this consent.", 0, 1, reference));
2197        }
2198
2199        @Override
2200        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2201          switch (_hash) {
2202          case 938160637: /*meaning*/  return new Property("meaning", "code", "How the resource reference is interpreted when testing consent restrictions.", 0, 1, meaning);
2203          case -925155509: /*reference*/  return new Property("reference", "Reference(Any)", "A reference to a specific resource that defines which resources are covered by this consent.", 0, 1, reference);
2204          default: return super.getNamedProperty(_hash, _name, _checkValid);
2205          }
2206
2207        }
2208
2209      @Override
2210      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2211        switch (hash) {
2212        case 938160637: /*meaning*/ return this.meaning == null ? new Base[0] : new Base[] {this.meaning}; // Enumeration<ConsentDataMeaning>
2213        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
2214        default: return super.getProperty(hash, name, checkValid);
2215        }
2216
2217      }
2218
2219      @Override
2220      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2221        switch (hash) {
2222        case 938160637: // meaning
2223          value = new ConsentDataMeaningEnumFactory().fromType(TypeConvertor.castToCode(value));
2224          this.meaning = (Enumeration) value; // Enumeration<ConsentDataMeaning>
2225          return value;
2226        case -925155509: // reference
2227          this.reference = TypeConvertor.castToReference(value); // Reference
2228          return value;
2229        default: return super.setProperty(hash, name, value);
2230        }
2231
2232      }
2233
2234      @Override
2235      public Base setProperty(String name, Base value) throws FHIRException {
2236        if (name.equals("meaning")) {
2237          value = new ConsentDataMeaningEnumFactory().fromType(TypeConvertor.castToCode(value));
2238          this.meaning = (Enumeration) value; // Enumeration<ConsentDataMeaning>
2239        } else if (name.equals("reference")) {
2240          this.reference = TypeConvertor.castToReference(value); // Reference
2241        } else
2242          return super.setProperty(name, value);
2243        return value;
2244      }
2245
2246      @Override
2247      public Base makeProperty(int hash, String name) throws FHIRException {
2248        switch (hash) {
2249        case 938160637:  return getMeaningElement();
2250        case -925155509:  return getReference();
2251        default: return super.makeProperty(hash, name);
2252        }
2253
2254      }
2255
2256      @Override
2257      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2258        switch (hash) {
2259        case 938160637: /*meaning*/ return new String[] {"code"};
2260        case -925155509: /*reference*/ return new String[] {"Reference"};
2261        default: return super.getTypesForProperty(hash, name);
2262        }
2263
2264      }
2265
2266      @Override
2267      public Base addChild(String name) throws FHIRException {
2268        if (name.equals("meaning")) {
2269          throw new FHIRException("Cannot call addChild on a primitive type Consent.provision.data.meaning");
2270        }
2271        else if (name.equals("reference")) {
2272          this.reference = new Reference();
2273          return this.reference;
2274        }
2275        else
2276          return super.addChild(name);
2277      }
2278
2279      public ProvisionDataComponent copy() {
2280        ProvisionDataComponent dst = new ProvisionDataComponent();
2281        copyValues(dst);
2282        return dst;
2283      }
2284
2285      public void copyValues(ProvisionDataComponent dst) {
2286        super.copyValues(dst);
2287        dst.meaning = meaning == null ? null : meaning.copy();
2288        dst.reference = reference == null ? null : reference.copy();
2289      }
2290
2291      @Override
2292      public boolean equalsDeep(Base other_) {
2293        if (!super.equalsDeep(other_))
2294          return false;
2295        if (!(other_ instanceof ProvisionDataComponent))
2296          return false;
2297        ProvisionDataComponent o = (ProvisionDataComponent) other_;
2298        return compareDeep(meaning, o.meaning, true) && compareDeep(reference, o.reference, true);
2299      }
2300
2301      @Override
2302      public boolean equalsShallow(Base other_) {
2303        if (!super.equalsShallow(other_))
2304          return false;
2305        if (!(other_ instanceof ProvisionDataComponent))
2306          return false;
2307        ProvisionDataComponent o = (ProvisionDataComponent) other_;
2308        return compareValues(meaning, o.meaning, true);
2309      }
2310
2311      public boolean isEmpty() {
2312        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(meaning, reference);
2313      }
2314
2315  public String fhirType() {
2316    return "Consent.provision.data";
2317
2318  }
2319
2320  }
2321
2322    /**
2323     * Unique identifier for this copy of the Consent Statement.
2324     */
2325    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2326    @Description(shortDefinition="Identifier for this record (external references)", formalDefinition="Unique identifier for this copy of the Consent Statement." )
2327    protected List<Identifier> identifier;
2328
2329    /**
2330     * Indicates the current state of this Consent resource.
2331     */
2332    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
2333    @Description(shortDefinition="draft | active | inactive | not-done | entered-in-error | unknown", formalDefinition="Indicates the current state of this Consent resource." )
2334    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-state-codes")
2335    protected Enumeration<ConsentState> status;
2336
2337    /**
2338     * A classification of the type of consents found in the statement. This element supports indexing and retrieval of consent statements.
2339     */
2340    @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2341    @Description(shortDefinition="Classification of the consent statement - for indexing/retrieval", formalDefinition="A classification of the type of consents found in the statement. This element supports indexing and retrieval of consent statements." )
2342    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-category")
2343    protected List<CodeableConcept> category;
2344
2345    /**
2346     * The patient/healthcare practitioner or group of persons to whom this consent applies.
2347     */
2348    @Child(name = "subject", type = {Patient.class, Practitioner.class, Group.class}, order=3, min=0, max=1, modifier=false, summary=true)
2349    @Description(shortDefinition="Who the consent applies to", formalDefinition="The patient/healthcare practitioner or group of persons to whom this consent applies." )
2350    protected Reference subject;
2351
2352    /**
2353     * Date the consent instance was agreed to.
2354     */
2355    @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=true)
2356    @Description(shortDefinition="Fully executed date of the consent", formalDefinition="Date the consent instance was agreed to." )
2357    protected DateType date;
2358
2359    /**
2360     * Effective period for this Consent Resource and all provisions unless specified in that provision.
2361     */
2362    @Child(name = "period", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=true)
2363    @Description(shortDefinition="Effective period for this Consent", formalDefinition="Effective period for this Consent Resource and all provisions unless specified in that provision." )
2364    protected Period period;
2365
2366    /**
2367     * The entity responsible for granting the rights listed in a Consent Directive.
2368     */
2369    @Child(name = "grantor", type = {CareTeam.class, HealthcareService.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, PractitionerRole.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2370    @Description(shortDefinition="Who is granting rights according to the policy and rules", formalDefinition="The entity responsible for granting the rights listed in a Consent Directive." )
2371    protected List<Reference> grantor;
2372
2373    /**
2374     * The entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.
2375     */
2376    @Child(name = "grantee", type = {CareTeam.class, HealthcareService.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, PractitionerRole.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2377    @Description(shortDefinition="Who is agreeing to the policy and rules", formalDefinition="The entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions." )
2378    protected List<Reference> grantee;
2379
2380    /**
2381     * The actor that manages the consent through its lifecycle.
2382     */
2383    @Child(name = "manager", type = {HealthcareService.class, Organization.class, Patient.class, Practitioner.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2384    @Description(shortDefinition="Consent workflow management", formalDefinition="The actor that manages the consent through its lifecycle." )
2385    protected List<Reference> manager;
2386
2387    /**
2388     * The actor that controls/enforces the access according to the consent.
2389     */
2390    @Child(name = "controller", type = {HealthcareService.class, Organization.class, Patient.class, Practitioner.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2391    @Description(shortDefinition="Consent Enforcer", formalDefinition="The actor that controls/enforces the access according to the consent." )
2392    protected List<Reference> controller;
2393
2394    /**
2395     * The source on which this consent statement is based. The source might be a scanned original paper form.
2396     */
2397    @Child(name = "sourceAttachment", type = {Attachment.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2398    @Description(shortDefinition="Source from which this consent is taken", formalDefinition="The source on which this consent statement is based. The source might be a scanned original paper form." )
2399    protected List<Attachment> sourceAttachment;
2400
2401    /**
2402     * A reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document.
2403     */
2404    @Child(name = "sourceReference", type = {Consent.class, DocumentReference.class, Contract.class, QuestionnaireResponse.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2405    @Description(shortDefinition="Source from which this consent is taken", formalDefinition="A reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document." )
2406    protected List<Reference> sourceReference;
2407
2408    /**
2409     * A set of codes that indicate the regulatory basis (if any) that this consent supports.
2410     */
2411    @Child(name = "regulatoryBasis", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2412    @Description(shortDefinition="Regulations establishing base Consent", formalDefinition="A set of codes that indicate the regulatory basis (if any) that this consent supports." )
2413    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consent-policy")
2414    protected List<CodeableConcept> regulatoryBasis;
2415
2416    /**
2417     * A Reference or URL used to uniquely identify the policy the organization will enforce for this Consent. This Reference or URL should be specific to the version of the policy and should be dereferencable to a computable policy of some form.
2418     */
2419    @Child(name = "policyBasis", type = {}, order=13, min=0, max=1, modifier=false, summary=false)
2420    @Description(shortDefinition="Computable version of the backing policy", formalDefinition="A Reference or URL used to uniquely identify the policy the organization will enforce for this Consent. This Reference or URL should be specific to the version of the policy and should be dereferencable to a computable policy of some form." )
2421    protected ConsentPolicyBasisComponent policyBasis;
2422
2423    /**
2424     * A Reference to the human readable policy explaining the basis for the Consent.
2425     */
2426    @Child(name = "policyText", type = {DocumentReference.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2427    @Description(shortDefinition="Human Readable Policy", formalDefinition="A Reference to the human readable policy explaining the basis for the Consent." )
2428    protected List<Reference> policyText;
2429
2430    /**
2431     * Whether a treatment instruction (e.g. artificial respiration: yes or no) was verified with the patient, his/her family or another authorized person.
2432     */
2433    @Child(name = "verification", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2434    @Description(shortDefinition="Consent Verified by patient or family", formalDefinition="Whether a treatment instruction (e.g. artificial respiration: yes or no) was verified with the patient, his/her family or another authorized person." )
2435    protected List<ConsentVerificationComponent> verification;
2436
2437    /**
2438     * An exception to the base policy of this consent. An exception can be an addition or removal of access permissions.
2439     */
2440    @Child(name = "provision", type = {}, order=16, min=0, max=1, modifier=false, summary=true)
2441    @Description(shortDefinition="Constraints to the base Consent.policyRule/Consent.policy", formalDefinition="An exception to the base policy of this consent. An exception can be an addition or removal of access permissions." )
2442    protected ProvisionComponent provision;
2443
2444    private static final long serialVersionUID = -1425171494L;
2445
2446  /**
2447   * Constructor
2448   */
2449    public Consent() {
2450      super();
2451    }
2452
2453  /**
2454   * Constructor
2455   */
2456    public Consent(ConsentState status) {
2457      super();
2458      this.setStatus(status);
2459    }
2460
2461    /**
2462     * @return {@link #identifier} (Unique identifier for this copy of the Consent Statement.)
2463     */
2464    public List<Identifier> getIdentifier() { 
2465      if (this.identifier == null)
2466        this.identifier = new ArrayList<Identifier>();
2467      return this.identifier;
2468    }
2469
2470    /**
2471     * @return Returns a reference to <code>this</code> for easy method chaining
2472     */
2473    public Consent setIdentifier(List<Identifier> theIdentifier) { 
2474      this.identifier = theIdentifier;
2475      return this;
2476    }
2477
2478    public boolean hasIdentifier() { 
2479      if (this.identifier == null)
2480        return false;
2481      for (Identifier item : this.identifier)
2482        if (!item.isEmpty())
2483          return true;
2484      return false;
2485    }
2486
2487    public Identifier addIdentifier() { //3
2488      Identifier t = new Identifier();
2489      if (this.identifier == null)
2490        this.identifier = new ArrayList<Identifier>();
2491      this.identifier.add(t);
2492      return t;
2493    }
2494
2495    public Consent addIdentifier(Identifier t) { //3
2496      if (t == null)
2497        return this;
2498      if (this.identifier == null)
2499        this.identifier = new ArrayList<Identifier>();
2500      this.identifier.add(t);
2501      return this;
2502    }
2503
2504    /**
2505     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
2506     */
2507    public Identifier getIdentifierFirstRep() { 
2508      if (getIdentifier().isEmpty()) {
2509        addIdentifier();
2510      }
2511      return getIdentifier().get(0);
2512    }
2513
2514    /**
2515     * @return {@link #status} (Indicates the current state of this Consent resource.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2516     */
2517    public Enumeration<ConsentState> getStatusElement() { 
2518      if (this.status == null)
2519        if (Configuration.errorOnAutoCreate())
2520          throw new Error("Attempt to auto-create Consent.status");
2521        else if (Configuration.doAutoCreate())
2522          this.status = new Enumeration<ConsentState>(new ConsentStateEnumFactory()); // bb
2523      return this.status;
2524    }
2525
2526    public boolean hasStatusElement() { 
2527      return this.status != null && !this.status.isEmpty();
2528    }
2529
2530    public boolean hasStatus() { 
2531      return this.status != null && !this.status.isEmpty();
2532    }
2533
2534    /**
2535     * @param value {@link #status} (Indicates the current state of this Consent resource.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2536     */
2537    public Consent setStatusElement(Enumeration<ConsentState> value) { 
2538      this.status = value;
2539      return this;
2540    }
2541
2542    /**
2543     * @return Indicates the current state of this Consent resource.
2544     */
2545    public ConsentState getStatus() { 
2546      return this.status == null ? null : this.status.getValue();
2547    }
2548
2549    /**
2550     * @param value Indicates the current state of this Consent resource.
2551     */
2552    public Consent setStatus(ConsentState value) { 
2553        if (this.status == null)
2554          this.status = new Enumeration<ConsentState>(new ConsentStateEnumFactory());
2555        this.status.setValue(value);
2556      return this;
2557    }
2558
2559    /**
2560     * @return {@link #category} (A classification of the type of consents found in the statement. This element supports indexing and retrieval of consent statements.)
2561     */
2562    public List<CodeableConcept> getCategory() { 
2563      if (this.category == null)
2564        this.category = new ArrayList<CodeableConcept>();
2565      return this.category;
2566    }
2567
2568    /**
2569     * @return Returns a reference to <code>this</code> for easy method chaining
2570     */
2571    public Consent setCategory(List<CodeableConcept> theCategory) { 
2572      this.category = theCategory;
2573      return this;
2574    }
2575
2576    public boolean hasCategory() { 
2577      if (this.category == null)
2578        return false;
2579      for (CodeableConcept item : this.category)
2580        if (!item.isEmpty())
2581          return true;
2582      return false;
2583    }
2584
2585    public CodeableConcept addCategory() { //3
2586      CodeableConcept t = new CodeableConcept();
2587      if (this.category == null)
2588        this.category = new ArrayList<CodeableConcept>();
2589      this.category.add(t);
2590      return t;
2591    }
2592
2593    public Consent addCategory(CodeableConcept t) { //3
2594      if (t == null)
2595        return this;
2596      if (this.category == null)
2597        this.category = new ArrayList<CodeableConcept>();
2598      this.category.add(t);
2599      return this;
2600    }
2601
2602    /**
2603     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
2604     */
2605    public CodeableConcept getCategoryFirstRep() { 
2606      if (getCategory().isEmpty()) {
2607        addCategory();
2608      }
2609      return getCategory().get(0);
2610    }
2611
2612    /**
2613     * @return {@link #subject} (The patient/healthcare practitioner or group of persons to whom this consent applies.)
2614     */
2615    public Reference getSubject() { 
2616      if (this.subject == null)
2617        if (Configuration.errorOnAutoCreate())
2618          throw new Error("Attempt to auto-create Consent.subject");
2619        else if (Configuration.doAutoCreate())
2620          this.subject = new Reference(); // cc
2621      return this.subject;
2622    }
2623
2624    public boolean hasSubject() { 
2625      return this.subject != null && !this.subject.isEmpty();
2626    }
2627
2628    /**
2629     * @param value {@link #subject} (The patient/healthcare practitioner or group of persons to whom this consent applies.)
2630     */
2631    public Consent setSubject(Reference value) { 
2632      this.subject = value;
2633      return this;
2634    }
2635
2636    /**
2637     * @return {@link #date} (Date the consent instance was agreed to.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2638     */
2639    public DateType getDateElement() { 
2640      if (this.date == null)
2641        if (Configuration.errorOnAutoCreate())
2642          throw new Error("Attempt to auto-create Consent.date");
2643        else if (Configuration.doAutoCreate())
2644          this.date = new DateType(); // bb
2645      return this.date;
2646    }
2647
2648    public boolean hasDateElement() { 
2649      return this.date != null && !this.date.isEmpty();
2650    }
2651
2652    public boolean hasDate() { 
2653      return this.date != null && !this.date.isEmpty();
2654    }
2655
2656    /**
2657     * @param value {@link #date} (Date the consent instance was agreed to.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2658     */
2659    public Consent setDateElement(DateType value) { 
2660      this.date = value;
2661      return this;
2662    }
2663
2664    /**
2665     * @return Date the consent instance was agreed to.
2666     */
2667    public Date getDate() { 
2668      return this.date == null ? null : this.date.getValue();
2669    }
2670
2671    /**
2672     * @param value Date the consent instance was agreed to.
2673     */
2674    public Consent setDate(Date value) { 
2675      if (value == null)
2676        this.date = null;
2677      else {
2678        if (this.date == null)
2679          this.date = new DateType();
2680        this.date.setValue(value);
2681      }
2682      return this;
2683    }
2684
2685    /**
2686     * @return {@link #period} (Effective period for this Consent Resource and all provisions unless specified in that provision.)
2687     */
2688    public Period getPeriod() { 
2689      if (this.period == null)
2690        if (Configuration.errorOnAutoCreate())
2691          throw new Error("Attempt to auto-create Consent.period");
2692        else if (Configuration.doAutoCreate())
2693          this.period = new Period(); // cc
2694      return this.period;
2695    }
2696
2697    public boolean hasPeriod() { 
2698      return this.period != null && !this.period.isEmpty();
2699    }
2700
2701    /**
2702     * @param value {@link #period} (Effective period for this Consent Resource and all provisions unless specified in that provision.)
2703     */
2704    public Consent setPeriod(Period value) { 
2705      this.period = value;
2706      return this;
2707    }
2708
2709    /**
2710     * @return {@link #grantor} (The entity responsible for granting the rights listed in a Consent Directive.)
2711     */
2712    public List<Reference> getGrantor() { 
2713      if (this.grantor == null)
2714        this.grantor = new ArrayList<Reference>();
2715      return this.grantor;
2716    }
2717
2718    /**
2719     * @return Returns a reference to <code>this</code> for easy method chaining
2720     */
2721    public Consent setGrantor(List<Reference> theGrantor) { 
2722      this.grantor = theGrantor;
2723      return this;
2724    }
2725
2726    public boolean hasGrantor() { 
2727      if (this.grantor == null)
2728        return false;
2729      for (Reference item : this.grantor)
2730        if (!item.isEmpty())
2731          return true;
2732      return false;
2733    }
2734
2735    public Reference addGrantor() { //3
2736      Reference t = new Reference();
2737      if (this.grantor == null)
2738        this.grantor = new ArrayList<Reference>();
2739      this.grantor.add(t);
2740      return t;
2741    }
2742
2743    public Consent addGrantor(Reference t) { //3
2744      if (t == null)
2745        return this;
2746      if (this.grantor == null)
2747        this.grantor = new ArrayList<Reference>();
2748      this.grantor.add(t);
2749      return this;
2750    }
2751
2752    /**
2753     * @return The first repetition of repeating field {@link #grantor}, creating it if it does not already exist {3}
2754     */
2755    public Reference getGrantorFirstRep() { 
2756      if (getGrantor().isEmpty()) {
2757        addGrantor();
2758      }
2759      return getGrantor().get(0);
2760    }
2761
2762    /**
2763     * @return {@link #grantee} (The entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.)
2764     */
2765    public List<Reference> getGrantee() { 
2766      if (this.grantee == null)
2767        this.grantee = new ArrayList<Reference>();
2768      return this.grantee;
2769    }
2770
2771    /**
2772     * @return Returns a reference to <code>this</code> for easy method chaining
2773     */
2774    public Consent setGrantee(List<Reference> theGrantee) { 
2775      this.grantee = theGrantee;
2776      return this;
2777    }
2778
2779    public boolean hasGrantee() { 
2780      if (this.grantee == null)
2781        return false;
2782      for (Reference item : this.grantee)
2783        if (!item.isEmpty())
2784          return true;
2785      return false;
2786    }
2787
2788    public Reference addGrantee() { //3
2789      Reference t = new Reference();
2790      if (this.grantee == null)
2791        this.grantee = new ArrayList<Reference>();
2792      this.grantee.add(t);
2793      return t;
2794    }
2795
2796    public Consent addGrantee(Reference t) { //3
2797      if (t == null)
2798        return this;
2799      if (this.grantee == null)
2800        this.grantee = new ArrayList<Reference>();
2801      this.grantee.add(t);
2802      return this;
2803    }
2804
2805    /**
2806     * @return The first repetition of repeating field {@link #grantee}, creating it if it does not already exist {3}
2807     */
2808    public Reference getGranteeFirstRep() { 
2809      if (getGrantee().isEmpty()) {
2810        addGrantee();
2811      }
2812      return getGrantee().get(0);
2813    }
2814
2815    /**
2816     * @return {@link #manager} (The actor that manages the consent through its lifecycle.)
2817     */
2818    public List<Reference> getManager() { 
2819      if (this.manager == null)
2820        this.manager = new ArrayList<Reference>();
2821      return this.manager;
2822    }
2823
2824    /**
2825     * @return Returns a reference to <code>this</code> for easy method chaining
2826     */
2827    public Consent setManager(List<Reference> theManager) { 
2828      this.manager = theManager;
2829      return this;
2830    }
2831
2832    public boolean hasManager() { 
2833      if (this.manager == null)
2834        return false;
2835      for (Reference item : this.manager)
2836        if (!item.isEmpty())
2837          return true;
2838      return false;
2839    }
2840
2841    public Reference addManager() { //3
2842      Reference t = new Reference();
2843      if (this.manager == null)
2844        this.manager = new ArrayList<Reference>();
2845      this.manager.add(t);
2846      return t;
2847    }
2848
2849    public Consent addManager(Reference t) { //3
2850      if (t == null)
2851        return this;
2852      if (this.manager == null)
2853        this.manager = new ArrayList<Reference>();
2854      this.manager.add(t);
2855      return this;
2856    }
2857
2858    /**
2859     * @return The first repetition of repeating field {@link #manager}, creating it if it does not already exist {3}
2860     */
2861    public Reference getManagerFirstRep() { 
2862      if (getManager().isEmpty()) {
2863        addManager();
2864      }
2865      return getManager().get(0);
2866    }
2867
2868    /**
2869     * @return {@link #controller} (The actor that controls/enforces the access according to the consent.)
2870     */
2871    public List<Reference> getController() { 
2872      if (this.controller == null)
2873        this.controller = new ArrayList<Reference>();
2874      return this.controller;
2875    }
2876
2877    /**
2878     * @return Returns a reference to <code>this</code> for easy method chaining
2879     */
2880    public Consent setController(List<Reference> theController) { 
2881      this.controller = theController;
2882      return this;
2883    }
2884
2885    public boolean hasController() { 
2886      if (this.controller == null)
2887        return false;
2888      for (Reference item : this.controller)
2889        if (!item.isEmpty())
2890          return true;
2891      return false;
2892    }
2893
2894    public Reference addController() { //3
2895      Reference t = new Reference();
2896      if (this.controller == null)
2897        this.controller = new ArrayList<Reference>();
2898      this.controller.add(t);
2899      return t;
2900    }
2901
2902    public Consent addController(Reference t) { //3
2903      if (t == null)
2904        return this;
2905      if (this.controller == null)
2906        this.controller = new ArrayList<Reference>();
2907      this.controller.add(t);
2908      return this;
2909    }
2910
2911    /**
2912     * @return The first repetition of repeating field {@link #controller}, creating it if it does not already exist {3}
2913     */
2914    public Reference getControllerFirstRep() { 
2915      if (getController().isEmpty()) {
2916        addController();
2917      }
2918      return getController().get(0);
2919    }
2920
2921    /**
2922     * @return {@link #sourceAttachment} (The source on which this consent statement is based. The source might be a scanned original paper form.)
2923     */
2924    public List<Attachment> getSourceAttachment() { 
2925      if (this.sourceAttachment == null)
2926        this.sourceAttachment = new ArrayList<Attachment>();
2927      return this.sourceAttachment;
2928    }
2929
2930    /**
2931     * @return Returns a reference to <code>this</code> for easy method chaining
2932     */
2933    public Consent setSourceAttachment(List<Attachment> theSourceAttachment) { 
2934      this.sourceAttachment = theSourceAttachment;
2935      return this;
2936    }
2937
2938    public boolean hasSourceAttachment() { 
2939      if (this.sourceAttachment == null)
2940        return false;
2941      for (Attachment item : this.sourceAttachment)
2942        if (!item.isEmpty())
2943          return true;
2944      return false;
2945    }
2946
2947    public Attachment addSourceAttachment() { //3
2948      Attachment t = new Attachment();
2949      if (this.sourceAttachment == null)
2950        this.sourceAttachment = new ArrayList<Attachment>();
2951      this.sourceAttachment.add(t);
2952      return t;
2953    }
2954
2955    public Consent addSourceAttachment(Attachment t) { //3
2956      if (t == null)
2957        return this;
2958      if (this.sourceAttachment == null)
2959        this.sourceAttachment = new ArrayList<Attachment>();
2960      this.sourceAttachment.add(t);
2961      return this;
2962    }
2963
2964    /**
2965     * @return The first repetition of repeating field {@link #sourceAttachment}, creating it if it does not already exist {3}
2966     */
2967    public Attachment getSourceAttachmentFirstRep() { 
2968      if (getSourceAttachment().isEmpty()) {
2969        addSourceAttachment();
2970      }
2971      return getSourceAttachment().get(0);
2972    }
2973
2974    /**
2975     * @return {@link #sourceReference} (A reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document.)
2976     */
2977    public List<Reference> getSourceReference() { 
2978      if (this.sourceReference == null)
2979        this.sourceReference = new ArrayList<Reference>();
2980      return this.sourceReference;
2981    }
2982
2983    /**
2984     * @return Returns a reference to <code>this</code> for easy method chaining
2985     */
2986    public Consent setSourceReference(List<Reference> theSourceReference) { 
2987      this.sourceReference = theSourceReference;
2988      return this;
2989    }
2990
2991    public boolean hasSourceReference() { 
2992      if (this.sourceReference == null)
2993        return false;
2994      for (Reference item : this.sourceReference)
2995        if (!item.isEmpty())
2996          return true;
2997      return false;
2998    }
2999
3000    public Reference addSourceReference() { //3
3001      Reference t = new Reference();
3002      if (this.sourceReference == null)
3003        this.sourceReference = new ArrayList<Reference>();
3004      this.sourceReference.add(t);
3005      return t;
3006    }
3007
3008    public Consent addSourceReference(Reference t) { //3
3009      if (t == null)
3010        return this;
3011      if (this.sourceReference == null)
3012        this.sourceReference = new ArrayList<Reference>();
3013      this.sourceReference.add(t);
3014      return this;
3015    }
3016
3017    /**
3018     * @return The first repetition of repeating field {@link #sourceReference}, creating it if it does not already exist {3}
3019     */
3020    public Reference getSourceReferenceFirstRep() { 
3021      if (getSourceReference().isEmpty()) {
3022        addSourceReference();
3023      }
3024      return getSourceReference().get(0);
3025    }
3026
3027    /**
3028     * @return {@link #regulatoryBasis} (A set of codes that indicate the regulatory basis (if any) that this consent supports.)
3029     */
3030    public List<CodeableConcept> getRegulatoryBasis() { 
3031      if (this.regulatoryBasis == null)
3032        this.regulatoryBasis = new ArrayList<CodeableConcept>();
3033      return this.regulatoryBasis;
3034    }
3035
3036    /**
3037     * @return Returns a reference to <code>this</code> for easy method chaining
3038     */
3039    public Consent setRegulatoryBasis(List<CodeableConcept> theRegulatoryBasis) { 
3040      this.regulatoryBasis = theRegulatoryBasis;
3041      return this;
3042    }
3043
3044    public boolean hasRegulatoryBasis() { 
3045      if (this.regulatoryBasis == null)
3046        return false;
3047      for (CodeableConcept item : this.regulatoryBasis)
3048        if (!item.isEmpty())
3049          return true;
3050      return false;
3051    }
3052
3053    public CodeableConcept addRegulatoryBasis() { //3
3054      CodeableConcept t = new CodeableConcept();
3055      if (this.regulatoryBasis == null)
3056        this.regulatoryBasis = new ArrayList<CodeableConcept>();
3057      this.regulatoryBasis.add(t);
3058      return t;
3059    }
3060
3061    public Consent addRegulatoryBasis(CodeableConcept t) { //3
3062      if (t == null)
3063        return this;
3064      if (this.regulatoryBasis == null)
3065        this.regulatoryBasis = new ArrayList<CodeableConcept>();
3066      this.regulatoryBasis.add(t);
3067      return this;
3068    }
3069
3070    /**
3071     * @return The first repetition of repeating field {@link #regulatoryBasis}, creating it if it does not already exist {3}
3072     */
3073    public CodeableConcept getRegulatoryBasisFirstRep() { 
3074      if (getRegulatoryBasis().isEmpty()) {
3075        addRegulatoryBasis();
3076      }
3077      return getRegulatoryBasis().get(0);
3078    }
3079
3080    /**
3081     * @return {@link #policyBasis} (A Reference or URL used to uniquely identify the policy the organization will enforce for this Consent. This Reference or URL should be specific to the version of the policy and should be dereferencable to a computable policy of some form.)
3082     */
3083    public ConsentPolicyBasisComponent getPolicyBasis() { 
3084      if (this.policyBasis == null)
3085        if (Configuration.errorOnAutoCreate())
3086          throw new Error("Attempt to auto-create Consent.policyBasis");
3087        else if (Configuration.doAutoCreate())
3088          this.policyBasis = new ConsentPolicyBasisComponent(); // cc
3089      return this.policyBasis;
3090    }
3091
3092    public boolean hasPolicyBasis() { 
3093      return this.policyBasis != null && !this.policyBasis.isEmpty();
3094    }
3095
3096    /**
3097     * @param value {@link #policyBasis} (A Reference or URL used to uniquely identify the policy the organization will enforce for this Consent. This Reference or URL should be specific to the version of the policy and should be dereferencable to a computable policy of some form.)
3098     */
3099    public Consent setPolicyBasis(ConsentPolicyBasisComponent value) { 
3100      this.policyBasis = value;
3101      return this;
3102    }
3103
3104    /**
3105     * @return {@link #policyText} (A Reference to the human readable policy explaining the basis for the Consent.)
3106     */
3107    public List<Reference> getPolicyText() { 
3108      if (this.policyText == null)
3109        this.policyText = new ArrayList<Reference>();
3110      return this.policyText;
3111    }
3112
3113    /**
3114     * @return Returns a reference to <code>this</code> for easy method chaining
3115     */
3116    public Consent setPolicyText(List<Reference> thePolicyText) { 
3117      this.policyText = thePolicyText;
3118      return this;
3119    }
3120
3121    public boolean hasPolicyText() { 
3122      if (this.policyText == null)
3123        return false;
3124      for (Reference item : this.policyText)
3125        if (!item.isEmpty())
3126          return true;
3127      return false;
3128    }
3129
3130    public Reference addPolicyText() { //3
3131      Reference t = new Reference();
3132      if (this.policyText == null)
3133        this.policyText = new ArrayList<Reference>();
3134      this.policyText.add(t);
3135      return t;
3136    }
3137
3138    public Consent addPolicyText(Reference t) { //3
3139      if (t == null)
3140        return this;
3141      if (this.policyText == null)
3142        this.policyText = new ArrayList<Reference>();
3143      this.policyText.add(t);
3144      return this;
3145    }
3146
3147    /**
3148     * @return The first repetition of repeating field {@link #policyText}, creating it if it does not already exist {3}
3149     */
3150    public Reference getPolicyTextFirstRep() { 
3151      if (getPolicyText().isEmpty()) {
3152        addPolicyText();
3153      }
3154      return getPolicyText().get(0);
3155    }
3156
3157    /**
3158     * @return {@link #verification} (Whether a treatment instruction (e.g. artificial respiration: yes or no) was verified with the patient, his/her family or another authorized person.)
3159     */
3160    public List<ConsentVerificationComponent> getVerification() { 
3161      if (this.verification == null)
3162        this.verification = new ArrayList<ConsentVerificationComponent>();
3163      return this.verification;
3164    }
3165
3166    /**
3167     * @return Returns a reference to <code>this</code> for easy method chaining
3168     */
3169    public Consent setVerification(List<ConsentVerificationComponent> theVerification) { 
3170      this.verification = theVerification;
3171      return this;
3172    }
3173
3174    public boolean hasVerification() { 
3175      if (this.verification == null)
3176        return false;
3177      for (ConsentVerificationComponent item : this.verification)
3178        if (!item.isEmpty())
3179          return true;
3180      return false;
3181    }
3182
3183    public ConsentVerificationComponent addVerification() { //3
3184      ConsentVerificationComponent t = new ConsentVerificationComponent();
3185      if (this.verification == null)
3186        this.verification = new ArrayList<ConsentVerificationComponent>();
3187      this.verification.add(t);
3188      return t;
3189    }
3190
3191    public Consent addVerification(ConsentVerificationComponent t) { //3
3192      if (t == null)
3193        return this;
3194      if (this.verification == null)
3195        this.verification = new ArrayList<ConsentVerificationComponent>();
3196      this.verification.add(t);
3197      return this;
3198    }
3199
3200    /**
3201     * @return The first repetition of repeating field {@link #verification}, creating it if it does not already exist {3}
3202     */
3203    public ConsentVerificationComponent getVerificationFirstRep() { 
3204      if (getVerification().isEmpty()) {
3205        addVerification();
3206      }
3207      return getVerification().get(0);
3208    }
3209
3210    /**
3211     * @return {@link #provision} (An exception to the base policy of this consent. An exception can be an addition or removal of access permissions.)
3212     */
3213    public ProvisionComponent getProvision() { 
3214      if (this.provision == null)
3215        if (Configuration.errorOnAutoCreate())
3216          throw new Error("Attempt to auto-create Consent.provision");
3217        else if (Configuration.doAutoCreate())
3218          this.provision = new ProvisionComponent(); // cc
3219      return this.provision;
3220    }
3221
3222    public boolean hasProvision() { 
3223      return this.provision != null && !this.provision.isEmpty();
3224    }
3225
3226    /**
3227     * @param value {@link #provision} (An exception to the base policy of this consent. An exception can be an addition or removal of access permissions.)
3228     */
3229    public Consent setProvision(ProvisionComponent value) { 
3230      this.provision = value;
3231      return this;
3232    }
3233
3234      protected void listChildren(List<Property> children) {
3235        super.listChildren(children);
3236        children.add(new Property("identifier", "Identifier", "Unique identifier for this copy of the Consent Statement.", 0, java.lang.Integer.MAX_VALUE, identifier));
3237        children.add(new Property("status", "code", "Indicates the current state of this Consent resource.", 0, 1, status));
3238        children.add(new Property("category", "CodeableConcept", "A classification of the type of consents found in the statement. This element supports indexing and retrieval of consent statements.", 0, java.lang.Integer.MAX_VALUE, category));
3239        children.add(new Property("subject", "Reference(Patient|Practitioner|Group)", "The patient/healthcare practitioner or group of persons to whom this consent applies.", 0, 1, subject));
3240        children.add(new Property("date", "date", "Date the consent instance was agreed to.", 0, 1, date));
3241        children.add(new Property("period", "Period", "Effective period for this Consent Resource and all provisions unless specified in that provision.", 0, 1, period));
3242        children.add(new Property("grantor", "Reference(CareTeam|HealthcareService|Organization|Patient|Practitioner|RelatedPerson|PractitionerRole)", "The entity responsible for granting the rights listed in a Consent Directive.", 0, java.lang.Integer.MAX_VALUE, grantor));
3243        children.add(new Property("grantee", "Reference(CareTeam|HealthcareService|Organization|Patient|Practitioner|RelatedPerson|PractitionerRole)", "The entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.", 0, java.lang.Integer.MAX_VALUE, grantee));
3244        children.add(new Property("manager", "Reference(HealthcareService|Organization|Patient|Practitioner)", "The actor that manages the consent through its lifecycle.", 0, java.lang.Integer.MAX_VALUE, manager));
3245        children.add(new Property("controller", "Reference(HealthcareService|Organization|Patient|Practitioner)", "The actor that controls/enforces the access according to the consent.", 0, java.lang.Integer.MAX_VALUE, controller));
3246        children.add(new Property("sourceAttachment", "Attachment", "The source on which this consent statement is based. The source might be a scanned original paper form.", 0, java.lang.Integer.MAX_VALUE, sourceAttachment));
3247        children.add(new Property("sourceReference", "Reference(Consent|DocumentReference|Contract|QuestionnaireResponse)", "A reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document.", 0, java.lang.Integer.MAX_VALUE, sourceReference));
3248        children.add(new Property("regulatoryBasis", "CodeableConcept", "A set of codes that indicate the regulatory basis (if any) that this consent supports.", 0, java.lang.Integer.MAX_VALUE, regulatoryBasis));
3249        children.add(new Property("policyBasis", "", "A Reference or URL used to uniquely identify the policy the organization will enforce for this Consent. This Reference or URL should be specific to the version of the policy and should be dereferencable to a computable policy of some form.", 0, 1, policyBasis));
3250        children.add(new Property("policyText", "Reference(DocumentReference)", "A Reference to the human readable policy explaining the basis for the Consent.", 0, java.lang.Integer.MAX_VALUE, policyText));
3251        children.add(new Property("verification", "", "Whether a treatment instruction (e.g. artificial respiration: yes or no) was verified with the patient, his/her family or another authorized person.", 0, java.lang.Integer.MAX_VALUE, verification));
3252        children.add(new Property("provision", "", "An exception to the base policy of this consent. An exception can be an addition or removal of access permissions.", 0, 1, provision));
3253      }
3254
3255      @Override
3256      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3257        switch (_hash) {
3258        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier for this copy of the Consent Statement.", 0, java.lang.Integer.MAX_VALUE, identifier);
3259        case -892481550: /*status*/  return new Property("status", "code", "Indicates the current state of this Consent resource.", 0, 1, status);
3260        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A classification of the type of consents found in the statement. This element supports indexing and retrieval of consent statements.", 0, java.lang.Integer.MAX_VALUE, category);
3261        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Practitioner|Group)", "The patient/healthcare practitioner or group of persons to whom this consent applies.", 0, 1, subject);
3262        case 3076014: /*date*/  return new Property("date", "date", "Date the consent instance was agreed to.", 0, 1, date);
3263        case -991726143: /*period*/  return new Property("period", "Period", "Effective period for this Consent Resource and all provisions unless specified in that provision.", 0, 1, period);
3264        case 280295423: /*grantor*/  return new Property("grantor", "Reference(CareTeam|HealthcareService|Organization|Patient|Practitioner|RelatedPerson|PractitionerRole)", "The entity responsible for granting the rights listed in a Consent Directive.", 0, java.lang.Integer.MAX_VALUE, grantor);
3265        case 280295100: /*grantee*/  return new Property("grantee", "Reference(CareTeam|HealthcareService|Organization|Patient|Practitioner|RelatedPerson|PractitionerRole)", "The entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.", 0, java.lang.Integer.MAX_VALUE, grantee);
3266        case 835260333: /*manager*/  return new Property("manager", "Reference(HealthcareService|Organization|Patient|Practitioner)", "The actor that manages the consent through its lifecycle.", 0, java.lang.Integer.MAX_VALUE, manager);
3267        case 637428636: /*controller*/  return new Property("controller", "Reference(HealthcareService|Organization|Patient|Practitioner)", "The actor that controls/enforces the access according to the consent.", 0, java.lang.Integer.MAX_VALUE, controller);
3268        case 1964406686: /*sourceAttachment*/  return new Property("sourceAttachment", "Attachment", "The source on which this consent statement is based. The source might be a scanned original paper form.", 0, java.lang.Integer.MAX_VALUE, sourceAttachment);
3269        case -244259472: /*sourceReference*/  return new Property("sourceReference", "Reference(Consent|DocumentReference|Contract|QuestionnaireResponse)", "A reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document.", 0, java.lang.Integer.MAX_VALUE, sourceReference);
3270        case -1780301690: /*regulatoryBasis*/  return new Property("regulatoryBasis", "CodeableConcept", "A set of codes that indicate the regulatory basis (if any) that this consent supports.", 0, java.lang.Integer.MAX_VALUE, regulatoryBasis);
3271        case 2138287660: /*policyBasis*/  return new Property("policyBasis", "", "A Reference or URL used to uniquely identify the policy the organization will enforce for this Consent. This Reference or URL should be specific to the version of the policy and should be dereferencable to a computable policy of some form.", 0, 1, policyBasis);
3272        case 1593537919: /*policyText*/  return new Property("policyText", "Reference(DocumentReference)", "A Reference to the human readable policy explaining the basis for the Consent.", 0, java.lang.Integer.MAX_VALUE, policyText);
3273        case -1484401125: /*verification*/  return new Property("verification", "", "Whether a treatment instruction (e.g. artificial respiration: yes or no) was verified with the patient, his/her family or another authorized person.", 0, java.lang.Integer.MAX_VALUE, verification);
3274        case -547120939: /*provision*/  return new Property("provision", "", "An exception to the base policy of this consent. An exception can be an addition or removal of access permissions.", 0, 1, provision);
3275        default: return super.getNamedProperty(_hash, _name, _checkValid);
3276        }
3277
3278      }
3279
3280      @Override
3281      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3282        switch (hash) {
3283        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3284        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ConsentState>
3285        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
3286        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
3287        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3288        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
3289        case 280295423: /*grantor*/ return this.grantor == null ? new Base[0] : this.grantor.toArray(new Base[this.grantor.size()]); // Reference
3290        case 280295100: /*grantee*/ return this.grantee == null ? new Base[0] : this.grantee.toArray(new Base[this.grantee.size()]); // Reference
3291        case 835260333: /*manager*/ return this.manager == null ? new Base[0] : this.manager.toArray(new Base[this.manager.size()]); // Reference
3292        case 637428636: /*controller*/ return this.controller == null ? new Base[0] : this.controller.toArray(new Base[this.controller.size()]); // Reference
3293        case 1964406686: /*sourceAttachment*/ return this.sourceAttachment == null ? new Base[0] : this.sourceAttachment.toArray(new Base[this.sourceAttachment.size()]); // Attachment
3294        case -244259472: /*sourceReference*/ return this.sourceReference == null ? new Base[0] : this.sourceReference.toArray(new Base[this.sourceReference.size()]); // Reference
3295        case -1780301690: /*regulatoryBasis*/ return this.regulatoryBasis == null ? new Base[0] : this.regulatoryBasis.toArray(new Base[this.regulatoryBasis.size()]); // CodeableConcept
3296        case 2138287660: /*policyBasis*/ return this.policyBasis == null ? new Base[0] : new Base[] {this.policyBasis}; // ConsentPolicyBasisComponent
3297        case 1593537919: /*policyText*/ return this.policyText == null ? new Base[0] : this.policyText.toArray(new Base[this.policyText.size()]); // Reference
3298        case -1484401125: /*verification*/ return this.verification == null ? new Base[0] : this.verification.toArray(new Base[this.verification.size()]); // ConsentVerificationComponent
3299        case -547120939: /*provision*/ return this.provision == null ? new Base[0] : new Base[] {this.provision}; // ProvisionComponent
3300        default: return super.getProperty(hash, name, checkValid);
3301        }
3302
3303      }
3304
3305      @Override
3306      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3307        switch (hash) {
3308        case -1618432855: // identifier
3309          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
3310          return value;
3311        case -892481550: // status
3312          value = new ConsentStateEnumFactory().fromType(TypeConvertor.castToCode(value));
3313          this.status = (Enumeration) value; // Enumeration<ConsentState>
3314          return value;
3315        case 50511102: // category
3316          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3317          return value;
3318        case -1867885268: // subject
3319          this.subject = TypeConvertor.castToReference(value); // Reference
3320          return value;
3321        case 3076014: // date
3322          this.date = TypeConvertor.castToDate(value); // DateType
3323          return value;
3324        case -991726143: // period
3325          this.period = TypeConvertor.castToPeriod(value); // Period
3326          return value;
3327        case 280295423: // grantor
3328          this.getGrantor().add(TypeConvertor.castToReference(value)); // Reference
3329          return value;
3330        case 280295100: // grantee
3331          this.getGrantee().add(TypeConvertor.castToReference(value)); // Reference
3332          return value;
3333        case 835260333: // manager
3334          this.getManager().add(TypeConvertor.castToReference(value)); // Reference
3335          return value;
3336        case 637428636: // controller
3337          this.getController().add(TypeConvertor.castToReference(value)); // Reference
3338          return value;
3339        case 1964406686: // sourceAttachment
3340          this.getSourceAttachment().add(TypeConvertor.castToAttachment(value)); // Attachment
3341          return value;
3342        case -244259472: // sourceReference
3343          this.getSourceReference().add(TypeConvertor.castToReference(value)); // Reference
3344          return value;
3345        case -1780301690: // regulatoryBasis
3346          this.getRegulatoryBasis().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3347          return value;
3348        case 2138287660: // policyBasis
3349          this.policyBasis = (ConsentPolicyBasisComponent) value; // ConsentPolicyBasisComponent
3350          return value;
3351        case 1593537919: // policyText
3352          this.getPolicyText().add(TypeConvertor.castToReference(value)); // Reference
3353          return value;
3354        case -1484401125: // verification
3355          this.getVerification().add((ConsentVerificationComponent) value); // ConsentVerificationComponent
3356          return value;
3357        case -547120939: // provision
3358          this.provision = (ProvisionComponent) value; // ProvisionComponent
3359          return value;
3360        default: return super.setProperty(hash, name, value);
3361        }
3362
3363      }
3364
3365      @Override
3366      public Base setProperty(String name, Base value) throws FHIRException {
3367        if (name.equals("identifier")) {
3368          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
3369        } else if (name.equals("status")) {
3370          value = new ConsentStateEnumFactory().fromType(TypeConvertor.castToCode(value));
3371          this.status = (Enumeration) value; // Enumeration<ConsentState>
3372        } else if (name.equals("category")) {
3373          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
3374        } else if (name.equals("subject")) {
3375          this.subject = TypeConvertor.castToReference(value); // Reference
3376        } else if (name.equals("date")) {
3377          this.date = TypeConvertor.castToDate(value); // DateType
3378        } else if (name.equals("period")) {
3379          this.period = TypeConvertor.castToPeriod(value); // Period
3380        } else if (name.equals("grantor")) {
3381          this.getGrantor().add(TypeConvertor.castToReference(value));
3382        } else if (name.equals("grantee")) {
3383          this.getGrantee().add(TypeConvertor.castToReference(value));
3384        } else if (name.equals("manager")) {
3385          this.getManager().add(TypeConvertor.castToReference(value));
3386        } else if (name.equals("controller")) {
3387          this.getController().add(TypeConvertor.castToReference(value));
3388        } else if (name.equals("sourceAttachment")) {
3389          this.getSourceAttachment().add(TypeConvertor.castToAttachment(value));
3390        } else if (name.equals("sourceReference")) {
3391          this.getSourceReference().add(TypeConvertor.castToReference(value));
3392        } else if (name.equals("regulatoryBasis")) {
3393          this.getRegulatoryBasis().add(TypeConvertor.castToCodeableConcept(value));
3394        } else if (name.equals("policyBasis")) {
3395          this.policyBasis = (ConsentPolicyBasisComponent) value; // ConsentPolicyBasisComponent
3396        } else if (name.equals("policyText")) {
3397          this.getPolicyText().add(TypeConvertor.castToReference(value));
3398        } else if (name.equals("verification")) {
3399          this.getVerification().add((ConsentVerificationComponent) value);
3400        } else if (name.equals("provision")) {
3401          this.provision = (ProvisionComponent) value; // ProvisionComponent
3402        } else
3403          return super.setProperty(name, value);
3404        return value;
3405      }
3406
3407      @Override
3408      public Base makeProperty(int hash, String name) throws FHIRException {
3409        switch (hash) {
3410        case -1618432855:  return addIdentifier(); 
3411        case -892481550:  return getStatusElement();
3412        case 50511102:  return addCategory(); 
3413        case -1867885268:  return getSubject();
3414        case 3076014:  return getDateElement();
3415        case -991726143:  return getPeriod();
3416        case 280295423:  return addGrantor(); 
3417        case 280295100:  return addGrantee(); 
3418        case 835260333:  return addManager(); 
3419        case 637428636:  return addController(); 
3420        case 1964406686:  return addSourceAttachment(); 
3421        case -244259472:  return addSourceReference(); 
3422        case -1780301690:  return addRegulatoryBasis(); 
3423        case 2138287660:  return getPolicyBasis();
3424        case 1593537919:  return addPolicyText(); 
3425        case -1484401125:  return addVerification(); 
3426        case -547120939:  return getProvision();
3427        default: return super.makeProperty(hash, name);
3428        }
3429
3430      }
3431
3432      @Override
3433      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3434        switch (hash) {
3435        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3436        case -892481550: /*status*/ return new String[] {"code"};
3437        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
3438        case -1867885268: /*subject*/ return new String[] {"Reference"};
3439        case 3076014: /*date*/ return new String[] {"date"};
3440        case -991726143: /*period*/ return new String[] {"Period"};
3441        case 280295423: /*grantor*/ return new String[] {"Reference"};
3442        case 280295100: /*grantee*/ return new String[] {"Reference"};
3443        case 835260333: /*manager*/ return new String[] {"Reference"};
3444        case 637428636: /*controller*/ return new String[] {"Reference"};
3445        case 1964406686: /*sourceAttachment*/ return new String[] {"Attachment"};
3446        case -244259472: /*sourceReference*/ return new String[] {"Reference"};
3447        case -1780301690: /*regulatoryBasis*/ return new String[] {"CodeableConcept"};
3448        case 2138287660: /*policyBasis*/ return new String[] {};
3449        case 1593537919: /*policyText*/ return new String[] {"Reference"};
3450        case -1484401125: /*verification*/ return new String[] {};
3451        case -547120939: /*provision*/ return new String[] {};
3452        default: return super.getTypesForProperty(hash, name);
3453        }
3454
3455      }
3456
3457      @Override
3458      public Base addChild(String name) throws FHIRException {
3459        if (name.equals("identifier")) {
3460          return addIdentifier();
3461        }
3462        else if (name.equals("status")) {
3463          throw new FHIRException("Cannot call addChild on a primitive type Consent.status");
3464        }
3465        else if (name.equals("category")) {
3466          return addCategory();
3467        }
3468        else if (name.equals("subject")) {
3469          this.subject = new Reference();
3470          return this.subject;
3471        }
3472        else if (name.equals("date")) {
3473          throw new FHIRException("Cannot call addChild on a primitive type Consent.date");
3474        }
3475        else if (name.equals("period")) {
3476          this.period = new Period();
3477          return this.period;
3478        }
3479        else if (name.equals("grantor")) {
3480          return addGrantor();
3481        }
3482        else if (name.equals("grantee")) {
3483          return addGrantee();
3484        }
3485        else if (name.equals("manager")) {
3486          return addManager();
3487        }
3488        else if (name.equals("controller")) {
3489          return addController();
3490        }
3491        else if (name.equals("sourceAttachment")) {
3492          return addSourceAttachment();
3493        }
3494        else if (name.equals("sourceReference")) {
3495          return addSourceReference();
3496        }
3497        else if (name.equals("regulatoryBasis")) {
3498          return addRegulatoryBasis();
3499        }
3500        else if (name.equals("policyBasis")) {
3501          this.policyBasis = new ConsentPolicyBasisComponent();
3502          return this.policyBasis;
3503        }
3504        else if (name.equals("policyText")) {
3505          return addPolicyText();
3506        }
3507        else if (name.equals("verification")) {
3508          return addVerification();
3509        }
3510        else if (name.equals("provision")) {
3511          this.provision = new ProvisionComponent();
3512          return this.provision;
3513        }
3514        else
3515          return super.addChild(name);
3516      }
3517
3518  public String fhirType() {
3519    return "Consent";
3520
3521  }
3522
3523      public Consent copy() {
3524        Consent dst = new Consent();
3525        copyValues(dst);
3526        return dst;
3527      }
3528
3529      public void copyValues(Consent dst) {
3530        super.copyValues(dst);
3531        if (identifier != null) {
3532          dst.identifier = new ArrayList<Identifier>();
3533          for (Identifier i : identifier)
3534            dst.identifier.add(i.copy());
3535        };
3536        dst.status = status == null ? null : status.copy();
3537        if (category != null) {
3538          dst.category = new ArrayList<CodeableConcept>();
3539          for (CodeableConcept i : category)
3540            dst.category.add(i.copy());
3541        };
3542        dst.subject = subject == null ? null : subject.copy();
3543        dst.date = date == null ? null : date.copy();
3544        dst.period = period == null ? null : period.copy();
3545        if (grantor != null) {
3546          dst.grantor = new ArrayList<Reference>();
3547          for (Reference i : grantor)
3548            dst.grantor.add(i.copy());
3549        };
3550        if (grantee != null) {
3551          dst.grantee = new ArrayList<Reference>();
3552          for (Reference i : grantee)
3553            dst.grantee.add(i.copy());
3554        };
3555        if (manager != null) {
3556          dst.manager = new ArrayList<Reference>();
3557          for (Reference i : manager)
3558            dst.manager.add(i.copy());
3559        };
3560        if (controller != null) {
3561          dst.controller = new ArrayList<Reference>();
3562          for (Reference i : controller)
3563            dst.controller.add(i.copy());
3564        };
3565        if (sourceAttachment != null) {
3566          dst.sourceAttachment = new ArrayList<Attachment>();
3567          for (Attachment i : sourceAttachment)
3568            dst.sourceAttachment.add(i.copy());
3569        };
3570        if (sourceReference != null) {
3571          dst.sourceReference = new ArrayList<Reference>();
3572          for (Reference i : sourceReference)
3573            dst.sourceReference.add(i.copy());
3574        };
3575        if (regulatoryBasis != null) {
3576          dst.regulatoryBasis = new ArrayList<CodeableConcept>();
3577          for (CodeableConcept i : regulatoryBasis)
3578            dst.regulatoryBasis.add(i.copy());
3579        };
3580        dst.policyBasis = policyBasis == null ? null : policyBasis.copy();
3581        if (policyText != null) {
3582          dst.policyText = new ArrayList<Reference>();
3583          for (Reference i : policyText)
3584            dst.policyText.add(i.copy());
3585        };
3586        if (verification != null) {
3587          dst.verification = new ArrayList<ConsentVerificationComponent>();
3588          for (ConsentVerificationComponent i : verification)
3589            dst.verification.add(i.copy());
3590        };
3591        dst.provision = provision == null ? null : provision.copy();
3592      }
3593
3594      protected Consent typedCopy() {
3595        return copy();
3596      }
3597
3598      @Override
3599      public boolean equalsDeep(Base other_) {
3600        if (!super.equalsDeep(other_))
3601          return false;
3602        if (!(other_ instanceof Consent))
3603          return false;
3604        Consent o = (Consent) other_;
3605        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
3606           && compareDeep(subject, o.subject, true) && compareDeep(date, o.date, true) && compareDeep(period, o.period, true)
3607           && compareDeep(grantor, o.grantor, true) && compareDeep(grantee, o.grantee, true) && compareDeep(manager, o.manager, true)
3608           && compareDeep(controller, o.controller, true) && compareDeep(sourceAttachment, o.sourceAttachment, true)
3609           && compareDeep(sourceReference, o.sourceReference, true) && compareDeep(regulatoryBasis, o.regulatoryBasis, true)
3610           && compareDeep(policyBasis, o.policyBasis, true) && compareDeep(policyText, o.policyText, true)
3611           && compareDeep(verification, o.verification, true) && compareDeep(provision, o.provision, true)
3612          ;
3613      }
3614
3615      @Override
3616      public boolean equalsShallow(Base other_) {
3617        if (!super.equalsShallow(other_))
3618          return false;
3619        if (!(other_ instanceof Consent))
3620          return false;
3621        Consent o = (Consent) other_;
3622        return compareValues(status, o.status, true) && compareValues(date, o.date, true);
3623      }
3624
3625      public boolean isEmpty() {
3626        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, category
3627          , subject, date, period, grantor, grantee, manager, controller, sourceAttachment
3628          , sourceReference, regulatoryBasis, policyBasis, policyText, verification, provision
3629          );
3630      }
3631
3632  @Override
3633  public ResourceType getResourceType() {
3634    return ResourceType.Consent;
3635   }
3636
3637 /**
3638   * Search parameter: <b>action</b>
3639   * <p>
3640   * Description: <b>Actions controlled by this rule</b><br>
3641   * Type: <b>token</b><br>
3642   * Path: <b>Consent.provision.action</b><br>
3643   * </p>
3644   */
3645  @SearchParamDefinition(name="action", path="Consent.provision.action", description="Actions controlled by this rule", type="token" )
3646  public static final String SP_ACTION = "action";
3647 /**
3648   * <b>Fluent Client</b> search parameter constant for <b>action</b>
3649   * <p>
3650   * Description: <b>Actions controlled by this rule</b><br>
3651   * Type: <b>token</b><br>
3652   * Path: <b>Consent.provision.action</b><br>
3653   * </p>
3654   */
3655  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTION);
3656
3657 /**
3658   * Search parameter: <b>actor</b>
3659   * <p>
3660   * Description: <b>Resource for the actor (or group, by role)</b><br>
3661   * Type: <b>reference</b><br>
3662   * Path: <b>Consent.provision.actor.reference</b><br>
3663   * </p>
3664   */
3665  @SearchParamDefinition(name="actor", path="Consent.provision.actor.reference", description="Resource for the actor (or group, by role)", type="reference", target={CareTeam.class, Device.class, Group.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
3666  public static final String SP_ACTOR = "actor";
3667 /**
3668   * <b>Fluent Client</b> search parameter constant for <b>actor</b>
3669   * <p>
3670   * Description: <b>Resource for the actor (or group, by role)</b><br>
3671   * Type: <b>reference</b><br>
3672   * Path: <b>Consent.provision.actor.reference</b><br>
3673   * </p>
3674   */
3675  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
3676
3677/**
3678   * Constant for fluent queries to be used to add include statements. Specifies
3679   * the path value of "<b>Consent:actor</b>".
3680   */
3681  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("Consent:actor").toLocked();
3682
3683 /**
3684   * Search parameter: <b>category</b>
3685   * <p>
3686   * Description: <b>Classification of the consent statement - for indexing/retrieval</b><br>
3687   * Type: <b>token</b><br>
3688   * Path: <b>Consent.category</b><br>
3689   * </p>
3690   */
3691  @SearchParamDefinition(name="category", path="Consent.category", description="Classification of the consent statement - for indexing/retrieval", type="token" )
3692  public static final String SP_CATEGORY = "category";
3693 /**
3694   * <b>Fluent Client</b> search parameter constant for <b>category</b>
3695   * <p>
3696   * Description: <b>Classification of the consent statement - for indexing/retrieval</b><br>
3697   * Type: <b>token</b><br>
3698   * Path: <b>Consent.category</b><br>
3699   * </p>
3700   */
3701  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
3702
3703 /**
3704   * Search parameter: <b>controller</b>
3705   * <p>
3706   * Description: <b>Consent Enforcer</b><br>
3707   * Type: <b>reference</b><br>
3708   * Path: <b>Consent.controller</b><br>
3709   * </p>
3710   */
3711  @SearchParamDefinition(name="controller", path="Consent.controller", description="Consent Enforcer", type="reference", target={HealthcareService.class, Organization.class, Patient.class, Practitioner.class } )
3712  public static final String SP_CONTROLLER = "controller";
3713 /**
3714   * <b>Fluent Client</b> search parameter constant for <b>controller</b>
3715   * <p>
3716   * Description: <b>Consent Enforcer</b><br>
3717   * Type: <b>reference</b><br>
3718   * Path: <b>Consent.controller</b><br>
3719   * </p>
3720   */
3721  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTROLLER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTROLLER);
3722
3723/**
3724   * Constant for fluent queries to be used to add include statements. Specifies
3725   * the path value of "<b>Consent:controller</b>".
3726   */
3727  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTROLLER = new ca.uhn.fhir.model.api.Include("Consent:controller").toLocked();
3728
3729 /**
3730   * Search parameter: <b>data</b>
3731   * <p>
3732   * Description: <b>The actual data reference</b><br>
3733   * Type: <b>reference</b><br>
3734   * Path: <b>Consent.provision.data.reference</b><br>
3735   * </p>
3736   */
3737  @SearchParamDefinition(name="data", path="Consent.provision.data.reference", description="The actual data reference", type="reference", target={Account.class, ActivityDefinition.class, ActorDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentManifest.class, DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, FormularyItem.class, GenomicStudy.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationUsage.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestOrchestration.class, Requirements.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, Transport.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
3738  public static final String SP_DATA = "data";
3739 /**
3740   * <b>Fluent Client</b> search parameter constant for <b>data</b>
3741   * <p>
3742   * Description: <b>The actual data reference</b><br>
3743   * Type: <b>reference</b><br>
3744   * Path: <b>Consent.provision.data.reference</b><br>
3745   * </p>
3746   */
3747  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DATA = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DATA);
3748
3749/**
3750   * Constant for fluent queries to be used to add include statements. Specifies
3751   * the path value of "<b>Consent:data</b>".
3752   */
3753  public static final ca.uhn.fhir.model.api.Include INCLUDE_DATA = new ca.uhn.fhir.model.api.Include("Consent:data").toLocked();
3754
3755 /**
3756   * Search parameter: <b>grantee</b>
3757   * <p>
3758   * Description: <b>Who is agreeing to the policy and rules</b><br>
3759   * Type: <b>reference</b><br>
3760   * Path: <b>Consent.grantee</b><br>
3761   * </p>
3762   */
3763  @SearchParamDefinition(name="grantee", path="Consent.grantee", description="Who is agreeing to the policy and rules", type="reference", target={CareTeam.class, HealthcareService.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
3764  public static final String SP_GRANTEE = "grantee";
3765 /**
3766   * <b>Fluent Client</b> search parameter constant for <b>grantee</b>
3767   * <p>
3768   * Description: <b>Who is agreeing to the policy and rules</b><br>
3769   * Type: <b>reference</b><br>
3770   * Path: <b>Consent.grantee</b><br>
3771   * </p>
3772   */
3773  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam GRANTEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_GRANTEE);
3774
3775/**
3776   * Constant for fluent queries to be used to add include statements. Specifies
3777   * the path value of "<b>Consent:grantee</b>".
3778   */
3779  public static final ca.uhn.fhir.model.api.Include INCLUDE_GRANTEE = new ca.uhn.fhir.model.api.Include("Consent:grantee").toLocked();
3780
3781 /**
3782   * Search parameter: <b>manager</b>
3783   * <p>
3784   * Description: <b>Consent workflow management</b><br>
3785   * Type: <b>reference</b><br>
3786   * Path: <b>Consent.manager</b><br>
3787   * </p>
3788   */
3789  @SearchParamDefinition(name="manager", path="Consent.manager", description="Consent workflow management", type="reference", target={HealthcareService.class, Organization.class, Patient.class, Practitioner.class } )
3790  public static final String SP_MANAGER = "manager";
3791 /**
3792   * <b>Fluent Client</b> search parameter constant for <b>manager</b>
3793   * <p>
3794   * Description: <b>Consent workflow management</b><br>
3795   * Type: <b>reference</b><br>
3796   * Path: <b>Consent.manager</b><br>
3797   * </p>
3798   */
3799  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANAGER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MANAGER);
3800
3801/**
3802   * Constant for fluent queries to be used to add include statements. Specifies
3803   * the path value of "<b>Consent:manager</b>".
3804   */
3805  public static final ca.uhn.fhir.model.api.Include INCLUDE_MANAGER = new ca.uhn.fhir.model.api.Include("Consent:manager").toLocked();
3806
3807 /**
3808   * Search parameter: <b>period</b>
3809   * <p>
3810   * Description: <b>Timeframe for this rule</b><br>
3811   * Type: <b>date</b><br>
3812   * Path: <b>Consent.provision.period</b><br>
3813   * </p>
3814   */
3815  @SearchParamDefinition(name="period", path="Consent.provision.period", description="Timeframe for this rule", type="date" )
3816  public static final String SP_PERIOD = "period";
3817 /**
3818   * <b>Fluent Client</b> search parameter constant for <b>period</b>
3819   * <p>
3820   * Description: <b>Timeframe for this rule</b><br>
3821   * Type: <b>date</b><br>
3822   * Path: <b>Consent.provision.period</b><br>
3823   * </p>
3824   */
3825  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
3826
3827 /**
3828   * Search parameter: <b>purpose</b>
3829   * <p>
3830   * Description: <b>Context of activities covered by this rule</b><br>
3831   * Type: <b>token</b><br>
3832   * Path: <b>Consent.provision.purpose</b><br>
3833   * </p>
3834   */
3835  @SearchParamDefinition(name="purpose", path="Consent.provision.purpose", description="Context of activities covered by this rule", type="token" )
3836  public static final String SP_PURPOSE = "purpose";
3837 /**
3838   * <b>Fluent Client</b> search parameter constant for <b>purpose</b>
3839   * <p>
3840   * Description: <b>Context of activities covered by this rule</b><br>
3841   * Type: <b>token</b><br>
3842   * Path: <b>Consent.provision.purpose</b><br>
3843   * </p>
3844   */
3845  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PURPOSE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PURPOSE);
3846
3847 /**
3848   * Search parameter: <b>security-label</b>
3849   * <p>
3850   * Description: <b>Security Labels that define affected resources</b><br>
3851   * Type: <b>token</b><br>
3852   * Path: <b>Consent.provision.securityLabel</b><br>
3853   * </p>
3854   */
3855  @SearchParamDefinition(name="security-label", path="Consent.provision.securityLabel", description="Security Labels that define affected resources", type="token" )
3856  public static final String SP_SECURITY_LABEL = "security-label";
3857 /**
3858   * <b>Fluent Client</b> search parameter constant for <b>security-label</b>
3859   * <p>
3860   * Description: <b>Security Labels that define affected resources</b><br>
3861   * Type: <b>token</b><br>
3862   * Path: <b>Consent.provision.securityLabel</b><br>
3863   * </p>
3864   */
3865  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SECURITY_LABEL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SECURITY_LABEL);
3866
3867 /**
3868   * Search parameter: <b>source-reference</b>
3869   * <p>
3870   * Description: <b>Search by reference to a Consent, DocumentReference, Contract  or QuestionnaireResponse</b><br>
3871   * Type: <b>reference</b><br>
3872   * Path: <b>Consent.sourceReference</b><br>
3873   * </p>
3874   */
3875  @SearchParamDefinition(name="source-reference", path="Consent.sourceReference", description="Search by reference to a Consent, DocumentReference, Contract  or QuestionnaireResponse", type="reference", target={Consent.class, Contract.class, DocumentReference.class, QuestionnaireResponse.class } )
3876  public static final String SP_SOURCE_REFERENCE = "source-reference";
3877 /**
3878   * <b>Fluent Client</b> search parameter constant for <b>source-reference</b>
3879   * <p>
3880   * Description: <b>Search by reference to a Consent, DocumentReference, Contract  or QuestionnaireResponse</b><br>
3881   * Type: <b>reference</b><br>
3882   * Path: <b>Consent.sourceReference</b><br>
3883   * </p>
3884   */
3885  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE_REFERENCE);
3886
3887/**
3888   * Constant for fluent queries to be used to add include statements. Specifies
3889   * the path value of "<b>Consent:source-reference</b>".
3890   */
3891  public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE_REFERENCE = new ca.uhn.fhir.model.api.Include("Consent:source-reference").toLocked();
3892
3893 /**
3894   * Search parameter: <b>status</b>
3895   * <p>
3896   * Description: <b>draft | active | inactive | entered-in-error | unknown</b><br>
3897   * Type: <b>token</b><br>
3898   * Path: <b>Consent.status</b><br>
3899   * </p>
3900   */
3901  @SearchParamDefinition(name="status", path="Consent.status", description="draft | active | inactive | entered-in-error | unknown", type="token" )
3902  public static final String SP_STATUS = "status";
3903 /**
3904   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3905   * <p>
3906   * Description: <b>draft | active | inactive | entered-in-error | unknown</b><br>
3907   * Type: <b>token</b><br>
3908   * Path: <b>Consent.status</b><br>
3909   * </p>
3910   */
3911  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3912
3913 /**
3914   * Search parameter: <b>subject</b>
3915   * <p>
3916   * Description: <b>Who the consent applies to</b><br>
3917   * Type: <b>reference</b><br>
3918   * Path: <b>Consent.subject</b><br>
3919   * </p>
3920   */
3921  @SearchParamDefinition(name="subject", path="Consent.subject", description="Who the consent applies to", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Group.class, Patient.class, Practitioner.class } )
3922  public static final String SP_SUBJECT = "subject";
3923 /**
3924   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3925   * <p>
3926   * Description: <b>Who the consent applies to</b><br>
3927   * Type: <b>reference</b><br>
3928   * Path: <b>Consent.subject</b><br>
3929   * </p>
3930   */
3931  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3932
3933/**
3934   * Constant for fluent queries to be used to add include statements. Specifies
3935   * the path value of "<b>Consent:subject</b>".
3936   */
3937  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Consent:subject").toLocked();
3938
3939 /**
3940   * Search parameter: <b>verified-date</b>
3941   * <p>
3942   * Description: <b>When consent verified</b><br>
3943   * Type: <b>date</b><br>
3944   * Path: <b>Consent.verification.verificationDate</b><br>
3945   * </p>
3946   */
3947  @SearchParamDefinition(name="verified-date", path="Consent.verification.verificationDate", description="When consent verified", type="date" )
3948  public static final String SP_VERIFIED_DATE = "verified-date";
3949 /**
3950   * <b>Fluent Client</b> search parameter constant for <b>verified-date</b>
3951   * <p>
3952   * Description: <b>When consent verified</b><br>
3953   * Type: <b>date</b><br>
3954   * Path: <b>Consent.verification.verificationDate</b><br>
3955   * </p>
3956   */
3957  public static final ca.uhn.fhir.rest.gclient.DateClientParam VERIFIED_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_VERIFIED_DATE);
3958
3959 /**
3960   * Search parameter: <b>verified</b>
3961   * <p>
3962   * Description: <b>Has been verified</b><br>
3963   * Type: <b>token</b><br>
3964   * Path: <b>Consent.verification.verified</b><br>
3965   * </p>
3966   */
3967  @SearchParamDefinition(name="verified", path="Consent.verification.verified", description="Has been verified", type="token" )
3968  public static final String SP_VERIFIED = "verified";
3969 /**
3970   * <b>Fluent Client</b> search parameter constant for <b>verified</b>
3971   * <p>
3972   * Description: <b>Has been verified</b><br>
3973   * Type: <b>token</b><br>
3974   * Path: <b>Consent.verification.verified</b><br>
3975   * </p>
3976   */
3977  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERIFIED = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERIFIED);
3978
3979 /**
3980   * Search parameter: <b>date</b>
3981   * <p>
3982   * Description: <b>Multiple Resources: 
3983
3984* [AllergyIntolerance](allergyintolerance.html): Date first version of the resource instance was recorded
3985* [CarePlan](careplan.html): Time period plan covers
3986* [CareTeam](careteam.html): A date within the coverage time period.
3987* [ClinicalImpression](clinicalimpression.html): When the assessment was documented
3988* [Composition](composition.html): Composition editing time
3989* [Consent](consent.html): When consent was agreed to
3990* [DiagnosticReport](diagnosticreport.html): The clinically relevant time of the report
3991* [Encounter](encounter.html): A date within the actualPeriod the Encounter lasted
3992* [EpisodeOfCare](episodeofcare.html): The provided date search value falls within the episode of care's period
3993* [FamilyMemberHistory](familymemberhistory.html): When history was recorded or last updated
3994* [Flag](flag.html): Time period when flag is active
3995* [Immunization](immunization.html): Vaccination  (non)-Administration Date
3996* [List](list.html): When the list was prepared
3997* [Observation](observation.html): Obtained date/time. If the obtained element is a period, a date that falls in the period
3998* [Procedure](procedure.html): When the procedure occurred or is occurring
3999* [RiskAssessment](riskassessment.html): When was assessment made?
4000* [SupplyRequest](supplyrequest.html): When the request was made
4001</b><br>
4002   * Type: <b>date</b><br>
4003   * Path: <b>AllergyIntolerance.recordedDate | CarePlan.period | ClinicalImpression.date | Composition.date | Consent.date | DiagnosticReport.effective.as(dateTime) | DiagnosticReport.effective.as(Period) | Encounter.actualPeriod | EpisodeOfCare.period | FamilyMemberHistory.date | Flag.period | (Immunization.occurrence as dateTime) | List.date | Observation.effective.as(dateTime) | Observation.effective.as(Period) | Observation.effective.as(Timing) | Observation.effective.as(instant) | Procedure.occurrence.as(dateTime) | Procedure.occurrence.as(Period) | Procedure.occurrence.as(Timing) | (RiskAssessment.occurrence as dateTime) | SupplyRequest.authoredOn</b><br>
4004   * </p>
4005   */
4006  @SearchParamDefinition(name="date", path="AllergyIntolerance.recordedDate | CarePlan.period | ClinicalImpression.date | Composition.date | Consent.date | DiagnosticReport.effective.as(dateTime) | DiagnosticReport.effective.as(Period) | Encounter.actualPeriod | EpisodeOfCare.period | FamilyMemberHistory.date | Flag.period | (Immunization.occurrence as dateTime) | List.date | Observation.effective.as(dateTime) | Observation.effective.as(Period) | Observation.effective.as(Timing) | Observation.effective.as(instant) | Procedure.occurrence.as(dateTime) | Procedure.occurrence.as(Period) | Procedure.occurrence.as(Timing) | (RiskAssessment.occurrence as dateTime) | SupplyRequest.authoredOn", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Date first version of the resource instance was recorded\r\n* [CarePlan](careplan.html): Time period plan covers\r\n* [CareTeam](careteam.html): A date within the coverage time period.\r\n* [ClinicalImpression](clinicalimpression.html): When the assessment was documented\r\n* [Composition](composition.html): Composition editing time\r\n* [Consent](consent.html): When consent was agreed to\r\n* [DiagnosticReport](diagnosticreport.html): The clinically relevant time of the report\r\n* [Encounter](encounter.html): A date within the actualPeriod the Encounter lasted\r\n* [EpisodeOfCare](episodeofcare.html): The provided date search value falls within the episode of care's period\r\n* [FamilyMemberHistory](familymemberhistory.html): When history was recorded or last updated\r\n* [Flag](flag.html): Time period when flag is active\r\n* [Immunization](immunization.html): Vaccination  (non)-Administration Date\r\n* [List](list.html): When the list was prepared\r\n* [Observation](observation.html): Obtained date/time. If the obtained element is a period, a date that falls in the period\r\n* [Procedure](procedure.html): When the procedure occurred or is occurring\r\n* [RiskAssessment](riskassessment.html): When was assessment made?\r\n* [SupplyRequest](supplyrequest.html): When the request was made\r\n", type="date" )
4007  public static final String SP_DATE = "date";
4008 /**
4009   * <b>Fluent Client</b> search parameter constant for <b>date</b>
4010   * <p>
4011   * Description: <b>Multiple Resources: 
4012
4013* [AllergyIntolerance](allergyintolerance.html): Date first version of the resource instance was recorded
4014* [CarePlan](careplan.html): Time period plan covers
4015* [CareTeam](careteam.html): A date within the coverage time period.
4016* [ClinicalImpression](clinicalimpression.html): When the assessment was documented
4017* [Composition](composition.html): Composition editing time
4018* [Consent](consent.html): When consent was agreed to
4019* [DiagnosticReport](diagnosticreport.html): The clinically relevant time of the report
4020* [Encounter](encounter.html): A date within the actualPeriod the Encounter lasted
4021* [EpisodeOfCare](episodeofcare.html): The provided date search value falls within the episode of care's period
4022* [FamilyMemberHistory](familymemberhistory.html): When history was recorded or last updated
4023* [Flag](flag.html): Time period when flag is active
4024* [Immunization](immunization.html): Vaccination  (non)-Administration Date
4025* [List](list.html): When the list was prepared
4026* [Observation](observation.html): Obtained date/time. If the obtained element is a period, a date that falls in the period
4027* [Procedure](procedure.html): When the procedure occurred or is occurring
4028* [RiskAssessment](riskassessment.html): When was assessment made?
4029* [SupplyRequest](supplyrequest.html): When the request was made
4030</b><br>
4031   * Type: <b>date</b><br>
4032   * Path: <b>AllergyIntolerance.recordedDate | CarePlan.period | ClinicalImpression.date | Composition.date | Consent.date | DiagnosticReport.effective.as(dateTime) | DiagnosticReport.effective.as(Period) | Encounter.actualPeriod | EpisodeOfCare.period | FamilyMemberHistory.date | Flag.period | (Immunization.occurrence as dateTime) | List.date | Observation.effective.as(dateTime) | Observation.effective.as(Period) | Observation.effective.as(Timing) | Observation.effective.as(instant) | Procedure.occurrence.as(dateTime) | Procedure.occurrence.as(Period) | Procedure.occurrence.as(Timing) | (RiskAssessment.occurrence as dateTime) | SupplyRequest.authoredOn</b><br>
4033   * </p>
4034   */
4035  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
4036
4037 /**
4038   * Search parameter: <b>identifier</b>
4039   * <p>
4040   * Description: <b>Multiple Resources: 
4041
4042* [AllergyIntolerance](allergyintolerance.html): External ids for this item
4043* [CarePlan](careplan.html): External Ids for this plan
4044* [CareTeam](careteam.html): External Ids for this team
4045* [Composition](composition.html): Version-independent identifier for the Composition
4046* [Condition](condition.html): A unique identifier of the condition record
4047* [Consent](consent.html): Identifier for this record (external references)
4048* [DetectedIssue](detectedissue.html): Unique id for the detected issue
4049* [DeviceRequest](devicerequest.html): Business identifier for request/order
4050* [DiagnosticReport](diagnosticreport.html): An identifier for the report
4051* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
4052* [DocumentReference](documentreference.html): Identifier of the attachment binary
4053* [Encounter](encounter.html): Identifier(s) by which this encounter is known
4054* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
4055* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
4056* [Goal](goal.html): External Ids for this goal
4057* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
4058* [Immunization](immunization.html): Business identifier
4059* [List](list.html): Business identifier
4060* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
4061* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
4062* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
4063* [MedicationUsage](medicationusage.html): Return statements with this external identifier
4064* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
4065* [Observation](observation.html): The unique id for a particular observation
4066* [Procedure](procedure.html): A unique identifier for a procedure
4067* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
4068* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
4069* [SupplyDelivery](supplydelivery.html): External identifier
4070* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
4071* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
4072</b><br>
4073   * Type: <b>token</b><br>
4074   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
4075   * </p>
4076   */
4077  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [Composition](composition.html): Version-independent identifier for the Composition\r\n* [Condition](condition.html): A unique identifier of the condition record\r\n* [Consent](consent.html): Identifier for this record (external references)\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents\r\n* [DocumentReference](documentreference.html): Identifier of the attachment binary\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID\r\n* [Immunization](immunization.html): Business identifier\r\n* [List](list.html): Business identifier\r\n* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier\r\n* [MedicationUsage](medicationusage.html): Return statements with this external identifier\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier\r\n* [Observation](observation.html): The unique id for a particular observation\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
4078  public static final String SP_IDENTIFIER = "identifier";
4079 /**
4080   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4081   * <p>
4082   * Description: <b>Multiple Resources: 
4083
4084* [AllergyIntolerance](allergyintolerance.html): External ids for this item
4085* [CarePlan](careplan.html): External Ids for this plan
4086* [CareTeam](careteam.html): External Ids for this team
4087* [Composition](composition.html): Version-independent identifier for the Composition
4088* [Condition](condition.html): A unique identifier of the condition record
4089* [Consent](consent.html): Identifier for this record (external references)
4090* [DetectedIssue](detectedissue.html): Unique id for the detected issue
4091* [DeviceRequest](devicerequest.html): Business identifier for request/order
4092* [DiagnosticReport](diagnosticreport.html): An identifier for the report
4093* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
4094* [DocumentReference](documentreference.html): Identifier of the attachment binary
4095* [Encounter](encounter.html): Identifier(s) by which this encounter is known
4096* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
4097* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
4098* [Goal](goal.html): External Ids for this goal
4099* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
4100* [Immunization](immunization.html): Business identifier
4101* [List](list.html): Business identifier
4102* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
4103* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
4104* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
4105* [MedicationUsage](medicationusage.html): Return statements with this external identifier
4106* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
4107* [Observation](observation.html): The unique id for a particular observation
4108* [Procedure](procedure.html): A unique identifier for a procedure
4109* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
4110* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
4111* [SupplyDelivery](supplydelivery.html): External identifier
4112* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
4113* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
4114</b><br>
4115   * Type: <b>token</b><br>
4116   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
4117   * </p>
4118   */
4119  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4120
4121 /**
4122   * Search parameter: <b>patient</b>
4123   * <p>
4124   * Description: <b>Multiple Resources: 
4125
4126* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
4127* [CarePlan](careplan.html): Who the care plan is for
4128* [CareTeam](careteam.html): Who care team is for
4129* [ClinicalImpression](clinicalimpression.html): Patient assessed
4130* [Composition](composition.html): Who and/or what the composition is about
4131* [Condition](condition.html): Who has the condition?
4132* [Consent](consent.html): Who the consent applies to
4133* [DetectedIssue](detectedissue.html): Associated patient
4134* [DeviceRequest](devicerequest.html): Individual the service is ordered for
4135* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
4136* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
4137* [DocumentManifest](documentmanifest.html): The subject of the set of documents
4138* [DocumentReference](documentreference.html): Who/what is the subject of the document
4139* [Encounter](encounter.html): The patient present at the encounter
4140* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
4141* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
4142* [Flag](flag.html): The identity of a subject to list flags for
4143* [Goal](goal.html): Who this goal is intended for
4144* [ImagingStudy](imagingstudy.html): Who the study is about
4145* [Immunization](immunization.html): The patient for the vaccination record
4146* [List](list.html): If all resources have the same subject
4147* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
4148* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
4149* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
4150* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
4151* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
4152* [Observation](observation.html): The subject that the observation is about (if patient)
4153* [Procedure](procedure.html): Search by subject - a patient
4154* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
4155* [ServiceRequest](servicerequest.html): Search by subject - a patient
4156* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
4157* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
4158* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
4159</b><br>
4160   * Type: <b>reference</b><br>
4161   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.subject | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | VisionPrescription.patient</b><br>
4162   * </p>
4163   */
4164  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.subject | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentManifest](documentmanifest.html): The subject of the set of documents\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [List](list.html): If all resources have the same subject\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", target={BiologicallyDerivedProduct.class, Device.class, Group.class, Location.class, Medication.class, NutritionProduct.class, Organization.class, Patient.class, Practitioner.class, Procedure.class, Substance.class } )
4165  public static final String SP_PATIENT = "patient";
4166 /**
4167   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4168   * <p>
4169   * Description: <b>Multiple Resources: 
4170
4171* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
4172* [CarePlan](careplan.html): Who the care plan is for
4173* [CareTeam](careteam.html): Who care team is for
4174* [ClinicalImpression](clinicalimpression.html): Patient assessed
4175* [Composition](composition.html): Who and/or what the composition is about
4176* [Condition](condition.html): Who has the condition?
4177* [Consent](consent.html): Who the consent applies to
4178* [DetectedIssue](detectedissue.html): Associated patient
4179* [DeviceRequest](devicerequest.html): Individual the service is ordered for
4180* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
4181* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
4182* [DocumentManifest](documentmanifest.html): The subject of the set of documents
4183* [DocumentReference](documentreference.html): Who/what is the subject of the document
4184* [Encounter](encounter.html): The patient present at the encounter
4185* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
4186* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
4187* [Flag](flag.html): The identity of a subject to list flags for
4188* [Goal](goal.html): Who this goal is intended for
4189* [ImagingStudy](imagingstudy.html): Who the study is about
4190* [Immunization](immunization.html): The patient for the vaccination record
4191* [List](list.html): If all resources have the same subject
4192* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
4193* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
4194* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
4195* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
4196* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
4197* [Observation](observation.html): The subject that the observation is about (if patient)
4198* [Procedure](procedure.html): Search by subject - a patient
4199* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
4200* [ServiceRequest](servicerequest.html): Search by subject - a patient
4201* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
4202* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
4203* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
4204</b><br>
4205   * Type: <b>reference</b><br>
4206   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.subject | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | VisionPrescription.patient</b><br>
4207   * </p>
4208   */
4209  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4210
4211/**
4212   * Constant for fluent queries to be used to add include statements. Specifies
4213   * the path value of "<b>Consent:patient</b>".
4214   */
4215  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Consent:patient").toLocked();
4216
4217
4218}