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