001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.r5.model.Enumerations.*;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.ICompositeType;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.ChildOrder;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.Block;
048
049/**
050 * Regulatory approval, clearance or licencing related to a regulated product, treatment, facility or activity that is cited in a guidance, regulation, rule or legislative act. An example is Market Authorization relating to a Medicinal Product.
051 */
052@ResourceDef(name="RegulatedAuthorization", profile="http://hl7.org/fhir/StructureDefinition/RegulatedAuthorization")
053public class RegulatedAuthorization extends DomainResource {
054
055    @Block()
056    public static class RegulatedAuthorizationCaseComponent extends BackboneElement implements IBaseBackboneElement {
057        /**
058         * Identifier by which this case can be referenced.
059         */
060        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
061        @Description(shortDefinition="Identifier by which this case can be referenced", formalDefinition="Identifier by which this case can be referenced." )
062        protected Identifier identifier;
063
064        /**
065         * The defining type of case.
066         */
067        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
068        @Description(shortDefinition="The defining type of case", formalDefinition="The defining type of case." )
069        protected CodeableConcept type;
070
071        /**
072         * The status associated with the case.
073         */
074        @Child(name = "status", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
075        @Description(shortDefinition="The status associated with the case", formalDefinition="The status associated with the case." )
076        protected CodeableConcept status;
077
078        /**
079         * Relevant date for this of case.
080         */
081        @Child(name = "date", type = {Period.class, DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
082        @Description(shortDefinition="Relevant date for this of case", formalDefinition="Relevant date for this of case." )
083        protected DataType date;
084
085        /**
086         * Applications submitted to obtain a marketing authorization. Steps within the longer running case or procedure.
087         */
088        @Child(name = "application", type = {RegulatedAuthorizationCaseComponent.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
089        @Description(shortDefinition="Applications submitted to obtain a marketing authorization. Steps within the longer running case or procedure", formalDefinition="Applications submitted to obtain a marketing authorization. Steps within the longer running case or procedure." )
090        protected List<RegulatedAuthorizationCaseComponent> application;
091
092        private static final long serialVersionUID = 2052202113L;
093
094    /**
095     * Constructor
096     */
097      public RegulatedAuthorizationCaseComponent() {
098        super();
099      }
100
101        /**
102         * @return {@link #identifier} (Identifier by which this case can be referenced.)
103         */
104        public Identifier getIdentifier() { 
105          if (this.identifier == null)
106            if (Configuration.errorOnAutoCreate())
107              throw new Error("Attempt to auto-create RegulatedAuthorizationCaseComponent.identifier");
108            else if (Configuration.doAutoCreate())
109              this.identifier = new Identifier(); // cc
110          return this.identifier;
111        }
112
113        public boolean hasIdentifier() { 
114          return this.identifier != null && !this.identifier.isEmpty();
115        }
116
117        /**
118         * @param value {@link #identifier} (Identifier by which this case can be referenced.)
119         */
120        public RegulatedAuthorizationCaseComponent setIdentifier(Identifier value) { 
121          this.identifier = value;
122          return this;
123        }
124
125        /**
126         * @return {@link #type} (The defining type of case.)
127         */
128        public CodeableConcept getType() { 
129          if (this.type == null)
130            if (Configuration.errorOnAutoCreate())
131              throw new Error("Attempt to auto-create RegulatedAuthorizationCaseComponent.type");
132            else if (Configuration.doAutoCreate())
133              this.type = new CodeableConcept(); // cc
134          return this.type;
135        }
136
137        public boolean hasType() { 
138          return this.type != null && !this.type.isEmpty();
139        }
140
141        /**
142         * @param value {@link #type} (The defining type of case.)
143         */
144        public RegulatedAuthorizationCaseComponent setType(CodeableConcept value) { 
145          this.type = value;
146          return this;
147        }
148
149        /**
150         * @return {@link #status} (The status associated with the case.)
151         */
152        public CodeableConcept getStatus() { 
153          if (this.status == null)
154            if (Configuration.errorOnAutoCreate())
155              throw new Error("Attempt to auto-create RegulatedAuthorizationCaseComponent.status");
156            else if (Configuration.doAutoCreate())
157              this.status = new CodeableConcept(); // cc
158          return this.status;
159        }
160
161        public boolean hasStatus() { 
162          return this.status != null && !this.status.isEmpty();
163        }
164
165        /**
166         * @param value {@link #status} (The status associated with the case.)
167         */
168        public RegulatedAuthorizationCaseComponent setStatus(CodeableConcept value) { 
169          this.status = value;
170          return this;
171        }
172
173        /**
174         * @return {@link #date} (Relevant date for this of case.)
175         */
176        public DataType getDate() { 
177          return this.date;
178        }
179
180        /**
181         * @return {@link #date} (Relevant date for this of case.)
182         */
183        public Period getDatePeriod() throws FHIRException { 
184          if (this.date == null)
185            this.date = new Period();
186          if (!(this.date instanceof Period))
187            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.date.getClass().getName()+" was encountered");
188          return (Period) this.date;
189        }
190
191        public boolean hasDatePeriod() { 
192          return this != null && this.date instanceof Period;
193        }
194
195        /**
196         * @return {@link #date} (Relevant date for this of case.)
197         */
198        public DateTimeType getDateDateTimeType() throws FHIRException { 
199          if (this.date == null)
200            this.date = new DateTimeType();
201          if (!(this.date instanceof DateTimeType))
202            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.date.getClass().getName()+" was encountered");
203          return (DateTimeType) this.date;
204        }
205
206        public boolean hasDateDateTimeType() { 
207          return this != null && this.date instanceof DateTimeType;
208        }
209
210        public boolean hasDate() { 
211          return this.date != null && !this.date.isEmpty();
212        }
213
214        /**
215         * @param value {@link #date} (Relevant date for this of case.)
216         */
217        public RegulatedAuthorizationCaseComponent setDate(DataType value) { 
218          if (value != null && !(value instanceof Period || value instanceof DateTimeType))
219            throw new Error("Not the right type for RegulatedAuthorization.case.date[x]: "+value.fhirType());
220          this.date = value;
221          return this;
222        }
223
224        /**
225         * @return {@link #application} (Applications submitted to obtain a marketing authorization. Steps within the longer running case or procedure.)
226         */
227        public List<RegulatedAuthorizationCaseComponent> getApplication() { 
228          if (this.application == null)
229            this.application = new ArrayList<RegulatedAuthorizationCaseComponent>();
230          return this.application;
231        }
232
233        /**
234         * @return Returns a reference to <code>this</code> for easy method chaining
235         */
236        public RegulatedAuthorizationCaseComponent setApplication(List<RegulatedAuthorizationCaseComponent> theApplication) { 
237          this.application = theApplication;
238          return this;
239        }
240
241        public boolean hasApplication() { 
242          if (this.application == null)
243            return false;
244          for (RegulatedAuthorizationCaseComponent item : this.application)
245            if (!item.isEmpty())
246              return true;
247          return false;
248        }
249
250        public RegulatedAuthorizationCaseComponent addApplication() { //3
251          RegulatedAuthorizationCaseComponent t = new RegulatedAuthorizationCaseComponent();
252          if (this.application == null)
253            this.application = new ArrayList<RegulatedAuthorizationCaseComponent>();
254          this.application.add(t);
255          return t;
256        }
257
258        public RegulatedAuthorizationCaseComponent addApplication(RegulatedAuthorizationCaseComponent t) { //3
259          if (t == null)
260            return this;
261          if (this.application == null)
262            this.application = new ArrayList<RegulatedAuthorizationCaseComponent>();
263          this.application.add(t);
264          return this;
265        }
266
267        /**
268         * @return The first repetition of repeating field {@link #application}, creating it if it does not already exist {3}
269         */
270        public RegulatedAuthorizationCaseComponent getApplicationFirstRep() { 
271          if (getApplication().isEmpty()) {
272            addApplication();
273          }
274          return getApplication().get(0);
275        }
276
277        protected void listChildren(List<Property> children) {
278          super.listChildren(children);
279          children.add(new Property("identifier", "Identifier", "Identifier by which this case can be referenced.", 0, 1, identifier));
280          children.add(new Property("type", "CodeableConcept", "The defining type of case.", 0, 1, type));
281          children.add(new Property("status", "CodeableConcept", "The status associated with the case.", 0, 1, status));
282          children.add(new Property("date[x]", "Period|dateTime", "Relevant date for this of case.", 0, 1, date));
283          children.add(new Property("application", "@RegulatedAuthorization.case", "Applications submitted to obtain a marketing authorization. Steps within the longer running case or procedure.", 0, java.lang.Integer.MAX_VALUE, application));
284        }
285
286        @Override
287        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
288          switch (_hash) {
289          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier by which this case can be referenced.", 0, 1, identifier);
290          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The defining type of case.", 0, 1, type);
291          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The status associated with the case.", 0, 1, status);
292          case 1443311122: /*date[x]*/  return new Property("date[x]", "Period|dateTime", "Relevant date for this of case.", 0, 1, date);
293          case 3076014: /*date*/  return new Property("date[x]", "Period|dateTime", "Relevant date for this of case.", 0, 1, date);
294          case 432297743: /*datePeriod*/  return new Property("date[x]", "Period", "Relevant date for this of case.", 0, 1, date);
295          case 185136489: /*dateDateTime*/  return new Property("date[x]", "dateTime", "Relevant date for this of case.", 0, 1, date);
296          case 1554253136: /*application*/  return new Property("application", "@RegulatedAuthorization.case", "Applications submitted to obtain a marketing authorization. Steps within the longer running case or procedure.", 0, java.lang.Integer.MAX_VALUE, application);
297          default: return super.getNamedProperty(_hash, _name, _checkValid);
298          }
299
300        }
301
302      @Override
303      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
304        switch (hash) {
305        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
306        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
307        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
308        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DataType
309        case 1554253136: /*application*/ return this.application == null ? new Base[0] : this.application.toArray(new Base[this.application.size()]); // RegulatedAuthorizationCaseComponent
310        default: return super.getProperty(hash, name, checkValid);
311        }
312
313      }
314
315      @Override
316      public Base setProperty(int hash, String name, Base value) throws FHIRException {
317        switch (hash) {
318        case -1618432855: // identifier
319          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
320          return value;
321        case 3575610: // type
322          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
323          return value;
324        case -892481550: // status
325          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
326          return value;
327        case 3076014: // date
328          this.date = TypeConvertor.castToType(value); // DataType
329          return value;
330        case 1554253136: // application
331          this.getApplication().add((RegulatedAuthorizationCaseComponent) value); // RegulatedAuthorizationCaseComponent
332          return value;
333        default: return super.setProperty(hash, name, value);
334        }
335
336      }
337
338      @Override
339      public Base setProperty(String name, Base value) throws FHIRException {
340        if (name.equals("identifier")) {
341          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
342        } else if (name.equals("type")) {
343          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
344        } else if (name.equals("status")) {
345          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
346        } else if (name.equals("date[x]")) {
347          this.date = TypeConvertor.castToType(value); // DataType
348        } else if (name.equals("application")) {
349          this.getApplication().add((RegulatedAuthorizationCaseComponent) value);
350        } else
351          return super.setProperty(name, value);
352        return value;
353      }
354
355      @Override
356      public Base makeProperty(int hash, String name) throws FHIRException {
357        switch (hash) {
358        case -1618432855:  return getIdentifier();
359        case 3575610:  return getType();
360        case -892481550:  return getStatus();
361        case 1443311122:  return getDate();
362        case 3076014:  return getDate();
363        case 1554253136:  return addApplication(); 
364        default: return super.makeProperty(hash, name);
365        }
366
367      }
368
369      @Override
370      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
371        switch (hash) {
372        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
373        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
374        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
375        case 3076014: /*date*/ return new String[] {"Period", "dateTime"};
376        case 1554253136: /*application*/ return new String[] {"@RegulatedAuthorization.case"};
377        default: return super.getTypesForProperty(hash, name);
378        }
379
380      }
381
382      @Override
383      public Base addChild(String name) throws FHIRException {
384        if (name.equals("identifier")) {
385          this.identifier = new Identifier();
386          return this.identifier;
387        }
388        else if (name.equals("type")) {
389          this.type = new CodeableConcept();
390          return this.type;
391        }
392        else if (name.equals("status")) {
393          this.status = new CodeableConcept();
394          return this.status;
395        }
396        else if (name.equals("datePeriod")) {
397          this.date = new Period();
398          return this.date;
399        }
400        else if (name.equals("dateDateTime")) {
401          this.date = new DateTimeType();
402          return this.date;
403        }
404        else if (name.equals("application")) {
405          return addApplication();
406        }
407        else
408          return super.addChild(name);
409      }
410
411      public RegulatedAuthorizationCaseComponent copy() {
412        RegulatedAuthorizationCaseComponent dst = new RegulatedAuthorizationCaseComponent();
413        copyValues(dst);
414        return dst;
415      }
416
417      public void copyValues(RegulatedAuthorizationCaseComponent dst) {
418        super.copyValues(dst);
419        dst.identifier = identifier == null ? null : identifier.copy();
420        dst.type = type == null ? null : type.copy();
421        dst.status = status == null ? null : status.copy();
422        dst.date = date == null ? null : date.copy();
423        if (application != null) {
424          dst.application = new ArrayList<RegulatedAuthorizationCaseComponent>();
425          for (RegulatedAuthorizationCaseComponent i : application)
426            dst.application.add(i.copy());
427        };
428      }
429
430      @Override
431      public boolean equalsDeep(Base other_) {
432        if (!super.equalsDeep(other_))
433          return false;
434        if (!(other_ instanceof RegulatedAuthorizationCaseComponent))
435          return false;
436        RegulatedAuthorizationCaseComponent o = (RegulatedAuthorizationCaseComponent) other_;
437        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(status, o.status, true)
438           && compareDeep(date, o.date, true) && compareDeep(application, o.application, true);
439      }
440
441      @Override
442      public boolean equalsShallow(Base other_) {
443        if (!super.equalsShallow(other_))
444          return false;
445        if (!(other_ instanceof RegulatedAuthorizationCaseComponent))
446          return false;
447        RegulatedAuthorizationCaseComponent o = (RegulatedAuthorizationCaseComponent) other_;
448        return true;
449      }
450
451      public boolean isEmpty() {
452        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, status
453          , date, application);
454      }
455
456  public String fhirType() {
457    return "RegulatedAuthorization.case";
458
459  }
460
461  }
462
463    /**
464     * Business identifier for the authorization, typically assigned by the authorizing body.
465     */
466    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
467    @Description(shortDefinition="Business identifier for the authorization, typically assigned by the authorizing body", formalDefinition="Business identifier for the authorization, typically assigned by the authorizing body." )
468    protected List<Identifier> identifier;
469
470    /**
471     * The product type, treatment, facility or activity that is being authorized.
472     */
473    @Child(name = "subject", type = {MedicinalProductDefinition.class, BiologicallyDerivedProduct.class, NutritionProduct.class, PackagedProductDefinition.class, SubstanceDefinition.class, DeviceDefinition.class, ResearchStudy.class, ActivityDefinition.class, PlanDefinition.class, ObservationDefinition.class, Practitioner.class, Organization.class, Location.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
474    @Description(shortDefinition="The product type, treatment, facility or activity that is being authorized", formalDefinition="The product type, treatment, facility or activity that is being authorized." )
475    protected List<Reference> subject;
476
477    /**
478     * Overall type of this authorization, for example drug marketing approval, orphan drug designation.
479     */
480    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
481    @Description(shortDefinition="Overall type of this authorization, for example drug marketing approval, orphan drug designation", formalDefinition="Overall type of this authorization, for example drug marketing approval, orphan drug designation." )
482    protected CodeableConcept type;
483
484    /**
485     * General textual supporting information.
486     */
487    @Child(name = "description", type = {MarkdownType.class}, order=3, min=0, max=1, modifier=false, summary=true)
488    @Description(shortDefinition="General textual supporting information", formalDefinition="General textual supporting information." )
489    protected MarkdownType description;
490
491    /**
492     * The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted.
493     */
494    @Child(name = "region", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
495    @Description(shortDefinition="The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted", formalDefinition="The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted." )
496    protected List<CodeableConcept> region;
497
498    /**
499     * The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications.
500     */
501    @Child(name = "status", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
502    @Description(shortDefinition="The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications", formalDefinition="The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications." )
503    protected CodeableConcept status;
504
505    /**
506     * The date at which the current status was assigned.
507     */
508    @Child(name = "statusDate", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
509    @Description(shortDefinition="The date at which the current status was assigned", formalDefinition="The date at which the current status was assigned." )
510    protected DateTimeType statusDate;
511
512    /**
513     * The time period in which the regulatory approval, clearance or licencing is in effect. As an example, a Marketing Authorization includes the date of authorization and/or an expiration date.
514     */
515    @Child(name = "validityPeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
516    @Description(shortDefinition="The time period in which the regulatory approval, clearance or licencing is in effect. As an example, a Marketing Authorization includes the date of authorization and/or an expiration date", formalDefinition="The time period in which the regulatory approval, clearance or licencing is in effect. As an example, a Marketing Authorization includes the date of authorization and/or an expiration date." )
517    protected Period validityPeriod;
518
519    /**
520     * Condition for which the use of the regulated product applies.
521     */
522    @Child(name = "indication", type = {CodeableReference.class}, order=8, min=0, max=1, modifier=false, summary=true)
523    @Description(shortDefinition="Condition for which the use of the regulated product  applies", formalDefinition="Condition for which the use of the regulated product applies." )
524    protected CodeableReference indication;
525
526    /**
527     * The intended use of the product, e.g. prevention, treatment.
528     */
529    @Child(name = "intendedUse", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=true)
530    @Description(shortDefinition="The intended use of the product, e.g. prevention, treatment", formalDefinition="The intended use of the product, e.g. prevention, treatment." )
531    protected CodeableConcept intendedUse;
532
533    /**
534     * The legal or regulatory framework against which this authorization is granted, or other reasons for it.
535     */
536    @Child(name = "basis", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
537    @Description(shortDefinition="The legal or regulatory framework against which this authorization is granted, or other reasons for it", formalDefinition="The legal or regulatory framework against which this authorization is granted, or other reasons for it." )
538    protected List<CodeableConcept> basis;
539
540    /**
541     * The organization that holds the granted authorization.
542     */
543    @Child(name = "holder", type = {Organization.class}, order=11, min=0, max=1, modifier=false, summary=true)
544    @Description(shortDefinition="The organization that holds the granted authorization", formalDefinition="The organization that holds the granted authorization." )
545    protected Reference holder;
546
547    /**
548     * The regulatory authority or authorizing body granting the authorization. For example, European Medicines Agency (EMA), Food and Drug Administration (FDA), Health Canada (HC), etc.
549     */
550    @Child(name = "regulator", type = {Organization.class}, order=12, min=0, max=1, modifier=false, summary=true)
551    @Description(shortDefinition="The regulatory authority or authorizing body granting the authorization", formalDefinition="The regulatory authority or authorizing body granting the authorization. For example, European Medicines Agency (EMA), Food and Drug Administration (FDA), Health Canada (HC), etc." )
552    protected Reference regulator;
553
554    /**
555     * Additional information or supporting documentation about the authorization.
556     */
557    @Child(name = "attachedDocument", type = {DocumentReference.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
558    @Description(shortDefinition="Additional information or supporting documentation about the authorization", formalDefinition="Additional information or supporting documentation about the authorization." )
559    protected List<Reference> attachedDocument;
560
561    /**
562     * The case or regulatory procedure for granting or amending a marketing authorization. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page).
563     */
564    @Child(name = "case", type = {}, order=14, min=0, max=1, modifier=false, summary=true)
565    @Description(shortDefinition="The case or regulatory procedure for granting or amending a marketing authorization. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page)", formalDefinition="The case or regulatory procedure for granting or amending a marketing authorization. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page)." )
566    protected RegulatedAuthorizationCaseComponent case_;
567
568    private static final long serialVersionUID = 1242044467L;
569
570  /**
571   * Constructor
572   */
573    public RegulatedAuthorization() {
574      super();
575    }
576
577    /**
578     * @return {@link #identifier} (Business identifier for the authorization, typically assigned by the authorizing body.)
579     */
580    public List<Identifier> getIdentifier() { 
581      if (this.identifier == null)
582        this.identifier = new ArrayList<Identifier>();
583      return this.identifier;
584    }
585
586    /**
587     * @return Returns a reference to <code>this</code> for easy method chaining
588     */
589    public RegulatedAuthorization setIdentifier(List<Identifier> theIdentifier) { 
590      this.identifier = theIdentifier;
591      return this;
592    }
593
594    public boolean hasIdentifier() { 
595      if (this.identifier == null)
596        return false;
597      for (Identifier item : this.identifier)
598        if (!item.isEmpty())
599          return true;
600      return false;
601    }
602
603    public Identifier addIdentifier() { //3
604      Identifier t = new Identifier();
605      if (this.identifier == null)
606        this.identifier = new ArrayList<Identifier>();
607      this.identifier.add(t);
608      return t;
609    }
610
611    public RegulatedAuthorization addIdentifier(Identifier t) { //3
612      if (t == null)
613        return this;
614      if (this.identifier == null)
615        this.identifier = new ArrayList<Identifier>();
616      this.identifier.add(t);
617      return this;
618    }
619
620    /**
621     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
622     */
623    public Identifier getIdentifierFirstRep() { 
624      if (getIdentifier().isEmpty()) {
625        addIdentifier();
626      }
627      return getIdentifier().get(0);
628    }
629
630    /**
631     * @return {@link #subject} (The product type, treatment, facility or activity that is being authorized.)
632     */
633    public List<Reference> getSubject() { 
634      if (this.subject == null)
635        this.subject = new ArrayList<Reference>();
636      return this.subject;
637    }
638
639    /**
640     * @return Returns a reference to <code>this</code> for easy method chaining
641     */
642    public RegulatedAuthorization setSubject(List<Reference> theSubject) { 
643      this.subject = theSubject;
644      return this;
645    }
646
647    public boolean hasSubject() { 
648      if (this.subject == null)
649        return false;
650      for (Reference item : this.subject)
651        if (!item.isEmpty())
652          return true;
653      return false;
654    }
655
656    public Reference addSubject() { //3
657      Reference t = new Reference();
658      if (this.subject == null)
659        this.subject = new ArrayList<Reference>();
660      this.subject.add(t);
661      return t;
662    }
663
664    public RegulatedAuthorization addSubject(Reference t) { //3
665      if (t == null)
666        return this;
667      if (this.subject == null)
668        this.subject = new ArrayList<Reference>();
669      this.subject.add(t);
670      return this;
671    }
672
673    /**
674     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist {3}
675     */
676    public Reference getSubjectFirstRep() { 
677      if (getSubject().isEmpty()) {
678        addSubject();
679      }
680      return getSubject().get(0);
681    }
682
683    /**
684     * @return {@link #type} (Overall type of this authorization, for example drug marketing approval, orphan drug designation.)
685     */
686    public CodeableConcept getType() { 
687      if (this.type == null)
688        if (Configuration.errorOnAutoCreate())
689          throw new Error("Attempt to auto-create RegulatedAuthorization.type");
690        else if (Configuration.doAutoCreate())
691          this.type = new CodeableConcept(); // cc
692      return this.type;
693    }
694
695    public boolean hasType() { 
696      return this.type != null && !this.type.isEmpty();
697    }
698
699    /**
700     * @param value {@link #type} (Overall type of this authorization, for example drug marketing approval, orphan drug designation.)
701     */
702    public RegulatedAuthorization setType(CodeableConcept value) { 
703      this.type = value;
704      return this;
705    }
706
707    /**
708     * @return {@link #description} (General textual supporting information.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
709     */
710    public MarkdownType getDescriptionElement() { 
711      if (this.description == null)
712        if (Configuration.errorOnAutoCreate())
713          throw new Error("Attempt to auto-create RegulatedAuthorization.description");
714        else if (Configuration.doAutoCreate())
715          this.description = new MarkdownType(); // bb
716      return this.description;
717    }
718
719    public boolean hasDescriptionElement() { 
720      return this.description != null && !this.description.isEmpty();
721    }
722
723    public boolean hasDescription() { 
724      return this.description != null && !this.description.isEmpty();
725    }
726
727    /**
728     * @param value {@link #description} (General textual supporting information.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
729     */
730    public RegulatedAuthorization setDescriptionElement(MarkdownType value) { 
731      this.description = value;
732      return this;
733    }
734
735    /**
736     * @return General textual supporting information.
737     */
738    public String getDescription() { 
739      return this.description == null ? null : this.description.getValue();
740    }
741
742    /**
743     * @param value General textual supporting information.
744     */
745    public RegulatedAuthorization setDescription(String value) { 
746      if (value == null)
747        this.description = null;
748      else {
749        if (this.description == null)
750          this.description = new MarkdownType();
751        this.description.setValue(value);
752      }
753      return this;
754    }
755
756    /**
757     * @return {@link #region} (The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted.)
758     */
759    public List<CodeableConcept> getRegion() { 
760      if (this.region == null)
761        this.region = new ArrayList<CodeableConcept>();
762      return this.region;
763    }
764
765    /**
766     * @return Returns a reference to <code>this</code> for easy method chaining
767     */
768    public RegulatedAuthorization setRegion(List<CodeableConcept> theRegion) { 
769      this.region = theRegion;
770      return this;
771    }
772
773    public boolean hasRegion() { 
774      if (this.region == null)
775        return false;
776      for (CodeableConcept item : this.region)
777        if (!item.isEmpty())
778          return true;
779      return false;
780    }
781
782    public CodeableConcept addRegion() { //3
783      CodeableConcept t = new CodeableConcept();
784      if (this.region == null)
785        this.region = new ArrayList<CodeableConcept>();
786      this.region.add(t);
787      return t;
788    }
789
790    public RegulatedAuthorization addRegion(CodeableConcept t) { //3
791      if (t == null)
792        return this;
793      if (this.region == null)
794        this.region = new ArrayList<CodeableConcept>();
795      this.region.add(t);
796      return this;
797    }
798
799    /**
800     * @return The first repetition of repeating field {@link #region}, creating it if it does not already exist {3}
801     */
802    public CodeableConcept getRegionFirstRep() { 
803      if (getRegion().isEmpty()) {
804        addRegion();
805      }
806      return getRegion().get(0);
807    }
808
809    /**
810     * @return {@link #status} (The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications.)
811     */
812    public CodeableConcept getStatus() { 
813      if (this.status == null)
814        if (Configuration.errorOnAutoCreate())
815          throw new Error("Attempt to auto-create RegulatedAuthorization.status");
816        else if (Configuration.doAutoCreate())
817          this.status = new CodeableConcept(); // cc
818      return this.status;
819    }
820
821    public boolean hasStatus() { 
822      return this.status != null && !this.status.isEmpty();
823    }
824
825    /**
826     * @param value {@link #status} (The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications.)
827     */
828    public RegulatedAuthorization setStatus(CodeableConcept value) { 
829      this.status = value;
830      return this;
831    }
832
833    /**
834     * @return {@link #statusDate} (The date at which the current status was assigned.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
835     */
836    public DateTimeType getStatusDateElement() { 
837      if (this.statusDate == null)
838        if (Configuration.errorOnAutoCreate())
839          throw new Error("Attempt to auto-create RegulatedAuthorization.statusDate");
840        else if (Configuration.doAutoCreate())
841          this.statusDate = new DateTimeType(); // bb
842      return this.statusDate;
843    }
844
845    public boolean hasStatusDateElement() { 
846      return this.statusDate != null && !this.statusDate.isEmpty();
847    }
848
849    public boolean hasStatusDate() { 
850      return this.statusDate != null && !this.statusDate.isEmpty();
851    }
852
853    /**
854     * @param value {@link #statusDate} (The date at which the current status was assigned.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
855     */
856    public RegulatedAuthorization setStatusDateElement(DateTimeType value) { 
857      this.statusDate = value;
858      return this;
859    }
860
861    /**
862     * @return The date at which the current status was assigned.
863     */
864    public Date getStatusDate() { 
865      return this.statusDate == null ? null : this.statusDate.getValue();
866    }
867
868    /**
869     * @param value The date at which the current status was assigned.
870     */
871    public RegulatedAuthorization setStatusDate(Date value) { 
872      if (value == null)
873        this.statusDate = null;
874      else {
875        if (this.statusDate == null)
876          this.statusDate = new DateTimeType();
877        this.statusDate.setValue(value);
878      }
879      return this;
880    }
881
882    /**
883     * @return {@link #validityPeriod} (The time period in which the regulatory approval, clearance or licencing is in effect. As an example, a Marketing Authorization includes the date of authorization and/or an expiration date.)
884     */
885    public Period getValidityPeriod() { 
886      if (this.validityPeriod == null)
887        if (Configuration.errorOnAutoCreate())
888          throw new Error("Attempt to auto-create RegulatedAuthorization.validityPeriod");
889        else if (Configuration.doAutoCreate())
890          this.validityPeriod = new Period(); // cc
891      return this.validityPeriod;
892    }
893
894    public boolean hasValidityPeriod() { 
895      return this.validityPeriod != null && !this.validityPeriod.isEmpty();
896    }
897
898    /**
899     * @param value {@link #validityPeriod} (The time period in which the regulatory approval, clearance or licencing is in effect. As an example, a Marketing Authorization includes the date of authorization and/or an expiration date.)
900     */
901    public RegulatedAuthorization setValidityPeriod(Period value) { 
902      this.validityPeriod = value;
903      return this;
904    }
905
906    /**
907     * @return {@link #indication} (Condition for which the use of the regulated product applies.)
908     */
909    public CodeableReference getIndication() { 
910      if (this.indication == null)
911        if (Configuration.errorOnAutoCreate())
912          throw new Error("Attempt to auto-create RegulatedAuthorization.indication");
913        else if (Configuration.doAutoCreate())
914          this.indication = new CodeableReference(); // cc
915      return this.indication;
916    }
917
918    public boolean hasIndication() { 
919      return this.indication != null && !this.indication.isEmpty();
920    }
921
922    /**
923     * @param value {@link #indication} (Condition for which the use of the regulated product applies.)
924     */
925    public RegulatedAuthorization setIndication(CodeableReference value) { 
926      this.indication = value;
927      return this;
928    }
929
930    /**
931     * @return {@link #intendedUse} (The intended use of the product, e.g. prevention, treatment.)
932     */
933    public CodeableConcept getIntendedUse() { 
934      if (this.intendedUse == null)
935        if (Configuration.errorOnAutoCreate())
936          throw new Error("Attempt to auto-create RegulatedAuthorization.intendedUse");
937        else if (Configuration.doAutoCreate())
938          this.intendedUse = new CodeableConcept(); // cc
939      return this.intendedUse;
940    }
941
942    public boolean hasIntendedUse() { 
943      return this.intendedUse != null && !this.intendedUse.isEmpty();
944    }
945
946    /**
947     * @param value {@link #intendedUse} (The intended use of the product, e.g. prevention, treatment.)
948     */
949    public RegulatedAuthorization setIntendedUse(CodeableConcept value) { 
950      this.intendedUse = value;
951      return this;
952    }
953
954    /**
955     * @return {@link #basis} (The legal or regulatory framework against which this authorization is granted, or other reasons for it.)
956     */
957    public List<CodeableConcept> getBasis() { 
958      if (this.basis == null)
959        this.basis = new ArrayList<CodeableConcept>();
960      return this.basis;
961    }
962
963    /**
964     * @return Returns a reference to <code>this</code> for easy method chaining
965     */
966    public RegulatedAuthorization setBasis(List<CodeableConcept> theBasis) { 
967      this.basis = theBasis;
968      return this;
969    }
970
971    public boolean hasBasis() { 
972      if (this.basis == null)
973        return false;
974      for (CodeableConcept item : this.basis)
975        if (!item.isEmpty())
976          return true;
977      return false;
978    }
979
980    public CodeableConcept addBasis() { //3
981      CodeableConcept t = new CodeableConcept();
982      if (this.basis == null)
983        this.basis = new ArrayList<CodeableConcept>();
984      this.basis.add(t);
985      return t;
986    }
987
988    public RegulatedAuthorization addBasis(CodeableConcept t) { //3
989      if (t == null)
990        return this;
991      if (this.basis == null)
992        this.basis = new ArrayList<CodeableConcept>();
993      this.basis.add(t);
994      return this;
995    }
996
997    /**
998     * @return The first repetition of repeating field {@link #basis}, creating it if it does not already exist {3}
999     */
1000    public CodeableConcept getBasisFirstRep() { 
1001      if (getBasis().isEmpty()) {
1002        addBasis();
1003      }
1004      return getBasis().get(0);
1005    }
1006
1007    /**
1008     * @return {@link #holder} (The organization that holds the granted authorization.)
1009     */
1010    public Reference getHolder() { 
1011      if (this.holder == null)
1012        if (Configuration.errorOnAutoCreate())
1013          throw new Error("Attempt to auto-create RegulatedAuthorization.holder");
1014        else if (Configuration.doAutoCreate())
1015          this.holder = new Reference(); // cc
1016      return this.holder;
1017    }
1018
1019    public boolean hasHolder() { 
1020      return this.holder != null && !this.holder.isEmpty();
1021    }
1022
1023    /**
1024     * @param value {@link #holder} (The organization that holds the granted authorization.)
1025     */
1026    public RegulatedAuthorization setHolder(Reference value) { 
1027      this.holder = value;
1028      return this;
1029    }
1030
1031    /**
1032     * @return {@link #regulator} (The regulatory authority or authorizing body granting the authorization. For example, European Medicines Agency (EMA), Food and Drug Administration (FDA), Health Canada (HC), etc.)
1033     */
1034    public Reference getRegulator() { 
1035      if (this.regulator == null)
1036        if (Configuration.errorOnAutoCreate())
1037          throw new Error("Attempt to auto-create RegulatedAuthorization.regulator");
1038        else if (Configuration.doAutoCreate())
1039          this.regulator = new Reference(); // cc
1040      return this.regulator;
1041    }
1042
1043    public boolean hasRegulator() { 
1044      return this.regulator != null && !this.regulator.isEmpty();
1045    }
1046
1047    /**
1048     * @param value {@link #regulator} (The regulatory authority or authorizing body granting the authorization. For example, European Medicines Agency (EMA), Food and Drug Administration (FDA), Health Canada (HC), etc.)
1049     */
1050    public RegulatedAuthorization setRegulator(Reference value) { 
1051      this.regulator = value;
1052      return this;
1053    }
1054
1055    /**
1056     * @return {@link #attachedDocument} (Additional information or supporting documentation about the authorization.)
1057     */
1058    public List<Reference> getAttachedDocument() { 
1059      if (this.attachedDocument == null)
1060        this.attachedDocument = new ArrayList<Reference>();
1061      return this.attachedDocument;
1062    }
1063
1064    /**
1065     * @return Returns a reference to <code>this</code> for easy method chaining
1066     */
1067    public RegulatedAuthorization setAttachedDocument(List<Reference> theAttachedDocument) { 
1068      this.attachedDocument = theAttachedDocument;
1069      return this;
1070    }
1071
1072    public boolean hasAttachedDocument() { 
1073      if (this.attachedDocument == null)
1074        return false;
1075      for (Reference item : this.attachedDocument)
1076        if (!item.isEmpty())
1077          return true;
1078      return false;
1079    }
1080
1081    public Reference addAttachedDocument() { //3
1082      Reference t = new Reference();
1083      if (this.attachedDocument == null)
1084        this.attachedDocument = new ArrayList<Reference>();
1085      this.attachedDocument.add(t);
1086      return t;
1087    }
1088
1089    public RegulatedAuthorization addAttachedDocument(Reference t) { //3
1090      if (t == null)
1091        return this;
1092      if (this.attachedDocument == null)
1093        this.attachedDocument = new ArrayList<Reference>();
1094      this.attachedDocument.add(t);
1095      return this;
1096    }
1097
1098    /**
1099     * @return The first repetition of repeating field {@link #attachedDocument}, creating it if it does not already exist {3}
1100     */
1101    public Reference getAttachedDocumentFirstRep() { 
1102      if (getAttachedDocument().isEmpty()) {
1103        addAttachedDocument();
1104      }
1105      return getAttachedDocument().get(0);
1106    }
1107
1108    /**
1109     * @return {@link #case_} (The case or regulatory procedure for granting or amending a marketing authorization. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page).)
1110     */
1111    public RegulatedAuthorizationCaseComponent getCase() { 
1112      if (this.case_ == null)
1113        if (Configuration.errorOnAutoCreate())
1114          throw new Error("Attempt to auto-create RegulatedAuthorization.case_");
1115        else if (Configuration.doAutoCreate())
1116          this.case_ = new RegulatedAuthorizationCaseComponent(); // cc
1117      return this.case_;
1118    }
1119
1120    public boolean hasCase() { 
1121      return this.case_ != null && !this.case_.isEmpty();
1122    }
1123
1124    /**
1125     * @param value {@link #case_} (The case or regulatory procedure for granting or amending a marketing authorization. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page).)
1126     */
1127    public RegulatedAuthorization setCase(RegulatedAuthorizationCaseComponent value) { 
1128      this.case_ = value;
1129      return this;
1130    }
1131
1132      protected void listChildren(List<Property> children) {
1133        super.listChildren(children);
1134        children.add(new Property("identifier", "Identifier", "Business identifier for the authorization, typically assigned by the authorizing body.", 0, java.lang.Integer.MAX_VALUE, identifier));
1135        children.add(new Property("subject", "Reference(MedicinalProductDefinition|BiologicallyDerivedProduct|NutritionProduct|PackagedProductDefinition|SubstanceDefinition|DeviceDefinition|ResearchStudy|ActivityDefinition|PlanDefinition|ObservationDefinition|Practitioner|Organization|Location)", "The product type, treatment, facility or activity that is being authorized.", 0, java.lang.Integer.MAX_VALUE, subject));
1136        children.add(new Property("type", "CodeableConcept", "Overall type of this authorization, for example drug marketing approval, orphan drug designation.", 0, 1, type));
1137        children.add(new Property("description", "markdown", "General textual supporting information.", 0, 1, description));
1138        children.add(new Property("region", "CodeableConcept", "The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted.", 0, java.lang.Integer.MAX_VALUE, region));
1139        children.add(new Property("status", "CodeableConcept", "The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications.", 0, 1, status));
1140        children.add(new Property("statusDate", "dateTime", "The date at which the current status was assigned.", 0, 1, statusDate));
1141        children.add(new Property("validityPeriod", "Period", "The time period in which the regulatory approval, clearance or licencing is in effect. As an example, a Marketing Authorization includes the date of authorization and/or an expiration date.", 0, 1, validityPeriod));
1142        children.add(new Property("indication", "CodeableReference(ClinicalUseDefinition)", "Condition for which the use of the regulated product applies.", 0, 1, indication));
1143        children.add(new Property("intendedUse", "CodeableConcept", "The intended use of the product, e.g. prevention, treatment.", 0, 1, intendedUse));
1144        children.add(new Property("basis", "CodeableConcept", "The legal or regulatory framework against which this authorization is granted, or other reasons for it.", 0, java.lang.Integer.MAX_VALUE, basis));
1145        children.add(new Property("holder", "Reference(Organization)", "The organization that holds the granted authorization.", 0, 1, holder));
1146        children.add(new Property("regulator", "Reference(Organization)", "The regulatory authority or authorizing body granting the authorization. For example, European Medicines Agency (EMA), Food and Drug Administration (FDA), Health Canada (HC), etc.", 0, 1, regulator));
1147        children.add(new Property("attachedDocument", "Reference(DocumentReference)", "Additional information or supporting documentation about the authorization.", 0, java.lang.Integer.MAX_VALUE, attachedDocument));
1148        children.add(new Property("case", "", "The case or regulatory procedure for granting or amending a marketing authorization. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page).", 0, 1, case_));
1149      }
1150
1151      @Override
1152      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1153        switch (_hash) {
1154        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifier for the authorization, typically assigned by the authorizing body.", 0, java.lang.Integer.MAX_VALUE, identifier);
1155        case -1867885268: /*subject*/  return new Property("subject", "Reference(MedicinalProductDefinition|BiologicallyDerivedProduct|NutritionProduct|PackagedProductDefinition|SubstanceDefinition|DeviceDefinition|ResearchStudy|ActivityDefinition|PlanDefinition|ObservationDefinition|Practitioner|Organization|Location)", "The product type, treatment, facility or activity that is being authorized.", 0, java.lang.Integer.MAX_VALUE, subject);
1156        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Overall type of this authorization, for example drug marketing approval, orphan drug designation.", 0, 1, type);
1157        case -1724546052: /*description*/  return new Property("description", "markdown", "General textual supporting information.", 0, 1, description);
1158        case -934795532: /*region*/  return new Property("region", "CodeableConcept", "The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted.", 0, java.lang.Integer.MAX_VALUE, region);
1159        case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications.", 0, 1, status);
1160        case 247524032: /*statusDate*/  return new Property("statusDate", "dateTime", "The date at which the current status was assigned.", 0, 1, statusDate);
1161        case -1434195053: /*validityPeriod*/  return new Property("validityPeriod", "Period", "The time period in which the regulatory approval, clearance or licencing is in effect. As an example, a Marketing Authorization includes the date of authorization and/or an expiration date.", 0, 1, validityPeriod);
1162        case -597168804: /*indication*/  return new Property("indication", "CodeableReference(ClinicalUseDefinition)", "Condition for which the use of the regulated product applies.", 0, 1, indication);
1163        case -1618671268: /*intendedUse*/  return new Property("intendedUse", "CodeableConcept", "The intended use of the product, e.g. prevention, treatment.", 0, 1, intendedUse);
1164        case 93508670: /*basis*/  return new Property("basis", "CodeableConcept", "The legal or regulatory framework against which this authorization is granted, or other reasons for it.", 0, java.lang.Integer.MAX_VALUE, basis);
1165        case -1211707988: /*holder*/  return new Property("holder", "Reference(Organization)", "The organization that holds the granted authorization.", 0, 1, holder);
1166        case 414760449: /*regulator*/  return new Property("regulator", "Reference(Organization)", "The regulatory authority or authorizing body granting the authorization. For example, European Medicines Agency (EMA), Food and Drug Administration (FDA), Health Canada (HC), etc.", 0, 1, regulator);
1167        case -513945889: /*attachedDocument*/  return new Property("attachedDocument", "Reference(DocumentReference)", "Additional information or supporting documentation about the authorization.", 0, java.lang.Integer.MAX_VALUE, attachedDocument);
1168        case 3046192: /*case*/  return new Property("case", "", "The case or regulatory procedure for granting or amending a marketing authorization. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page).", 0, 1, case_);
1169        default: return super.getNamedProperty(_hash, _name, _checkValid);
1170        }
1171
1172      }
1173
1174      @Override
1175      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1176        switch (hash) {
1177        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1178        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
1179        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1180        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
1181        case -934795532: /*region*/ return this.region == null ? new Base[0] : this.region.toArray(new Base[this.region.size()]); // CodeableConcept
1182        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
1183        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : new Base[] {this.statusDate}; // DateTimeType
1184        case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period
1185        case -597168804: /*indication*/ return this.indication == null ? new Base[0] : new Base[] {this.indication}; // CodeableReference
1186        case -1618671268: /*intendedUse*/ return this.intendedUse == null ? new Base[0] : new Base[] {this.intendedUse}; // CodeableConcept
1187        case 93508670: /*basis*/ return this.basis == null ? new Base[0] : this.basis.toArray(new Base[this.basis.size()]); // CodeableConcept
1188        case -1211707988: /*holder*/ return this.holder == null ? new Base[0] : new Base[] {this.holder}; // Reference
1189        case 414760449: /*regulator*/ return this.regulator == null ? new Base[0] : new Base[] {this.regulator}; // Reference
1190        case -513945889: /*attachedDocument*/ return this.attachedDocument == null ? new Base[0] : this.attachedDocument.toArray(new Base[this.attachedDocument.size()]); // Reference
1191        case 3046192: /*case*/ return this.case_ == null ? new Base[0] : new Base[] {this.case_}; // RegulatedAuthorizationCaseComponent
1192        default: return super.getProperty(hash, name, checkValid);
1193        }
1194
1195      }
1196
1197      @Override
1198      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1199        switch (hash) {
1200        case -1618432855: // identifier
1201          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1202          return value;
1203        case -1867885268: // subject
1204          this.getSubject().add(TypeConvertor.castToReference(value)); // Reference
1205          return value;
1206        case 3575610: // type
1207          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1208          return value;
1209        case -1724546052: // description
1210          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
1211          return value;
1212        case -934795532: // region
1213          this.getRegion().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1214          return value;
1215        case -892481550: // status
1216          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1217          return value;
1218        case 247524032: // statusDate
1219          this.statusDate = TypeConvertor.castToDateTime(value); // DateTimeType
1220          return value;
1221        case -1434195053: // validityPeriod
1222          this.validityPeriod = TypeConvertor.castToPeriod(value); // Period
1223          return value;
1224        case -597168804: // indication
1225          this.indication = TypeConvertor.castToCodeableReference(value); // CodeableReference
1226          return value;
1227        case -1618671268: // intendedUse
1228          this.intendedUse = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1229          return value;
1230        case 93508670: // basis
1231          this.getBasis().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1232          return value;
1233        case -1211707988: // holder
1234          this.holder = TypeConvertor.castToReference(value); // Reference
1235          return value;
1236        case 414760449: // regulator
1237          this.regulator = TypeConvertor.castToReference(value); // Reference
1238          return value;
1239        case -513945889: // attachedDocument
1240          this.getAttachedDocument().add(TypeConvertor.castToReference(value)); // Reference
1241          return value;
1242        case 3046192: // case
1243          this.case_ = (RegulatedAuthorizationCaseComponent) value; // RegulatedAuthorizationCaseComponent
1244          return value;
1245        default: return super.setProperty(hash, name, value);
1246        }
1247
1248      }
1249
1250      @Override
1251      public Base setProperty(String name, Base value) throws FHIRException {
1252        if (name.equals("identifier")) {
1253          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1254        } else if (name.equals("subject")) {
1255          this.getSubject().add(TypeConvertor.castToReference(value));
1256        } else if (name.equals("type")) {
1257          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1258        } else if (name.equals("description")) {
1259          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
1260        } else if (name.equals("region")) {
1261          this.getRegion().add(TypeConvertor.castToCodeableConcept(value));
1262        } else if (name.equals("status")) {
1263          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1264        } else if (name.equals("statusDate")) {
1265          this.statusDate = TypeConvertor.castToDateTime(value); // DateTimeType
1266        } else if (name.equals("validityPeriod")) {
1267          this.validityPeriod = TypeConvertor.castToPeriod(value); // Period
1268        } else if (name.equals("indication")) {
1269          this.indication = TypeConvertor.castToCodeableReference(value); // CodeableReference
1270        } else if (name.equals("intendedUse")) {
1271          this.intendedUse = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1272        } else if (name.equals("basis")) {
1273          this.getBasis().add(TypeConvertor.castToCodeableConcept(value));
1274        } else if (name.equals("holder")) {
1275          this.holder = TypeConvertor.castToReference(value); // Reference
1276        } else if (name.equals("regulator")) {
1277          this.regulator = TypeConvertor.castToReference(value); // Reference
1278        } else if (name.equals("attachedDocument")) {
1279          this.getAttachedDocument().add(TypeConvertor.castToReference(value));
1280        } else if (name.equals("case")) {
1281          this.case_ = (RegulatedAuthorizationCaseComponent) value; // RegulatedAuthorizationCaseComponent
1282        } else
1283          return super.setProperty(name, value);
1284        return value;
1285      }
1286
1287      @Override
1288      public Base makeProperty(int hash, String name) throws FHIRException {
1289        switch (hash) {
1290        case -1618432855:  return addIdentifier(); 
1291        case -1867885268:  return addSubject(); 
1292        case 3575610:  return getType();
1293        case -1724546052:  return getDescriptionElement();
1294        case -934795532:  return addRegion(); 
1295        case -892481550:  return getStatus();
1296        case 247524032:  return getStatusDateElement();
1297        case -1434195053:  return getValidityPeriod();
1298        case -597168804:  return getIndication();
1299        case -1618671268:  return getIntendedUse();
1300        case 93508670:  return addBasis(); 
1301        case -1211707988:  return getHolder();
1302        case 414760449:  return getRegulator();
1303        case -513945889:  return addAttachedDocument(); 
1304        case 3046192:  return getCase();
1305        default: return super.makeProperty(hash, name);
1306        }
1307
1308      }
1309
1310      @Override
1311      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1312        switch (hash) {
1313        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1314        case -1867885268: /*subject*/ return new String[] {"Reference"};
1315        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1316        case -1724546052: /*description*/ return new String[] {"markdown"};
1317        case -934795532: /*region*/ return new String[] {"CodeableConcept"};
1318        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
1319        case 247524032: /*statusDate*/ return new String[] {"dateTime"};
1320        case -1434195053: /*validityPeriod*/ return new String[] {"Period"};
1321        case -597168804: /*indication*/ return new String[] {"CodeableReference"};
1322        case -1618671268: /*intendedUse*/ return new String[] {"CodeableConcept"};
1323        case 93508670: /*basis*/ return new String[] {"CodeableConcept"};
1324        case -1211707988: /*holder*/ return new String[] {"Reference"};
1325        case 414760449: /*regulator*/ return new String[] {"Reference"};
1326        case -513945889: /*attachedDocument*/ return new String[] {"Reference"};
1327        case 3046192: /*case*/ return new String[] {};
1328        default: return super.getTypesForProperty(hash, name);
1329        }
1330
1331      }
1332
1333      @Override
1334      public Base addChild(String name) throws FHIRException {
1335        if (name.equals("identifier")) {
1336          return addIdentifier();
1337        }
1338        else if (name.equals("subject")) {
1339          return addSubject();
1340        }
1341        else if (name.equals("type")) {
1342          this.type = new CodeableConcept();
1343          return this.type;
1344        }
1345        else if (name.equals("description")) {
1346          throw new FHIRException("Cannot call addChild on a primitive type RegulatedAuthorization.description");
1347        }
1348        else if (name.equals("region")) {
1349          return addRegion();
1350        }
1351        else if (name.equals("status")) {
1352          this.status = new CodeableConcept();
1353          return this.status;
1354        }
1355        else if (name.equals("statusDate")) {
1356          throw new FHIRException("Cannot call addChild on a primitive type RegulatedAuthorization.statusDate");
1357        }
1358        else if (name.equals("validityPeriod")) {
1359          this.validityPeriod = new Period();
1360          return this.validityPeriod;
1361        }
1362        else if (name.equals("indication")) {
1363          this.indication = new CodeableReference();
1364          return this.indication;
1365        }
1366        else if (name.equals("intendedUse")) {
1367          this.intendedUse = new CodeableConcept();
1368          return this.intendedUse;
1369        }
1370        else if (name.equals("basis")) {
1371          return addBasis();
1372        }
1373        else if (name.equals("holder")) {
1374          this.holder = new Reference();
1375          return this.holder;
1376        }
1377        else if (name.equals("regulator")) {
1378          this.regulator = new Reference();
1379          return this.regulator;
1380        }
1381        else if (name.equals("attachedDocument")) {
1382          return addAttachedDocument();
1383        }
1384        else if (name.equals("case")) {
1385          this.case_ = new RegulatedAuthorizationCaseComponent();
1386          return this.case_;
1387        }
1388        else
1389          return super.addChild(name);
1390      }
1391
1392  public String fhirType() {
1393    return "RegulatedAuthorization";
1394
1395  }
1396
1397      public RegulatedAuthorization copy() {
1398        RegulatedAuthorization dst = new RegulatedAuthorization();
1399        copyValues(dst);
1400        return dst;
1401      }
1402
1403      public void copyValues(RegulatedAuthorization dst) {
1404        super.copyValues(dst);
1405        if (identifier != null) {
1406          dst.identifier = new ArrayList<Identifier>();
1407          for (Identifier i : identifier)
1408            dst.identifier.add(i.copy());
1409        };
1410        if (subject != null) {
1411          dst.subject = new ArrayList<Reference>();
1412          for (Reference i : subject)
1413            dst.subject.add(i.copy());
1414        };
1415        dst.type = type == null ? null : type.copy();
1416        dst.description = description == null ? null : description.copy();
1417        if (region != null) {
1418          dst.region = new ArrayList<CodeableConcept>();
1419          for (CodeableConcept i : region)
1420            dst.region.add(i.copy());
1421        };
1422        dst.status = status == null ? null : status.copy();
1423        dst.statusDate = statusDate == null ? null : statusDate.copy();
1424        dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy();
1425        dst.indication = indication == null ? null : indication.copy();
1426        dst.intendedUse = intendedUse == null ? null : intendedUse.copy();
1427        if (basis != null) {
1428          dst.basis = new ArrayList<CodeableConcept>();
1429          for (CodeableConcept i : basis)
1430            dst.basis.add(i.copy());
1431        };
1432        dst.holder = holder == null ? null : holder.copy();
1433        dst.regulator = regulator == null ? null : regulator.copy();
1434        if (attachedDocument != null) {
1435          dst.attachedDocument = new ArrayList<Reference>();
1436          for (Reference i : attachedDocument)
1437            dst.attachedDocument.add(i.copy());
1438        };
1439        dst.case_ = case_ == null ? null : case_.copy();
1440      }
1441
1442      protected RegulatedAuthorization typedCopy() {
1443        return copy();
1444      }
1445
1446      @Override
1447      public boolean equalsDeep(Base other_) {
1448        if (!super.equalsDeep(other_))
1449          return false;
1450        if (!(other_ instanceof RegulatedAuthorization))
1451          return false;
1452        RegulatedAuthorization o = (RegulatedAuthorization) other_;
1453        return compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) && compareDeep(type, o.type, true)
1454           && compareDeep(description, o.description, true) && compareDeep(region, o.region, true) && compareDeep(status, o.status, true)
1455           && compareDeep(statusDate, o.statusDate, true) && compareDeep(validityPeriod, o.validityPeriod, true)
1456           && compareDeep(indication, o.indication, true) && compareDeep(intendedUse, o.intendedUse, true)
1457           && compareDeep(basis, o.basis, true) && compareDeep(holder, o.holder, true) && compareDeep(regulator, o.regulator, true)
1458           && compareDeep(attachedDocument, o.attachedDocument, true) && compareDeep(case_, o.case_, true)
1459          ;
1460      }
1461
1462      @Override
1463      public boolean equalsShallow(Base other_) {
1464        if (!super.equalsShallow(other_))
1465          return false;
1466        if (!(other_ instanceof RegulatedAuthorization))
1467          return false;
1468        RegulatedAuthorization o = (RegulatedAuthorization) other_;
1469        return compareValues(description, o.description, true) && compareValues(statusDate, o.statusDate, true)
1470          ;
1471      }
1472
1473      public boolean isEmpty() {
1474        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, subject, type
1475          , description, region, status, statusDate, validityPeriod, indication, intendedUse
1476          , basis, holder, regulator, attachedDocument, case_);
1477      }
1478
1479  @Override
1480  public ResourceType getResourceType() {
1481    return ResourceType.RegulatedAuthorization;
1482   }
1483
1484 /**
1485   * Search parameter: <b>case-type</b>
1486   * <p>
1487   * Description: <b>The defining type of case</b><br>
1488   * Type: <b>token</b><br>
1489   * Path: <b>RegulatedAuthorization.case.type</b><br>
1490   * </p>
1491   */
1492  @SearchParamDefinition(name="case-type", path="RegulatedAuthorization.case.type", description="The defining type of case", type="token" )
1493  public static final String SP_CASE_TYPE = "case-type";
1494 /**
1495   * <b>Fluent Client</b> search parameter constant for <b>case-type</b>
1496   * <p>
1497   * Description: <b>The defining type of case</b><br>
1498   * Type: <b>token</b><br>
1499   * Path: <b>RegulatedAuthorization.case.type</b><br>
1500   * </p>
1501   */
1502  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CASE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CASE_TYPE);
1503
1504 /**
1505   * Search parameter: <b>case</b>
1506   * <p>
1507   * Description: <b>The case or procedure number</b><br>
1508   * Type: <b>token</b><br>
1509   * Path: <b>RegulatedAuthorization.case.identifier</b><br>
1510   * </p>
1511   */
1512  @SearchParamDefinition(name="case", path="RegulatedAuthorization.case.identifier", description="The case or procedure number", type="token" )
1513  public static final String SP_CASE = "case";
1514 /**
1515   * <b>Fluent Client</b> search parameter constant for <b>case</b>
1516   * <p>
1517   * Description: <b>The case or procedure number</b><br>
1518   * Type: <b>token</b><br>
1519   * Path: <b>RegulatedAuthorization.case.identifier</b><br>
1520   * </p>
1521   */
1522  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CASE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CASE);
1523
1524 /**
1525   * Search parameter: <b>holder</b>
1526   * <p>
1527   * Description: <b>The organization that holds the granted authorization</b><br>
1528   * Type: <b>reference</b><br>
1529   * Path: <b>RegulatedAuthorization.holder</b><br>
1530   * </p>
1531   */
1532  @SearchParamDefinition(name="holder", path="RegulatedAuthorization.holder", description="The organization that holds the granted authorization", type="reference", target={Organization.class } )
1533  public static final String SP_HOLDER = "holder";
1534 /**
1535   * <b>Fluent Client</b> search parameter constant for <b>holder</b>
1536   * <p>
1537   * Description: <b>The organization that holds the granted authorization</b><br>
1538   * Type: <b>reference</b><br>
1539   * Path: <b>RegulatedAuthorization.holder</b><br>
1540   * </p>
1541   */
1542  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam HOLDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_HOLDER);
1543
1544/**
1545   * Constant for fluent queries to be used to add include statements. Specifies
1546   * the path value of "<b>RegulatedAuthorization:holder</b>".
1547   */
1548  public static final ca.uhn.fhir.model.api.Include INCLUDE_HOLDER = new ca.uhn.fhir.model.api.Include("RegulatedAuthorization:holder").toLocked();
1549
1550 /**
1551   * Search parameter: <b>identifier</b>
1552   * <p>
1553   * Description: <b>Business identifier for the authorization, typically assigned by the authorizing body</b><br>
1554   * Type: <b>token</b><br>
1555   * Path: <b>RegulatedAuthorization.identifier</b><br>
1556   * </p>
1557   */
1558  @SearchParamDefinition(name="identifier", path="RegulatedAuthorization.identifier", description="Business identifier for the authorization, typically assigned by the authorizing body", type="token" )
1559  public static final String SP_IDENTIFIER = "identifier";
1560 /**
1561   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1562   * <p>
1563   * Description: <b>Business identifier for the authorization, typically assigned by the authorizing body</b><br>
1564   * Type: <b>token</b><br>
1565   * Path: <b>RegulatedAuthorization.identifier</b><br>
1566   * </p>
1567   */
1568  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1569
1570 /**
1571   * Search parameter: <b>region</b>
1572   * <p>
1573   * Description: <b>The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted</b><br>
1574   * Type: <b>token</b><br>
1575   * Path: <b>RegulatedAuthorization.region</b><br>
1576   * </p>
1577   */
1578  @SearchParamDefinition(name="region", path="RegulatedAuthorization.region", description="The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted", type="token" )
1579  public static final String SP_REGION = "region";
1580 /**
1581   * <b>Fluent Client</b> search parameter constant for <b>region</b>
1582   * <p>
1583   * Description: <b>The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted</b><br>
1584   * Type: <b>token</b><br>
1585   * Path: <b>RegulatedAuthorization.region</b><br>
1586   * </p>
1587   */
1588  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REGION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REGION);
1589
1590 /**
1591   * Search parameter: <b>status</b>
1592   * <p>
1593   * Description: <b>The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications</b><br>
1594   * Type: <b>token</b><br>
1595   * Path: <b>RegulatedAuthorization.status</b><br>
1596   * </p>
1597   */
1598  @SearchParamDefinition(name="status", path="RegulatedAuthorization.status", description="The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications", type="token" )
1599  public static final String SP_STATUS = "status";
1600 /**
1601   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1602   * <p>
1603   * Description: <b>The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications</b><br>
1604   * Type: <b>token</b><br>
1605   * Path: <b>RegulatedAuthorization.status</b><br>
1606   * </p>
1607   */
1608  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1609
1610 /**
1611   * Search parameter: <b>subject</b>
1612   * <p>
1613   * Description: <b>The type of regulated product, treatment, facility or activity that is being authorized</b><br>
1614   * Type: <b>reference</b><br>
1615   * Path: <b>RegulatedAuthorization.subject</b><br>
1616   * </p>
1617   */
1618  @SearchParamDefinition(name="subject", path="RegulatedAuthorization.subject", description="The type of regulated product, treatment, facility or activity that is being authorized", type="reference", target={ActivityDefinition.class, BiologicallyDerivedProduct.class, DeviceDefinition.class, Location.class, MedicinalProductDefinition.class, NutritionProduct.class, ObservationDefinition.class, Organization.class, PackagedProductDefinition.class, PlanDefinition.class, Practitioner.class, ResearchStudy.class, SubstanceDefinition.class } )
1619  public static final String SP_SUBJECT = "subject";
1620 /**
1621   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1622   * <p>
1623   * Description: <b>The type of regulated product, treatment, facility or activity that is being authorized</b><br>
1624   * Type: <b>reference</b><br>
1625   * Path: <b>RegulatedAuthorization.subject</b><br>
1626   * </p>
1627   */
1628  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1629
1630/**
1631   * Constant for fluent queries to be used to add include statements. Specifies
1632   * the path value of "<b>RegulatedAuthorization:subject</b>".
1633   */
1634  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("RegulatedAuthorization:subject").toLocked();
1635
1636
1637}
1638