001package org.hl7.fhir.r4b.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 Fri, Dec 31, 2021 05:58+1100 for FHIR v4.3.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.r4b.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     * 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).
556     */
557    @Child(name = "case", type = {}, order=13, min=0, max=1, modifier=false, summary=true)
558    @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)." )
559    protected RegulatedAuthorizationCaseComponent case_;
560
561    private static final long serialVersionUID = -937196743L;
562
563  /**
564   * Constructor
565   */
566    public RegulatedAuthorization() {
567      super();
568    }
569
570    /**
571     * @return {@link #identifier} (Business identifier for the authorization, typically assigned by the authorizing body.)
572     */
573    public List<Identifier> getIdentifier() { 
574      if (this.identifier == null)
575        this.identifier = new ArrayList<Identifier>();
576      return this.identifier;
577    }
578
579    /**
580     * @return Returns a reference to <code>this</code> for easy method chaining
581     */
582    public RegulatedAuthorization setIdentifier(List<Identifier> theIdentifier) { 
583      this.identifier = theIdentifier;
584      return this;
585    }
586
587    public boolean hasIdentifier() { 
588      if (this.identifier == null)
589        return false;
590      for (Identifier item : this.identifier)
591        if (!item.isEmpty())
592          return true;
593      return false;
594    }
595
596    public Identifier addIdentifier() { //3
597      Identifier t = new Identifier();
598      if (this.identifier == null)
599        this.identifier = new ArrayList<Identifier>();
600      this.identifier.add(t);
601      return t;
602    }
603
604    public RegulatedAuthorization addIdentifier(Identifier t) { //3
605      if (t == null)
606        return this;
607      if (this.identifier == null)
608        this.identifier = new ArrayList<Identifier>();
609      this.identifier.add(t);
610      return this;
611    }
612
613    /**
614     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
615     */
616    public Identifier getIdentifierFirstRep() { 
617      if (getIdentifier().isEmpty()) {
618        addIdentifier();
619      }
620      return getIdentifier().get(0);
621    }
622
623    /**
624     * @return {@link #subject} (The product type, treatment, facility or activity that is being authorized.)
625     */
626    public List<Reference> getSubject() { 
627      if (this.subject == null)
628        this.subject = new ArrayList<Reference>();
629      return this.subject;
630    }
631
632    /**
633     * @return Returns a reference to <code>this</code> for easy method chaining
634     */
635    public RegulatedAuthorization setSubject(List<Reference> theSubject) { 
636      this.subject = theSubject;
637      return this;
638    }
639
640    public boolean hasSubject() { 
641      if (this.subject == null)
642        return false;
643      for (Reference item : this.subject)
644        if (!item.isEmpty())
645          return true;
646      return false;
647    }
648
649    public Reference addSubject() { //3
650      Reference t = new Reference();
651      if (this.subject == null)
652        this.subject = new ArrayList<Reference>();
653      this.subject.add(t);
654      return t;
655    }
656
657    public RegulatedAuthorization addSubject(Reference t) { //3
658      if (t == null)
659        return this;
660      if (this.subject == null)
661        this.subject = new ArrayList<Reference>();
662      this.subject.add(t);
663      return this;
664    }
665
666    /**
667     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist {3}
668     */
669    public Reference getSubjectFirstRep() { 
670      if (getSubject().isEmpty()) {
671        addSubject();
672      }
673      return getSubject().get(0);
674    }
675
676    /**
677     * @return {@link #type} (Overall type of this authorization, for example drug marketing approval, orphan drug designation.)
678     */
679    public CodeableConcept getType() { 
680      if (this.type == null)
681        if (Configuration.errorOnAutoCreate())
682          throw new Error("Attempt to auto-create RegulatedAuthorization.type");
683        else if (Configuration.doAutoCreate())
684          this.type = new CodeableConcept(); // cc
685      return this.type;
686    }
687
688    public boolean hasType() { 
689      return this.type != null && !this.type.isEmpty();
690    }
691
692    /**
693     * @param value {@link #type} (Overall type of this authorization, for example drug marketing approval, orphan drug designation.)
694     */
695    public RegulatedAuthorization setType(CodeableConcept value) { 
696      this.type = value;
697      return this;
698    }
699
700    /**
701     * @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
702     */
703    public MarkdownType getDescriptionElement() { 
704      if (this.description == null)
705        if (Configuration.errorOnAutoCreate())
706          throw new Error("Attempt to auto-create RegulatedAuthorization.description");
707        else if (Configuration.doAutoCreate())
708          this.description = new MarkdownType(); // bb
709      return this.description;
710    }
711
712    public boolean hasDescriptionElement() { 
713      return this.description != null && !this.description.isEmpty();
714    }
715
716    public boolean hasDescription() { 
717      return this.description != null && !this.description.isEmpty();
718    }
719
720    /**
721     * @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
722     */
723    public RegulatedAuthorization setDescriptionElement(MarkdownType value) { 
724      this.description = value;
725      return this;
726    }
727
728    /**
729     * @return General textual supporting information.
730     */
731    public String getDescription() { 
732      return this.description == null ? null : this.description.getValue();
733    }
734
735    /**
736     * @param value General textual supporting information.
737     */
738    public RegulatedAuthorization setDescription(String value) { 
739      if (value == null)
740        this.description = null;
741      else {
742        if (this.description == null)
743          this.description = new MarkdownType();
744        this.description.setValue(value);
745      }
746      return this;
747    }
748
749    /**
750     * @return {@link #region} (The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted.)
751     */
752    public List<CodeableConcept> getRegion() { 
753      if (this.region == null)
754        this.region = new ArrayList<CodeableConcept>();
755      return this.region;
756    }
757
758    /**
759     * @return Returns a reference to <code>this</code> for easy method chaining
760     */
761    public RegulatedAuthorization setRegion(List<CodeableConcept> theRegion) { 
762      this.region = theRegion;
763      return this;
764    }
765
766    public boolean hasRegion() { 
767      if (this.region == null)
768        return false;
769      for (CodeableConcept item : this.region)
770        if (!item.isEmpty())
771          return true;
772      return false;
773    }
774
775    public CodeableConcept addRegion() { //3
776      CodeableConcept t = new CodeableConcept();
777      if (this.region == null)
778        this.region = new ArrayList<CodeableConcept>();
779      this.region.add(t);
780      return t;
781    }
782
783    public RegulatedAuthorization addRegion(CodeableConcept t) { //3
784      if (t == null)
785        return this;
786      if (this.region == null)
787        this.region = new ArrayList<CodeableConcept>();
788      this.region.add(t);
789      return this;
790    }
791
792    /**
793     * @return The first repetition of repeating field {@link #region}, creating it if it does not already exist {3}
794     */
795    public CodeableConcept getRegionFirstRep() { 
796      if (getRegion().isEmpty()) {
797        addRegion();
798      }
799      return getRegion().get(0);
800    }
801
802    /**
803     * @return {@link #status} (The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications.)
804     */
805    public CodeableConcept getStatus() { 
806      if (this.status == null)
807        if (Configuration.errorOnAutoCreate())
808          throw new Error("Attempt to auto-create RegulatedAuthorization.status");
809        else if (Configuration.doAutoCreate())
810          this.status = new CodeableConcept(); // cc
811      return this.status;
812    }
813
814    public boolean hasStatus() { 
815      return this.status != null && !this.status.isEmpty();
816    }
817
818    /**
819     * @param value {@link #status} (The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications.)
820     */
821    public RegulatedAuthorization setStatus(CodeableConcept value) { 
822      this.status = value;
823      return this;
824    }
825
826    /**
827     * @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
828     */
829    public DateTimeType getStatusDateElement() { 
830      if (this.statusDate == null)
831        if (Configuration.errorOnAutoCreate())
832          throw new Error("Attempt to auto-create RegulatedAuthorization.statusDate");
833        else if (Configuration.doAutoCreate())
834          this.statusDate = new DateTimeType(); // bb
835      return this.statusDate;
836    }
837
838    public boolean hasStatusDateElement() { 
839      return this.statusDate != null && !this.statusDate.isEmpty();
840    }
841
842    public boolean hasStatusDate() { 
843      return this.statusDate != null && !this.statusDate.isEmpty();
844    }
845
846    /**
847     * @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
848     */
849    public RegulatedAuthorization setStatusDateElement(DateTimeType value) { 
850      this.statusDate = value;
851      return this;
852    }
853
854    /**
855     * @return The date at which the current status was assigned.
856     */
857    public Date getStatusDate() { 
858      return this.statusDate == null ? null : this.statusDate.getValue();
859    }
860
861    /**
862     * @param value The date at which the current status was assigned.
863     */
864    public RegulatedAuthorization setStatusDate(Date value) { 
865      if (value == null)
866        this.statusDate = null;
867      else {
868        if (this.statusDate == null)
869          this.statusDate = new DateTimeType();
870        this.statusDate.setValue(value);
871      }
872      return this;
873    }
874
875    /**
876     * @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.)
877     */
878    public Period getValidityPeriod() { 
879      if (this.validityPeriod == null)
880        if (Configuration.errorOnAutoCreate())
881          throw new Error("Attempt to auto-create RegulatedAuthorization.validityPeriod");
882        else if (Configuration.doAutoCreate())
883          this.validityPeriod = new Period(); // cc
884      return this.validityPeriod;
885    }
886
887    public boolean hasValidityPeriod() { 
888      return this.validityPeriod != null && !this.validityPeriod.isEmpty();
889    }
890
891    /**
892     * @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.)
893     */
894    public RegulatedAuthorization setValidityPeriod(Period value) { 
895      this.validityPeriod = value;
896      return this;
897    }
898
899    /**
900     * @return {@link #indication} (Condition for which the use of the regulated product applies.)
901     */
902    public CodeableReference getIndication() { 
903      if (this.indication == null)
904        if (Configuration.errorOnAutoCreate())
905          throw new Error("Attempt to auto-create RegulatedAuthorization.indication");
906        else if (Configuration.doAutoCreate())
907          this.indication = new CodeableReference(); // cc
908      return this.indication;
909    }
910
911    public boolean hasIndication() { 
912      return this.indication != null && !this.indication.isEmpty();
913    }
914
915    /**
916     * @param value {@link #indication} (Condition for which the use of the regulated product applies.)
917     */
918    public RegulatedAuthorization setIndication(CodeableReference value) { 
919      this.indication = value;
920      return this;
921    }
922
923    /**
924     * @return {@link #intendedUse} (The intended use of the product, e.g. prevention, treatment.)
925     */
926    public CodeableConcept getIntendedUse() { 
927      if (this.intendedUse == null)
928        if (Configuration.errorOnAutoCreate())
929          throw new Error("Attempt to auto-create RegulatedAuthorization.intendedUse");
930        else if (Configuration.doAutoCreate())
931          this.intendedUse = new CodeableConcept(); // cc
932      return this.intendedUse;
933    }
934
935    public boolean hasIntendedUse() { 
936      return this.intendedUse != null && !this.intendedUse.isEmpty();
937    }
938
939    /**
940     * @param value {@link #intendedUse} (The intended use of the product, e.g. prevention, treatment.)
941     */
942    public RegulatedAuthorization setIntendedUse(CodeableConcept value) { 
943      this.intendedUse = value;
944      return this;
945    }
946
947    /**
948     * @return {@link #basis} (The legal or regulatory framework against which this authorization is granted, or other reasons for it.)
949     */
950    public List<CodeableConcept> getBasis() { 
951      if (this.basis == null)
952        this.basis = new ArrayList<CodeableConcept>();
953      return this.basis;
954    }
955
956    /**
957     * @return Returns a reference to <code>this</code> for easy method chaining
958     */
959    public RegulatedAuthorization setBasis(List<CodeableConcept> theBasis) { 
960      this.basis = theBasis;
961      return this;
962    }
963
964    public boolean hasBasis() { 
965      if (this.basis == null)
966        return false;
967      for (CodeableConcept item : this.basis)
968        if (!item.isEmpty())
969          return true;
970      return false;
971    }
972
973    public CodeableConcept addBasis() { //3
974      CodeableConcept t = new CodeableConcept();
975      if (this.basis == null)
976        this.basis = new ArrayList<CodeableConcept>();
977      this.basis.add(t);
978      return t;
979    }
980
981    public RegulatedAuthorization addBasis(CodeableConcept t) { //3
982      if (t == null)
983        return this;
984      if (this.basis == null)
985        this.basis = new ArrayList<CodeableConcept>();
986      this.basis.add(t);
987      return this;
988    }
989
990    /**
991     * @return The first repetition of repeating field {@link #basis}, creating it if it does not already exist {3}
992     */
993    public CodeableConcept getBasisFirstRep() { 
994      if (getBasis().isEmpty()) {
995        addBasis();
996      }
997      return getBasis().get(0);
998    }
999
1000    /**
1001     * @return {@link #holder} (The organization that holds the granted authorization.)
1002     */
1003    public Reference getHolder() { 
1004      if (this.holder == null)
1005        if (Configuration.errorOnAutoCreate())
1006          throw new Error("Attempt to auto-create RegulatedAuthorization.holder");
1007        else if (Configuration.doAutoCreate())
1008          this.holder = new Reference(); // cc
1009      return this.holder;
1010    }
1011
1012    public boolean hasHolder() { 
1013      return this.holder != null && !this.holder.isEmpty();
1014    }
1015
1016    /**
1017     * @param value {@link #holder} (The organization that holds the granted authorization.)
1018     */
1019    public RegulatedAuthorization setHolder(Reference value) { 
1020      this.holder = value;
1021      return this;
1022    }
1023
1024    /**
1025     * @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.)
1026     */
1027    public Reference getRegulator() { 
1028      if (this.regulator == null)
1029        if (Configuration.errorOnAutoCreate())
1030          throw new Error("Attempt to auto-create RegulatedAuthorization.regulator");
1031        else if (Configuration.doAutoCreate())
1032          this.regulator = new Reference(); // cc
1033      return this.regulator;
1034    }
1035
1036    public boolean hasRegulator() { 
1037      return this.regulator != null && !this.regulator.isEmpty();
1038    }
1039
1040    /**
1041     * @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.)
1042     */
1043    public RegulatedAuthorization setRegulator(Reference value) { 
1044      this.regulator = value;
1045      return this;
1046    }
1047
1048    /**
1049     * @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).)
1050     */
1051    public RegulatedAuthorizationCaseComponent getCase() { 
1052      if (this.case_ == null)
1053        if (Configuration.errorOnAutoCreate())
1054          throw new Error("Attempt to auto-create RegulatedAuthorization.case_");
1055        else if (Configuration.doAutoCreate())
1056          this.case_ = new RegulatedAuthorizationCaseComponent(); // cc
1057      return this.case_;
1058    }
1059
1060    public boolean hasCase() { 
1061      return this.case_ != null && !this.case_.isEmpty();
1062    }
1063
1064    /**
1065     * @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).)
1066     */
1067    public RegulatedAuthorization setCase(RegulatedAuthorizationCaseComponent value) { 
1068      this.case_ = value;
1069      return this;
1070    }
1071
1072      protected void listChildren(List<Property> children) {
1073        super.listChildren(children);
1074        children.add(new Property("identifier", "Identifier", "Business identifier for the authorization, typically assigned by the authorizing body.", 0, java.lang.Integer.MAX_VALUE, identifier));
1075        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));
1076        children.add(new Property("type", "CodeableConcept", "Overall type of this authorization, for example drug marketing approval, orphan drug designation.", 0, 1, type));
1077        children.add(new Property("description", "markdown", "General textual supporting information.", 0, 1, description));
1078        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));
1079        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));
1080        children.add(new Property("statusDate", "dateTime", "The date at which the current status was assigned.", 0, 1, statusDate));
1081        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));
1082        children.add(new Property("indication", "CodeableReference(ClinicalUseDefinition)", "Condition for which the use of the regulated product applies.", 0, 1, indication));
1083        children.add(new Property("intendedUse", "CodeableConcept", "The intended use of the product, e.g. prevention, treatment.", 0, 1, intendedUse));
1084        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));
1085        children.add(new Property("holder", "Reference(Organization)", "The organization that holds the granted authorization.", 0, 1, holder));
1086        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));
1087        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_));
1088      }
1089
1090      @Override
1091      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1092        switch (_hash) {
1093        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);
1094        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);
1095        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Overall type of this authorization, for example drug marketing approval, orphan drug designation.", 0, 1, type);
1096        case -1724546052: /*description*/  return new Property("description", "markdown", "General textual supporting information.", 0, 1, description);
1097        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);
1098        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);
1099        case 247524032: /*statusDate*/  return new Property("statusDate", "dateTime", "The date at which the current status was assigned.", 0, 1, statusDate);
1100        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);
1101        case -597168804: /*indication*/  return new Property("indication", "CodeableReference(ClinicalUseDefinition)", "Condition for which the use of the regulated product applies.", 0, 1, indication);
1102        case -1618671268: /*intendedUse*/  return new Property("intendedUse", "CodeableConcept", "The intended use of the product, e.g. prevention, treatment.", 0, 1, intendedUse);
1103        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);
1104        case -1211707988: /*holder*/  return new Property("holder", "Reference(Organization)", "The organization that holds the granted authorization.", 0, 1, holder);
1105        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);
1106        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_);
1107        default: return super.getNamedProperty(_hash, _name, _checkValid);
1108        }
1109
1110      }
1111
1112      @Override
1113      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1114        switch (hash) {
1115        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1116        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
1117        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1118        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
1119        case -934795532: /*region*/ return this.region == null ? new Base[0] : this.region.toArray(new Base[this.region.size()]); // CodeableConcept
1120        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
1121        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : new Base[] {this.statusDate}; // DateTimeType
1122        case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period
1123        case -597168804: /*indication*/ return this.indication == null ? new Base[0] : new Base[] {this.indication}; // CodeableReference
1124        case -1618671268: /*intendedUse*/ return this.intendedUse == null ? new Base[0] : new Base[] {this.intendedUse}; // CodeableConcept
1125        case 93508670: /*basis*/ return this.basis == null ? new Base[0] : this.basis.toArray(new Base[this.basis.size()]); // CodeableConcept
1126        case -1211707988: /*holder*/ return this.holder == null ? new Base[0] : new Base[] {this.holder}; // Reference
1127        case 414760449: /*regulator*/ return this.regulator == null ? new Base[0] : new Base[] {this.regulator}; // Reference
1128        case 3046192: /*case*/ return this.case_ == null ? new Base[0] : new Base[] {this.case_}; // RegulatedAuthorizationCaseComponent
1129        default: return super.getProperty(hash, name, checkValid);
1130        }
1131
1132      }
1133
1134      @Override
1135      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1136        switch (hash) {
1137        case -1618432855: // identifier
1138          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1139          return value;
1140        case -1867885268: // subject
1141          this.getSubject().add(TypeConvertor.castToReference(value)); // Reference
1142          return value;
1143        case 3575610: // type
1144          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1145          return value;
1146        case -1724546052: // description
1147          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
1148          return value;
1149        case -934795532: // region
1150          this.getRegion().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1151          return value;
1152        case -892481550: // status
1153          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1154          return value;
1155        case 247524032: // statusDate
1156          this.statusDate = TypeConvertor.castToDateTime(value); // DateTimeType
1157          return value;
1158        case -1434195053: // validityPeriod
1159          this.validityPeriod = TypeConvertor.castToPeriod(value); // Period
1160          return value;
1161        case -597168804: // indication
1162          this.indication = TypeConvertor.castToCodeableReference(value); // CodeableReference
1163          return value;
1164        case -1618671268: // intendedUse
1165          this.intendedUse = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1166          return value;
1167        case 93508670: // basis
1168          this.getBasis().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1169          return value;
1170        case -1211707988: // holder
1171          this.holder = TypeConvertor.castToReference(value); // Reference
1172          return value;
1173        case 414760449: // regulator
1174          this.regulator = TypeConvertor.castToReference(value); // Reference
1175          return value;
1176        case 3046192: // case
1177          this.case_ = (RegulatedAuthorizationCaseComponent) value; // RegulatedAuthorizationCaseComponent
1178          return value;
1179        default: return super.setProperty(hash, name, value);
1180        }
1181
1182      }
1183
1184      @Override
1185      public Base setProperty(String name, Base value) throws FHIRException {
1186        if (name.equals("identifier")) {
1187          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1188        } else if (name.equals("subject")) {
1189          this.getSubject().add(TypeConvertor.castToReference(value));
1190        } else if (name.equals("type")) {
1191          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1192        } else if (name.equals("description")) {
1193          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
1194        } else if (name.equals("region")) {
1195          this.getRegion().add(TypeConvertor.castToCodeableConcept(value));
1196        } else if (name.equals("status")) {
1197          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1198        } else if (name.equals("statusDate")) {
1199          this.statusDate = TypeConvertor.castToDateTime(value); // DateTimeType
1200        } else if (name.equals("validityPeriod")) {
1201          this.validityPeriod = TypeConvertor.castToPeriod(value); // Period
1202        } else if (name.equals("indication")) {
1203          this.indication = TypeConvertor.castToCodeableReference(value); // CodeableReference
1204        } else if (name.equals("intendedUse")) {
1205          this.intendedUse = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1206        } else if (name.equals("basis")) {
1207          this.getBasis().add(TypeConvertor.castToCodeableConcept(value));
1208        } else if (name.equals("holder")) {
1209          this.holder = TypeConvertor.castToReference(value); // Reference
1210        } else if (name.equals("regulator")) {
1211          this.regulator = TypeConvertor.castToReference(value); // Reference
1212        } else if (name.equals("case")) {
1213          this.case_ = (RegulatedAuthorizationCaseComponent) value; // RegulatedAuthorizationCaseComponent
1214        } else
1215          return super.setProperty(name, value);
1216        return value;
1217      }
1218
1219      @Override
1220      public Base makeProperty(int hash, String name) throws FHIRException {
1221        switch (hash) {
1222        case -1618432855:  return addIdentifier(); 
1223        case -1867885268:  return addSubject(); 
1224        case 3575610:  return getType();
1225        case -1724546052:  return getDescriptionElement();
1226        case -934795532:  return addRegion(); 
1227        case -892481550:  return getStatus();
1228        case 247524032:  return getStatusDateElement();
1229        case -1434195053:  return getValidityPeriod();
1230        case -597168804:  return getIndication();
1231        case -1618671268:  return getIntendedUse();
1232        case 93508670:  return addBasis(); 
1233        case -1211707988:  return getHolder();
1234        case 414760449:  return getRegulator();
1235        case 3046192:  return getCase();
1236        default: return super.makeProperty(hash, name);
1237        }
1238
1239      }
1240
1241      @Override
1242      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1243        switch (hash) {
1244        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1245        case -1867885268: /*subject*/ return new String[] {"Reference"};
1246        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1247        case -1724546052: /*description*/ return new String[] {"markdown"};
1248        case -934795532: /*region*/ return new String[] {"CodeableConcept"};
1249        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
1250        case 247524032: /*statusDate*/ return new String[] {"dateTime"};
1251        case -1434195053: /*validityPeriod*/ return new String[] {"Period"};
1252        case -597168804: /*indication*/ return new String[] {"CodeableReference"};
1253        case -1618671268: /*intendedUse*/ return new String[] {"CodeableConcept"};
1254        case 93508670: /*basis*/ return new String[] {"CodeableConcept"};
1255        case -1211707988: /*holder*/ return new String[] {"Reference"};
1256        case 414760449: /*regulator*/ return new String[] {"Reference"};
1257        case 3046192: /*case*/ return new String[] {};
1258        default: return super.getTypesForProperty(hash, name);
1259        }
1260
1261      }
1262
1263      @Override
1264      public Base addChild(String name) throws FHIRException {
1265        if (name.equals("identifier")) {
1266          return addIdentifier();
1267        }
1268        else if (name.equals("subject")) {
1269          return addSubject();
1270        }
1271        else if (name.equals("type")) {
1272          this.type = new CodeableConcept();
1273          return this.type;
1274        }
1275        else if (name.equals("description")) {
1276          throw new FHIRException("Cannot call addChild on a primitive type RegulatedAuthorization.description");
1277        }
1278        else if (name.equals("region")) {
1279          return addRegion();
1280        }
1281        else if (name.equals("status")) {
1282          this.status = new CodeableConcept();
1283          return this.status;
1284        }
1285        else if (name.equals("statusDate")) {
1286          throw new FHIRException("Cannot call addChild on a primitive type RegulatedAuthorization.statusDate");
1287        }
1288        else if (name.equals("validityPeriod")) {
1289          this.validityPeriod = new Period();
1290          return this.validityPeriod;
1291        }
1292        else if (name.equals("indication")) {
1293          this.indication = new CodeableReference();
1294          return this.indication;
1295        }
1296        else if (name.equals("intendedUse")) {
1297          this.intendedUse = new CodeableConcept();
1298          return this.intendedUse;
1299        }
1300        else if (name.equals("basis")) {
1301          return addBasis();
1302        }
1303        else if (name.equals("holder")) {
1304          this.holder = new Reference();
1305          return this.holder;
1306        }
1307        else if (name.equals("regulator")) {
1308          this.regulator = new Reference();
1309          return this.regulator;
1310        }
1311        else if (name.equals("case")) {
1312          this.case_ = new RegulatedAuthorizationCaseComponent();
1313          return this.case_;
1314        }
1315        else
1316          return super.addChild(name);
1317      }
1318
1319  public String fhirType() {
1320    return "RegulatedAuthorization";
1321
1322  }
1323
1324      public RegulatedAuthorization copy() {
1325        RegulatedAuthorization dst = new RegulatedAuthorization();
1326        copyValues(dst);
1327        return dst;
1328      }
1329
1330      public void copyValues(RegulatedAuthorization dst) {
1331        super.copyValues(dst);
1332        if (identifier != null) {
1333          dst.identifier = new ArrayList<Identifier>();
1334          for (Identifier i : identifier)
1335            dst.identifier.add(i.copy());
1336        };
1337        if (subject != null) {
1338          dst.subject = new ArrayList<Reference>();
1339          for (Reference i : subject)
1340            dst.subject.add(i.copy());
1341        };
1342        dst.type = type == null ? null : type.copy();
1343        dst.description = description == null ? null : description.copy();
1344        if (region != null) {
1345          dst.region = new ArrayList<CodeableConcept>();
1346          for (CodeableConcept i : region)
1347            dst.region.add(i.copy());
1348        };
1349        dst.status = status == null ? null : status.copy();
1350        dst.statusDate = statusDate == null ? null : statusDate.copy();
1351        dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy();
1352        dst.indication = indication == null ? null : indication.copy();
1353        dst.intendedUse = intendedUse == null ? null : intendedUse.copy();
1354        if (basis != null) {
1355          dst.basis = new ArrayList<CodeableConcept>();
1356          for (CodeableConcept i : basis)
1357            dst.basis.add(i.copy());
1358        };
1359        dst.holder = holder == null ? null : holder.copy();
1360        dst.regulator = regulator == null ? null : regulator.copy();
1361        dst.case_ = case_ == null ? null : case_.copy();
1362      }
1363
1364      protected RegulatedAuthorization typedCopy() {
1365        return copy();
1366      }
1367
1368      @Override
1369      public boolean equalsDeep(Base other_) {
1370        if (!super.equalsDeep(other_))
1371          return false;
1372        if (!(other_ instanceof RegulatedAuthorization))
1373          return false;
1374        RegulatedAuthorization o = (RegulatedAuthorization) other_;
1375        return compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) && compareDeep(type, o.type, true)
1376           && compareDeep(description, o.description, true) && compareDeep(region, o.region, true) && compareDeep(status, o.status, true)
1377           && compareDeep(statusDate, o.statusDate, true) && compareDeep(validityPeriod, o.validityPeriod, true)
1378           && compareDeep(indication, o.indication, true) && compareDeep(intendedUse, o.intendedUse, true)
1379           && compareDeep(basis, o.basis, true) && compareDeep(holder, o.holder, true) && compareDeep(regulator, o.regulator, true)
1380           && compareDeep(case_, o.case_, true);
1381      }
1382
1383      @Override
1384      public boolean equalsShallow(Base other_) {
1385        if (!super.equalsShallow(other_))
1386          return false;
1387        if (!(other_ instanceof RegulatedAuthorization))
1388          return false;
1389        RegulatedAuthorization o = (RegulatedAuthorization) other_;
1390        return compareValues(description, o.description, true) && compareValues(statusDate, o.statusDate, true)
1391          ;
1392      }
1393
1394      public boolean isEmpty() {
1395        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, subject, type
1396          , description, region, status, statusDate, validityPeriod, indication, intendedUse
1397          , basis, holder, regulator, case_);
1398      }
1399
1400  @Override
1401  public ResourceType getResourceType() {
1402    return ResourceType.RegulatedAuthorization;
1403   }
1404
1405 /**
1406   * Search parameter: <b>case-type</b>
1407   * <p>
1408   * Description: <b>The defining type of case</b><br>
1409   * Type: <b>token</b><br>
1410   * Path: <b>RegulatedAuthorization.case.type</b><br>
1411   * </p>
1412   */
1413  @SearchParamDefinition(name="case-type", path="RegulatedAuthorization.case.type", description="The defining type of case", type="token" )
1414  public static final String SP_CASE_TYPE = "case-type";
1415 /**
1416   * <b>Fluent Client</b> search parameter constant for <b>case-type</b>
1417   * <p>
1418   * Description: <b>The defining type of case</b><br>
1419   * Type: <b>token</b><br>
1420   * Path: <b>RegulatedAuthorization.case.type</b><br>
1421   * </p>
1422   */
1423  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CASE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CASE_TYPE);
1424
1425 /**
1426   * Search parameter: <b>case</b>
1427   * <p>
1428   * Description: <b>The case or procedure number</b><br>
1429   * Type: <b>token</b><br>
1430   * Path: <b>RegulatedAuthorization.case.identifier</b><br>
1431   * </p>
1432   */
1433  @SearchParamDefinition(name="case", path="RegulatedAuthorization.case.identifier", description="The case or procedure number", type="token" )
1434  public static final String SP_CASE = "case";
1435 /**
1436   * <b>Fluent Client</b> search parameter constant for <b>case</b>
1437   * <p>
1438   * Description: <b>The case or procedure number</b><br>
1439   * Type: <b>token</b><br>
1440   * Path: <b>RegulatedAuthorization.case.identifier</b><br>
1441   * </p>
1442   */
1443  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CASE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CASE);
1444
1445 /**
1446   * Search parameter: <b>holder</b>
1447   * <p>
1448   * Description: <b>The organization that holds the granted authorization</b><br>
1449   * Type: <b>reference</b><br>
1450   * Path: <b>RegulatedAuthorization.holder</b><br>
1451   * </p>
1452   */
1453  @SearchParamDefinition(name="holder", path="RegulatedAuthorization.holder", description="The organization that holds the granted authorization", type="reference", target={Organization.class } )
1454  public static final String SP_HOLDER = "holder";
1455 /**
1456   * <b>Fluent Client</b> search parameter constant for <b>holder</b>
1457   * <p>
1458   * Description: <b>The organization that holds the granted authorization</b><br>
1459   * Type: <b>reference</b><br>
1460   * Path: <b>RegulatedAuthorization.holder</b><br>
1461   * </p>
1462   */
1463  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam HOLDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_HOLDER);
1464
1465/**
1466   * Constant for fluent queries to be used to add include statements. Specifies
1467   * the path value of "<b>RegulatedAuthorization:holder</b>".
1468   */
1469  public static final ca.uhn.fhir.model.api.Include INCLUDE_HOLDER = new ca.uhn.fhir.model.api.Include("RegulatedAuthorization:holder").toLocked();
1470
1471 /**
1472   * Search parameter: <b>identifier</b>
1473   * <p>
1474   * Description: <b>Business identifier for the authorization, typically assigned by the authorizing body</b><br>
1475   * Type: <b>token</b><br>
1476   * Path: <b>RegulatedAuthorization.identifier</b><br>
1477   * </p>
1478   */
1479  @SearchParamDefinition(name="identifier", path="RegulatedAuthorization.identifier", description="Business identifier for the authorization, typically assigned by the authorizing body", type="token" )
1480  public static final String SP_IDENTIFIER = "identifier";
1481 /**
1482   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1483   * <p>
1484   * Description: <b>Business identifier for the authorization, typically assigned by the authorizing body</b><br>
1485   * Type: <b>token</b><br>
1486   * Path: <b>RegulatedAuthorization.identifier</b><br>
1487   * </p>
1488   */
1489  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1490
1491 /**
1492   * Search parameter: <b>region</b>
1493   * <p>
1494   * Description: <b>The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted</b><br>
1495   * Type: <b>token</b><br>
1496   * Path: <b>RegulatedAuthorization.region</b><br>
1497   * </p>
1498   */
1499  @SearchParamDefinition(name="region", path="RegulatedAuthorization.region", description="The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted", type="token" )
1500  public static final String SP_REGION = "region";
1501 /**
1502   * <b>Fluent Client</b> search parameter constant for <b>region</b>
1503   * <p>
1504   * Description: <b>The territory (e.g., country, jurisdiction etc.) in which the authorization has been granted</b><br>
1505   * Type: <b>token</b><br>
1506   * Path: <b>RegulatedAuthorization.region</b><br>
1507   * </p>
1508   */
1509  public static final ca.uhn.fhir.rest.gclient.TokenClientParam REGION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_REGION);
1510
1511 /**
1512   * Search parameter: <b>status</b>
1513   * <p>
1514   * Description: <b>The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications</b><br>
1515   * Type: <b>token</b><br>
1516   * Path: <b>RegulatedAuthorization.status</b><br>
1517   * </p>
1518   */
1519  @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" )
1520  public static final String SP_STATUS = "status";
1521 /**
1522   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1523   * <p>
1524   * Description: <b>The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications</b><br>
1525   * Type: <b>token</b><br>
1526   * Path: <b>RegulatedAuthorization.status</b><br>
1527   * </p>
1528   */
1529  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1530
1531 /**
1532   * Search parameter: <b>subject</b>
1533   * <p>
1534   * Description: <b>The type of regulated product, treatment, facility or activity that is being authorized</b><br>
1535   * Type: <b>reference</b><br>
1536   * Path: <b>RegulatedAuthorization.subject</b><br>
1537   * </p>
1538   */
1539  @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 } )
1540  public static final String SP_SUBJECT = "subject";
1541 /**
1542   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1543   * <p>
1544   * Description: <b>The type of regulated product, treatment, facility or activity that is being authorized</b><br>
1545   * Type: <b>reference</b><br>
1546   * Path: <b>RegulatedAuthorization.subject</b><br>
1547   * </p>
1548   */
1549  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1550
1551/**
1552   * Constant for fluent queries to be used to add include statements. Specifies
1553   * the path value of "<b>RegulatedAuthorization:subject</b>".
1554   */
1555  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("RegulatedAuthorization:subject").toLocked();
1556
1557
1558}
1559