001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034import java.util.*;
035
036import ca.uhn.fhir.model.api.annotation.ResourceDef;
037import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.ChildOrder;
040import ca.uhn.fhir.model.api.annotation.Description;
041import ca.uhn.fhir.model.api.annotation.Block;
042import org.hl7.fhir.instance.model.api.*;
043import org.hl7.fhir.exceptions.FHIRException;
044/**
045 * The regulatory authorization of a medicinal product.
046 */
047@ResourceDef(name="MedicinalProductAuthorization", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductAuthorization")
048public class MedicinalProductAuthorization extends DomainResource {
049
050    @Block()
051    public static class MedicinalProductAuthorizationJurisdictionalAuthorizationComponent extends BackboneElement implements IBaseBackboneElement {
052        /**
053         * The assigned number for the marketing authorization.
054         */
055        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
056        @Description(shortDefinition="The assigned number for the marketing authorization", formalDefinition="The assigned number for the marketing authorization." )
057        protected List<Identifier> identifier;
058
059        /**
060         * Country of authorization.
061         */
062        @Child(name = "country", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
063        @Description(shortDefinition="Country of authorization", formalDefinition="Country of authorization." )
064        protected CodeableConcept country;
065
066        /**
067         * Jurisdiction within a country.
068         */
069        @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
070        @Description(shortDefinition="Jurisdiction within a country", formalDefinition="Jurisdiction within a country." )
071        protected List<CodeableConcept> jurisdiction;
072
073        /**
074         * The legal status of supply in a jurisdiction or region.
075         */
076        @Child(name = "legalStatusOfSupply", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
077        @Description(shortDefinition="The legal status of supply in a jurisdiction or region", formalDefinition="The legal status of supply in a jurisdiction or region." )
078        protected CodeableConcept legalStatusOfSupply;
079
080        /**
081         * The start and expected end date of the authorization.
082         */
083        @Child(name = "validityPeriod", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=true)
084        @Description(shortDefinition="The start and expected end date of the authorization", formalDefinition="The start and expected end date of the authorization." )
085        protected Period validityPeriod;
086
087        private static final long serialVersionUID = -1893307291L;
088
089    /**
090     * Constructor
091     */
092      public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent() {
093        super();
094      }
095
096        /**
097         * @return {@link #identifier} (The assigned number for the marketing authorization.)
098         */
099        public List<Identifier> getIdentifier() { 
100          if (this.identifier == null)
101            this.identifier = new ArrayList<Identifier>();
102          return this.identifier;
103        }
104
105        /**
106         * @return Returns a reference to <code>this</code> for easy method chaining
107         */
108        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent setIdentifier(List<Identifier> theIdentifier) { 
109          this.identifier = theIdentifier;
110          return this;
111        }
112
113        public boolean hasIdentifier() { 
114          if (this.identifier == null)
115            return false;
116          for (Identifier item : this.identifier)
117            if (!item.isEmpty())
118              return true;
119          return false;
120        }
121
122        public Identifier addIdentifier() { //3
123          Identifier t = new Identifier();
124          if (this.identifier == null)
125            this.identifier = new ArrayList<Identifier>();
126          this.identifier.add(t);
127          return t;
128        }
129
130        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent addIdentifier(Identifier t) { //3
131          if (t == null)
132            return this;
133          if (this.identifier == null)
134            this.identifier = new ArrayList<Identifier>();
135          this.identifier.add(t);
136          return this;
137        }
138
139        /**
140         * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
141         */
142        public Identifier getIdentifierFirstRep() { 
143          if (getIdentifier().isEmpty()) {
144            addIdentifier();
145          }
146          return getIdentifier().get(0);
147        }
148
149        /**
150         * @return {@link #country} (Country of authorization.)
151         */
152        public CodeableConcept getCountry() { 
153          if (this.country == null)
154            if (Configuration.errorOnAutoCreate())
155              throw new Error("Attempt to auto-create MedicinalProductAuthorizationJurisdictionalAuthorizationComponent.country");
156            else if (Configuration.doAutoCreate())
157              this.country = new CodeableConcept(); // cc
158          return this.country;
159        }
160
161        public boolean hasCountry() { 
162          return this.country != null && !this.country.isEmpty();
163        }
164
165        /**
166         * @param value {@link #country} (Country of authorization.)
167         */
168        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent setCountry(CodeableConcept value) { 
169          this.country = value;
170          return this;
171        }
172
173        /**
174         * @return {@link #jurisdiction} (Jurisdiction within a country.)
175         */
176        public List<CodeableConcept> getJurisdiction() { 
177          if (this.jurisdiction == null)
178            this.jurisdiction = new ArrayList<CodeableConcept>();
179          return this.jurisdiction;
180        }
181
182        /**
183         * @return Returns a reference to <code>this</code> for easy method chaining
184         */
185        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent setJurisdiction(List<CodeableConcept> theJurisdiction) { 
186          this.jurisdiction = theJurisdiction;
187          return this;
188        }
189
190        public boolean hasJurisdiction() { 
191          if (this.jurisdiction == null)
192            return false;
193          for (CodeableConcept item : this.jurisdiction)
194            if (!item.isEmpty())
195              return true;
196          return false;
197        }
198
199        public CodeableConcept addJurisdiction() { //3
200          CodeableConcept t = new CodeableConcept();
201          if (this.jurisdiction == null)
202            this.jurisdiction = new ArrayList<CodeableConcept>();
203          this.jurisdiction.add(t);
204          return t;
205        }
206
207        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent addJurisdiction(CodeableConcept t) { //3
208          if (t == null)
209            return this;
210          if (this.jurisdiction == null)
211            this.jurisdiction = new ArrayList<CodeableConcept>();
212          this.jurisdiction.add(t);
213          return this;
214        }
215
216        /**
217         * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
218         */
219        public CodeableConcept getJurisdictionFirstRep() { 
220          if (getJurisdiction().isEmpty()) {
221            addJurisdiction();
222          }
223          return getJurisdiction().get(0);
224        }
225
226        /**
227         * @return {@link #legalStatusOfSupply} (The legal status of supply in a jurisdiction or region.)
228         */
229        public CodeableConcept getLegalStatusOfSupply() { 
230          if (this.legalStatusOfSupply == null)
231            if (Configuration.errorOnAutoCreate())
232              throw new Error("Attempt to auto-create MedicinalProductAuthorizationJurisdictionalAuthorizationComponent.legalStatusOfSupply");
233            else if (Configuration.doAutoCreate())
234              this.legalStatusOfSupply = new CodeableConcept(); // cc
235          return this.legalStatusOfSupply;
236        }
237
238        public boolean hasLegalStatusOfSupply() { 
239          return this.legalStatusOfSupply != null && !this.legalStatusOfSupply.isEmpty();
240        }
241
242        /**
243         * @param value {@link #legalStatusOfSupply} (The legal status of supply in a jurisdiction or region.)
244         */
245        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent setLegalStatusOfSupply(CodeableConcept value) { 
246          this.legalStatusOfSupply = value;
247          return this;
248        }
249
250        /**
251         * @return {@link #validityPeriod} (The start and expected end date of the authorization.)
252         */
253        public Period getValidityPeriod() { 
254          if (this.validityPeriod == null)
255            if (Configuration.errorOnAutoCreate())
256              throw new Error("Attempt to auto-create MedicinalProductAuthorizationJurisdictionalAuthorizationComponent.validityPeriod");
257            else if (Configuration.doAutoCreate())
258              this.validityPeriod = new Period(); // cc
259          return this.validityPeriod;
260        }
261
262        public boolean hasValidityPeriod() { 
263          return this.validityPeriod != null && !this.validityPeriod.isEmpty();
264        }
265
266        /**
267         * @param value {@link #validityPeriod} (The start and expected end date of the authorization.)
268         */
269        public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent setValidityPeriod(Period value) { 
270          this.validityPeriod = value;
271          return this;
272        }
273
274        protected void listChildren(List<Property> children) {
275          super.listChildren(children);
276          children.add(new Property("identifier", "Identifier", "The assigned number for the marketing authorization.", 0, java.lang.Integer.MAX_VALUE, identifier));
277          children.add(new Property("country", "CodeableConcept", "Country of authorization.", 0, 1, country));
278          children.add(new Property("jurisdiction", "CodeableConcept", "Jurisdiction within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
279          children.add(new Property("legalStatusOfSupply", "CodeableConcept", "The legal status of supply in a jurisdiction or region.", 0, 1, legalStatusOfSupply));
280          children.add(new Property("validityPeriod", "Period", "The start and expected end date of the authorization.", 0, 1, validityPeriod));
281        }
282
283        @Override
284        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
285          switch (_hash) {
286          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The assigned number for the marketing authorization.", 0, java.lang.Integer.MAX_VALUE, identifier);
287          case 957831062: /*country*/  return new Property("country", "CodeableConcept", "Country of authorization.", 0, 1, country);
288          case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "Jurisdiction within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
289          case -844874031: /*legalStatusOfSupply*/  return new Property("legalStatusOfSupply", "CodeableConcept", "The legal status of supply in a jurisdiction or region.", 0, 1, legalStatusOfSupply);
290          case -1434195053: /*validityPeriod*/  return new Property("validityPeriod", "Period", "The start and expected end date of the authorization.", 0, 1, validityPeriod);
291          default: return super.getNamedProperty(_hash, _name, _checkValid);
292          }
293
294        }
295
296      @Override
297      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
298        switch (hash) {
299        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
300        case 957831062: /*country*/ return this.country == null ? new Base[0] : new Base[] {this.country}; // CodeableConcept
301        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
302        case -844874031: /*legalStatusOfSupply*/ return this.legalStatusOfSupply == null ? new Base[0] : new Base[] {this.legalStatusOfSupply}; // CodeableConcept
303        case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period
304        default: return super.getProperty(hash, name, checkValid);
305        }
306
307      }
308
309      @Override
310      public Base setProperty(int hash, String name, Base value) throws FHIRException {
311        switch (hash) {
312        case -1618432855: // identifier
313          this.getIdentifier().add(castToIdentifier(value)); // Identifier
314          return value;
315        case 957831062: // country
316          this.country = castToCodeableConcept(value); // CodeableConcept
317          return value;
318        case -507075711: // jurisdiction
319          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
320          return value;
321        case -844874031: // legalStatusOfSupply
322          this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
323          return value;
324        case -1434195053: // validityPeriod
325          this.validityPeriod = castToPeriod(value); // Period
326          return value;
327        default: return super.setProperty(hash, name, value);
328        }
329
330      }
331
332      @Override
333      public Base setProperty(String name, Base value) throws FHIRException {
334        if (name.equals("identifier")) {
335          this.getIdentifier().add(castToIdentifier(value));
336        } else if (name.equals("country")) {
337          this.country = castToCodeableConcept(value); // CodeableConcept
338        } else if (name.equals("jurisdiction")) {
339          this.getJurisdiction().add(castToCodeableConcept(value));
340        } else if (name.equals("legalStatusOfSupply")) {
341          this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
342        } else if (name.equals("validityPeriod")) {
343          this.validityPeriod = castToPeriod(value); // Period
344        } else
345          return super.setProperty(name, value);
346        return value;
347      }
348
349      @Override
350      public Base makeProperty(int hash, String name) throws FHIRException {
351        switch (hash) {
352        case -1618432855:  return addIdentifier(); 
353        case 957831062:  return getCountry(); 
354        case -507075711:  return addJurisdiction(); 
355        case -844874031:  return getLegalStatusOfSupply(); 
356        case -1434195053:  return getValidityPeriod(); 
357        default: return super.makeProperty(hash, name);
358        }
359
360      }
361
362      @Override
363      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
364        switch (hash) {
365        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
366        case 957831062: /*country*/ return new String[] {"CodeableConcept"};
367        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
368        case -844874031: /*legalStatusOfSupply*/ return new String[] {"CodeableConcept"};
369        case -1434195053: /*validityPeriod*/ return new String[] {"Period"};
370        default: return super.getTypesForProperty(hash, name);
371        }
372
373      }
374
375      @Override
376      public Base addChild(String name) throws FHIRException {
377        if (name.equals("identifier")) {
378          return addIdentifier();
379        }
380        else if (name.equals("country")) {
381          this.country = new CodeableConcept();
382          return this.country;
383        }
384        else if (name.equals("jurisdiction")) {
385          return addJurisdiction();
386        }
387        else if (name.equals("legalStatusOfSupply")) {
388          this.legalStatusOfSupply = new CodeableConcept();
389          return this.legalStatusOfSupply;
390        }
391        else if (name.equals("validityPeriod")) {
392          this.validityPeriod = new Period();
393          return this.validityPeriod;
394        }
395        else
396          return super.addChild(name);
397      }
398
399      public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent copy() {
400        MedicinalProductAuthorizationJurisdictionalAuthorizationComponent dst = new MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
401        copyValues(dst);
402        if (identifier != null) {
403          dst.identifier = new ArrayList<Identifier>();
404          for (Identifier i : identifier)
405            dst.identifier.add(i.copy());
406        };
407        dst.country = country == null ? null : country.copy();
408        if (jurisdiction != null) {
409          dst.jurisdiction = new ArrayList<CodeableConcept>();
410          for (CodeableConcept i : jurisdiction)
411            dst.jurisdiction.add(i.copy());
412        };
413        dst.legalStatusOfSupply = legalStatusOfSupply == null ? null : legalStatusOfSupply.copy();
414        dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy();
415        return dst;
416      }
417
418      @Override
419      public boolean equalsDeep(Base other_) {
420        if (!super.equalsDeep(other_))
421          return false;
422        if (!(other_ instanceof MedicinalProductAuthorizationJurisdictionalAuthorizationComponent))
423          return false;
424        MedicinalProductAuthorizationJurisdictionalAuthorizationComponent o = (MedicinalProductAuthorizationJurisdictionalAuthorizationComponent) other_;
425        return compareDeep(identifier, o.identifier, true) && compareDeep(country, o.country, true) && compareDeep(jurisdiction, o.jurisdiction, true)
426           && compareDeep(legalStatusOfSupply, o.legalStatusOfSupply, true) && compareDeep(validityPeriod, o.validityPeriod, true)
427          ;
428      }
429
430      @Override
431      public boolean equalsShallow(Base other_) {
432        if (!super.equalsShallow(other_))
433          return false;
434        if (!(other_ instanceof MedicinalProductAuthorizationJurisdictionalAuthorizationComponent))
435          return false;
436        MedicinalProductAuthorizationJurisdictionalAuthorizationComponent o = (MedicinalProductAuthorizationJurisdictionalAuthorizationComponent) other_;
437        return true;
438      }
439
440      public boolean isEmpty() {
441        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, country, jurisdiction
442          , legalStatusOfSupply, validityPeriod);
443      }
444
445  public String fhirType() {
446    return "MedicinalProductAuthorization.jurisdictionalAuthorization";
447
448  }
449
450  }
451
452    @Block()
453    public static class MedicinalProductAuthorizationProcedureComponent extends BackboneElement implements IBaseBackboneElement {
454        /**
455         * Identifier for this procedure.
456         */
457        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
458        @Description(shortDefinition="Identifier for this procedure", formalDefinition="Identifier for this procedure." )
459        protected Identifier identifier;
460
461        /**
462         * Type of procedure.
463         */
464        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
465        @Description(shortDefinition="Type of procedure", formalDefinition="Type of procedure." )
466        protected CodeableConcept type;
467
468        /**
469         * Date of procedure.
470         */
471        @Child(name = "date", type = {Period.class, DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
472        @Description(shortDefinition="Date of procedure", formalDefinition="Date of procedure." )
473        protected Type date;
474
475        /**
476         * Applcations submitted to obtain a marketing authorization.
477         */
478        @Child(name = "application", type = {MedicinalProductAuthorizationProcedureComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
479        @Description(shortDefinition="Applcations submitted to obtain a marketing authorization", formalDefinition="Applcations submitted to obtain a marketing authorization." )
480        protected List<MedicinalProductAuthorizationProcedureComponent> application;
481
482        private static final long serialVersionUID = 930236001L;
483
484    /**
485     * Constructor
486     */
487      public MedicinalProductAuthorizationProcedureComponent() {
488        super();
489      }
490
491    /**
492     * Constructor
493     */
494      public MedicinalProductAuthorizationProcedureComponent(CodeableConcept type) {
495        super();
496        this.type = type;
497      }
498
499        /**
500         * @return {@link #identifier} (Identifier for this procedure.)
501         */
502        public Identifier getIdentifier() { 
503          if (this.identifier == null)
504            if (Configuration.errorOnAutoCreate())
505              throw new Error("Attempt to auto-create MedicinalProductAuthorizationProcedureComponent.identifier");
506            else if (Configuration.doAutoCreate())
507              this.identifier = new Identifier(); // cc
508          return this.identifier;
509        }
510
511        public boolean hasIdentifier() { 
512          return this.identifier != null && !this.identifier.isEmpty();
513        }
514
515        /**
516         * @param value {@link #identifier} (Identifier for this procedure.)
517         */
518        public MedicinalProductAuthorizationProcedureComponent setIdentifier(Identifier value) { 
519          this.identifier = value;
520          return this;
521        }
522
523        /**
524         * @return {@link #type} (Type of procedure.)
525         */
526        public CodeableConcept getType() { 
527          if (this.type == null)
528            if (Configuration.errorOnAutoCreate())
529              throw new Error("Attempt to auto-create MedicinalProductAuthorizationProcedureComponent.type");
530            else if (Configuration.doAutoCreate())
531              this.type = new CodeableConcept(); // cc
532          return this.type;
533        }
534
535        public boolean hasType() { 
536          return this.type != null && !this.type.isEmpty();
537        }
538
539        /**
540         * @param value {@link #type} (Type of procedure.)
541         */
542        public MedicinalProductAuthorizationProcedureComponent setType(CodeableConcept value) { 
543          this.type = value;
544          return this;
545        }
546
547        /**
548         * @return {@link #date} (Date of procedure.)
549         */
550        public Type getDate() { 
551          return this.date;
552        }
553
554        /**
555         * @return {@link #date} (Date of procedure.)
556         */
557        public Period getDatePeriod() throws FHIRException { 
558          if (this.date == null)
559            return null;
560          if (!(this.date instanceof Period))
561            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.date.getClass().getName()+" was encountered");
562          return (Period) this.date;
563        }
564
565        public boolean hasDatePeriod() { 
566          return this != null && this.date instanceof Period;
567        }
568
569        /**
570         * @return {@link #date} (Date of procedure.)
571         */
572        public DateTimeType getDateDateTimeType() throws FHIRException { 
573          if (this.date == null)
574            return null;
575          if (!(this.date instanceof DateTimeType))
576            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.date.getClass().getName()+" was encountered");
577          return (DateTimeType) this.date;
578        }
579
580        public boolean hasDateDateTimeType() { 
581          return this != null && this.date instanceof DateTimeType;
582        }
583
584        public boolean hasDate() { 
585          return this.date != null && !this.date.isEmpty();
586        }
587
588        /**
589         * @param value {@link #date} (Date of procedure.)
590         */
591        public MedicinalProductAuthorizationProcedureComponent setDate(Type value) { 
592          if (value != null && !(value instanceof Period || value instanceof DateTimeType))
593            throw new Error("Not the right type for MedicinalProductAuthorization.procedure.date[x]: "+value.fhirType());
594          this.date = value;
595          return this;
596        }
597
598        /**
599         * @return {@link #application} (Applcations submitted to obtain a marketing authorization.)
600         */
601        public List<MedicinalProductAuthorizationProcedureComponent> getApplication() { 
602          if (this.application == null)
603            this.application = new ArrayList<MedicinalProductAuthorizationProcedureComponent>();
604          return this.application;
605        }
606
607        /**
608         * @return Returns a reference to <code>this</code> for easy method chaining
609         */
610        public MedicinalProductAuthorizationProcedureComponent setApplication(List<MedicinalProductAuthorizationProcedureComponent> theApplication) { 
611          this.application = theApplication;
612          return this;
613        }
614
615        public boolean hasApplication() { 
616          if (this.application == null)
617            return false;
618          for (MedicinalProductAuthorizationProcedureComponent item : this.application)
619            if (!item.isEmpty())
620              return true;
621          return false;
622        }
623
624        public MedicinalProductAuthorizationProcedureComponent addApplication() { //3
625          MedicinalProductAuthorizationProcedureComponent t = new MedicinalProductAuthorizationProcedureComponent();
626          if (this.application == null)
627            this.application = new ArrayList<MedicinalProductAuthorizationProcedureComponent>();
628          this.application.add(t);
629          return t;
630        }
631
632        public MedicinalProductAuthorizationProcedureComponent addApplication(MedicinalProductAuthorizationProcedureComponent t) { //3
633          if (t == null)
634            return this;
635          if (this.application == null)
636            this.application = new ArrayList<MedicinalProductAuthorizationProcedureComponent>();
637          this.application.add(t);
638          return this;
639        }
640
641        /**
642         * @return The first repetition of repeating field {@link #application}, creating it if it does not already exist
643         */
644        public MedicinalProductAuthorizationProcedureComponent getApplicationFirstRep() { 
645          if (getApplication().isEmpty()) {
646            addApplication();
647          }
648          return getApplication().get(0);
649        }
650
651        protected void listChildren(List<Property> children) {
652          super.listChildren(children);
653          children.add(new Property("identifier", "Identifier", "Identifier for this procedure.", 0, 1, identifier));
654          children.add(new Property("type", "CodeableConcept", "Type of procedure.", 0, 1, type));
655          children.add(new Property("date[x]", "Period|dateTime", "Date of procedure.", 0, 1, date));
656          children.add(new Property("application", "@MedicinalProductAuthorization.procedure", "Applcations submitted to obtain a marketing authorization.", 0, java.lang.Integer.MAX_VALUE, application));
657        }
658
659        @Override
660        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
661          switch (_hash) {
662          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier for this procedure.", 0, 1, identifier);
663          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of procedure.", 0, 1, type);
664          case 1443311122: /*date[x]*/  return new Property("date[x]", "Period|dateTime", "Date of procedure.", 0, 1, date);
665          case 3076014: /*date*/  return new Property("date[x]", "Period|dateTime", "Date of procedure.", 0, 1, date);
666          case 432297743: /*datePeriod*/  return new Property("date[x]", "Period|dateTime", "Date of procedure.", 0, 1, date);
667          case 185136489: /*dateDateTime*/  return new Property("date[x]", "Period|dateTime", "Date of procedure.", 0, 1, date);
668          case 1554253136: /*application*/  return new Property("application", "@MedicinalProductAuthorization.procedure", "Applcations submitted to obtain a marketing authorization.", 0, java.lang.Integer.MAX_VALUE, application);
669          default: return super.getNamedProperty(_hash, _name, _checkValid);
670          }
671
672        }
673
674      @Override
675      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
676        switch (hash) {
677        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
678        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
679        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // Type
680        case 1554253136: /*application*/ return this.application == null ? new Base[0] : this.application.toArray(new Base[this.application.size()]); // MedicinalProductAuthorizationProcedureComponent
681        default: return super.getProperty(hash, name, checkValid);
682        }
683
684      }
685
686      @Override
687      public Base setProperty(int hash, String name, Base value) throws FHIRException {
688        switch (hash) {
689        case -1618432855: // identifier
690          this.identifier = castToIdentifier(value); // Identifier
691          return value;
692        case 3575610: // type
693          this.type = castToCodeableConcept(value); // CodeableConcept
694          return value;
695        case 3076014: // date
696          this.date = castToType(value); // Type
697          return value;
698        case 1554253136: // application
699          this.getApplication().add((MedicinalProductAuthorizationProcedureComponent) value); // MedicinalProductAuthorizationProcedureComponent
700          return value;
701        default: return super.setProperty(hash, name, value);
702        }
703
704      }
705
706      @Override
707      public Base setProperty(String name, Base value) throws FHIRException {
708        if (name.equals("identifier")) {
709          this.identifier = castToIdentifier(value); // Identifier
710        } else if (name.equals("type")) {
711          this.type = castToCodeableConcept(value); // CodeableConcept
712        } else if (name.equals("date[x]")) {
713          this.date = castToType(value); // Type
714        } else if (name.equals("application")) {
715          this.getApplication().add((MedicinalProductAuthorizationProcedureComponent) value);
716        } else
717          return super.setProperty(name, value);
718        return value;
719      }
720
721      @Override
722      public Base makeProperty(int hash, String name) throws FHIRException {
723        switch (hash) {
724        case -1618432855:  return getIdentifier(); 
725        case 3575610:  return getType(); 
726        case 1443311122:  return getDate(); 
727        case 3076014:  return getDate(); 
728        case 1554253136:  return addApplication(); 
729        default: return super.makeProperty(hash, name);
730        }
731
732      }
733
734      @Override
735      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
736        switch (hash) {
737        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
738        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
739        case 3076014: /*date*/ return new String[] {"Period", "dateTime"};
740        case 1554253136: /*application*/ return new String[] {"@MedicinalProductAuthorization.procedure"};
741        default: return super.getTypesForProperty(hash, name);
742        }
743
744      }
745
746      @Override
747      public Base addChild(String name) throws FHIRException {
748        if (name.equals("identifier")) {
749          this.identifier = new Identifier();
750          return this.identifier;
751        }
752        else if (name.equals("type")) {
753          this.type = new CodeableConcept();
754          return this.type;
755        }
756        else if (name.equals("datePeriod")) {
757          this.date = new Period();
758          return this.date;
759        }
760        else if (name.equals("dateDateTime")) {
761          this.date = new DateTimeType();
762          return this.date;
763        }
764        else if (name.equals("application")) {
765          return addApplication();
766        }
767        else
768          return super.addChild(name);
769      }
770
771      public MedicinalProductAuthorizationProcedureComponent copy() {
772        MedicinalProductAuthorizationProcedureComponent dst = new MedicinalProductAuthorizationProcedureComponent();
773        copyValues(dst);
774        dst.identifier = identifier == null ? null : identifier.copy();
775        dst.type = type == null ? null : type.copy();
776        dst.date = date == null ? null : date.copy();
777        if (application != null) {
778          dst.application = new ArrayList<MedicinalProductAuthorizationProcedureComponent>();
779          for (MedicinalProductAuthorizationProcedureComponent i : application)
780            dst.application.add(i.copy());
781        };
782        return dst;
783      }
784
785      @Override
786      public boolean equalsDeep(Base other_) {
787        if (!super.equalsDeep(other_))
788          return false;
789        if (!(other_ instanceof MedicinalProductAuthorizationProcedureComponent))
790          return false;
791        MedicinalProductAuthorizationProcedureComponent o = (MedicinalProductAuthorizationProcedureComponent) other_;
792        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
793           && compareDeep(application, o.application, true);
794      }
795
796      @Override
797      public boolean equalsShallow(Base other_) {
798        if (!super.equalsShallow(other_))
799          return false;
800        if (!(other_ instanceof MedicinalProductAuthorizationProcedureComponent))
801          return false;
802        MedicinalProductAuthorizationProcedureComponent o = (MedicinalProductAuthorizationProcedureComponent) other_;
803        return true;
804      }
805
806      public boolean isEmpty() {
807        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, date, application
808          );
809      }
810
811  public String fhirType() {
812    return "MedicinalProductAuthorization.procedure";
813
814  }
815
816  }
817
818    /**
819     * Business identifier for the marketing authorization, as assigned by a regulator.
820     */
821    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
822    @Description(shortDefinition="Business identifier for the marketing authorization, as assigned by a regulator", formalDefinition="Business identifier for the marketing authorization, as assigned by a regulator." )
823    protected List<Identifier> identifier;
824
825    /**
826     * The medicinal product that is being authorized.
827     */
828    @Child(name = "subject", type = {MedicinalProduct.class, MedicinalProductPackaged.class}, order=1, min=0, max=1, modifier=false, summary=true)
829    @Description(shortDefinition="The medicinal product that is being authorized", formalDefinition="The medicinal product that is being authorized." )
830    protected Reference subject;
831
832    /**
833     * The actual object that is the target of the reference (The medicinal product that is being authorized.)
834     */
835    protected Resource subjectTarget;
836
837    /**
838     * The country in which the marketing authorization has been granted.
839     */
840    @Child(name = "country", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
841    @Description(shortDefinition="The country in which the marketing authorization has been granted", formalDefinition="The country in which the marketing authorization has been granted." )
842    protected List<CodeableConcept> country;
843
844    /**
845     * Jurisdiction within a country.
846     */
847    @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
848    @Description(shortDefinition="Jurisdiction within a country", formalDefinition="Jurisdiction within a country." )
849    protected List<CodeableConcept> jurisdiction;
850
851    /**
852     * The legal status of supply of the medicinal product as classified by the regulator.
853     */
854    @Child(name = "legalStatusOfSupply", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
855    @Description(shortDefinition="The legal status of supply of the medicinal product as classified by the regulator", formalDefinition="The legal status of supply of the medicinal product as classified by the regulator." )
856    protected CodeableConcept legalStatusOfSupply;
857
858    /**
859     * The status of the marketing authorization.
860     */
861    @Child(name = "status", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
862    @Description(shortDefinition="The status of the marketing authorization", formalDefinition="The status of the marketing authorization." )
863    protected CodeableConcept status;
864
865    /**
866     * The date at which the given status has become applicable.
867     */
868    @Child(name = "statusDate", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
869    @Description(shortDefinition="The date at which the given status has become applicable", formalDefinition="The date at which the given status has become applicable." )
870    protected DateTimeType statusDate;
871
872    /**
873     * The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.
874     */
875    @Child(name = "restoreDate", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
876    @Description(shortDefinition="The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored", formalDefinition="The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored." )
877    protected DateTimeType restoreDate;
878
879    /**
880     * The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format.
881     */
882    @Child(name = "validityPeriod", type = {Period.class}, order=8, min=0, max=1, modifier=false, summary=true)
883    @Description(shortDefinition="The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format", formalDefinition="The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format." )
884    protected Period validityPeriod;
885
886    /**
887     * A period of time after authorization before generic product applicatiosn can be submitted.
888     */
889    @Child(name = "dataExclusivityPeriod", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=true)
890    @Description(shortDefinition="A period of time after authorization before generic product applicatiosn can be submitted", formalDefinition="A period of time after authorization before generic product applicatiosn can be submitted." )
891    protected Period dataExclusivityPeriod;
892
893    /**
894     * The date when the first authorization was granted by a Medicines Regulatory Agency.
895     */
896    @Child(name = "dateOfFirstAuthorization", type = {DateTimeType.class}, order=10, min=0, max=1, modifier=false, summary=true)
897    @Description(shortDefinition="The date when the first authorization was granted by a Medicines Regulatory Agency", formalDefinition="The date when the first authorization was granted by a Medicines Regulatory Agency." )
898    protected DateTimeType dateOfFirstAuthorization;
899
900    /**
901     * Date of first marketing authorization for a company's new medicinal product in any country in the World.
902     */
903    @Child(name = "internationalBirthDate", type = {DateTimeType.class}, order=11, min=0, max=1, modifier=false, summary=true)
904    @Description(shortDefinition="Date of first marketing authorization for a company's new medicinal product in any country in the World", formalDefinition="Date of first marketing authorization for a company's new medicinal product in any country in the World." )
905    protected DateTimeType internationalBirthDate;
906
907    /**
908     * The legal framework against which this authorization is granted.
909     */
910    @Child(name = "legalBasis", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=true)
911    @Description(shortDefinition="The legal framework against which this authorization is granted", formalDefinition="The legal framework against which this authorization is granted." )
912    protected CodeableConcept legalBasis;
913
914    /**
915     * Authorization in areas within a country.
916     */
917    @Child(name = "jurisdictionalAuthorization", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
918    @Description(shortDefinition="Authorization in areas within a country", formalDefinition="Authorization in areas within a country." )
919    protected List<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent> jurisdictionalAuthorization;
920
921    /**
922     * Marketing Authorization Holder.
923     */
924    @Child(name = "holder", type = {Organization.class}, order=14, min=0, max=1, modifier=false, summary=true)
925    @Description(shortDefinition="Marketing Authorization Holder", formalDefinition="Marketing Authorization Holder." )
926    protected Reference holder;
927
928    /**
929     * The actual object that is the target of the reference (Marketing Authorization Holder.)
930     */
931    protected Organization holderTarget;
932
933    /**
934     * Medicines Regulatory Agency.
935     */
936    @Child(name = "regulator", type = {Organization.class}, order=15, min=0, max=1, modifier=false, summary=true)
937    @Description(shortDefinition="Medicines Regulatory Agency", formalDefinition="Medicines Regulatory Agency." )
938    protected Reference regulator;
939
940    /**
941     * The actual object that is the target of the reference (Medicines Regulatory Agency.)
942     */
943    protected Organization regulatorTarget;
944
945    /**
946     * The regulatory procedure for granting or amending a marketing authorization.
947     */
948    @Child(name = "procedure", type = {}, order=16, min=0, max=1, modifier=false, summary=true)
949    @Description(shortDefinition="The regulatory procedure for granting or amending a marketing authorization", formalDefinition="The regulatory procedure for granting or amending a marketing authorization." )
950    protected MedicinalProductAuthorizationProcedureComponent procedure;
951
952    private static final long serialVersionUID = -739568562L;
953
954  /**
955   * Constructor
956   */
957    public MedicinalProductAuthorization() {
958      super();
959    }
960
961    /**
962     * @return {@link #identifier} (Business identifier for the marketing authorization, as assigned by a regulator.)
963     */
964    public List<Identifier> getIdentifier() { 
965      if (this.identifier == null)
966        this.identifier = new ArrayList<Identifier>();
967      return this.identifier;
968    }
969
970    /**
971     * @return Returns a reference to <code>this</code> for easy method chaining
972     */
973    public MedicinalProductAuthorization setIdentifier(List<Identifier> theIdentifier) { 
974      this.identifier = theIdentifier;
975      return this;
976    }
977
978    public boolean hasIdentifier() { 
979      if (this.identifier == null)
980        return false;
981      for (Identifier item : this.identifier)
982        if (!item.isEmpty())
983          return true;
984      return false;
985    }
986
987    public Identifier addIdentifier() { //3
988      Identifier t = new Identifier();
989      if (this.identifier == null)
990        this.identifier = new ArrayList<Identifier>();
991      this.identifier.add(t);
992      return t;
993    }
994
995    public MedicinalProductAuthorization addIdentifier(Identifier t) { //3
996      if (t == null)
997        return this;
998      if (this.identifier == null)
999        this.identifier = new ArrayList<Identifier>();
1000      this.identifier.add(t);
1001      return this;
1002    }
1003
1004    /**
1005     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1006     */
1007    public Identifier getIdentifierFirstRep() { 
1008      if (getIdentifier().isEmpty()) {
1009        addIdentifier();
1010      }
1011      return getIdentifier().get(0);
1012    }
1013
1014    /**
1015     * @return {@link #subject} (The medicinal product that is being authorized.)
1016     */
1017    public Reference getSubject() { 
1018      if (this.subject == null)
1019        if (Configuration.errorOnAutoCreate())
1020          throw new Error("Attempt to auto-create MedicinalProductAuthorization.subject");
1021        else if (Configuration.doAutoCreate())
1022          this.subject = new Reference(); // cc
1023      return this.subject;
1024    }
1025
1026    public boolean hasSubject() { 
1027      return this.subject != null && !this.subject.isEmpty();
1028    }
1029
1030    /**
1031     * @param value {@link #subject} (The medicinal product that is being authorized.)
1032     */
1033    public MedicinalProductAuthorization setSubject(Reference value) { 
1034      this.subject = value;
1035      return this;
1036    }
1037
1038    /**
1039     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The medicinal product that is being authorized.)
1040     */
1041    public Resource getSubjectTarget() { 
1042      return this.subjectTarget;
1043    }
1044
1045    /**
1046     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The medicinal product that is being authorized.)
1047     */
1048    public MedicinalProductAuthorization setSubjectTarget(Resource value) { 
1049      this.subjectTarget = value;
1050      return this;
1051    }
1052
1053    /**
1054     * @return {@link #country} (The country in which the marketing authorization has been granted.)
1055     */
1056    public List<CodeableConcept> getCountry() { 
1057      if (this.country == null)
1058        this.country = new ArrayList<CodeableConcept>();
1059      return this.country;
1060    }
1061
1062    /**
1063     * @return Returns a reference to <code>this</code> for easy method chaining
1064     */
1065    public MedicinalProductAuthorization setCountry(List<CodeableConcept> theCountry) { 
1066      this.country = theCountry;
1067      return this;
1068    }
1069
1070    public boolean hasCountry() { 
1071      if (this.country == null)
1072        return false;
1073      for (CodeableConcept item : this.country)
1074        if (!item.isEmpty())
1075          return true;
1076      return false;
1077    }
1078
1079    public CodeableConcept addCountry() { //3
1080      CodeableConcept t = new CodeableConcept();
1081      if (this.country == null)
1082        this.country = new ArrayList<CodeableConcept>();
1083      this.country.add(t);
1084      return t;
1085    }
1086
1087    public MedicinalProductAuthorization addCountry(CodeableConcept t) { //3
1088      if (t == null)
1089        return this;
1090      if (this.country == null)
1091        this.country = new ArrayList<CodeableConcept>();
1092      this.country.add(t);
1093      return this;
1094    }
1095
1096    /**
1097     * @return The first repetition of repeating field {@link #country}, creating it if it does not already exist
1098     */
1099    public CodeableConcept getCountryFirstRep() { 
1100      if (getCountry().isEmpty()) {
1101        addCountry();
1102      }
1103      return getCountry().get(0);
1104    }
1105
1106    /**
1107     * @return {@link #jurisdiction} (Jurisdiction within a country.)
1108     */
1109    public List<CodeableConcept> getJurisdiction() { 
1110      if (this.jurisdiction == null)
1111        this.jurisdiction = new ArrayList<CodeableConcept>();
1112      return this.jurisdiction;
1113    }
1114
1115    /**
1116     * @return Returns a reference to <code>this</code> for easy method chaining
1117     */
1118    public MedicinalProductAuthorization setJurisdiction(List<CodeableConcept> theJurisdiction) { 
1119      this.jurisdiction = theJurisdiction;
1120      return this;
1121    }
1122
1123    public boolean hasJurisdiction() { 
1124      if (this.jurisdiction == null)
1125        return false;
1126      for (CodeableConcept item : this.jurisdiction)
1127        if (!item.isEmpty())
1128          return true;
1129      return false;
1130    }
1131
1132    public CodeableConcept addJurisdiction() { //3
1133      CodeableConcept t = new CodeableConcept();
1134      if (this.jurisdiction == null)
1135        this.jurisdiction = new ArrayList<CodeableConcept>();
1136      this.jurisdiction.add(t);
1137      return t;
1138    }
1139
1140    public MedicinalProductAuthorization addJurisdiction(CodeableConcept t) { //3
1141      if (t == null)
1142        return this;
1143      if (this.jurisdiction == null)
1144        this.jurisdiction = new ArrayList<CodeableConcept>();
1145      this.jurisdiction.add(t);
1146      return this;
1147    }
1148
1149    /**
1150     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
1151     */
1152    public CodeableConcept getJurisdictionFirstRep() { 
1153      if (getJurisdiction().isEmpty()) {
1154        addJurisdiction();
1155      }
1156      return getJurisdiction().get(0);
1157    }
1158
1159    /**
1160     * @return {@link #legalStatusOfSupply} (The legal status of supply of the medicinal product as classified by the regulator.)
1161     */
1162    public CodeableConcept getLegalStatusOfSupply() { 
1163      if (this.legalStatusOfSupply == null)
1164        if (Configuration.errorOnAutoCreate())
1165          throw new Error("Attempt to auto-create MedicinalProductAuthorization.legalStatusOfSupply");
1166        else if (Configuration.doAutoCreate())
1167          this.legalStatusOfSupply = new CodeableConcept(); // cc
1168      return this.legalStatusOfSupply;
1169    }
1170
1171    public boolean hasLegalStatusOfSupply() { 
1172      return this.legalStatusOfSupply != null && !this.legalStatusOfSupply.isEmpty();
1173    }
1174
1175    /**
1176     * @param value {@link #legalStatusOfSupply} (The legal status of supply of the medicinal product as classified by the regulator.)
1177     */
1178    public MedicinalProductAuthorization setLegalStatusOfSupply(CodeableConcept value) { 
1179      this.legalStatusOfSupply = value;
1180      return this;
1181    }
1182
1183    /**
1184     * @return {@link #status} (The status of the marketing authorization.)
1185     */
1186    public CodeableConcept getStatus() { 
1187      if (this.status == null)
1188        if (Configuration.errorOnAutoCreate())
1189          throw new Error("Attempt to auto-create MedicinalProductAuthorization.status");
1190        else if (Configuration.doAutoCreate())
1191          this.status = new CodeableConcept(); // cc
1192      return this.status;
1193    }
1194
1195    public boolean hasStatus() { 
1196      return this.status != null && !this.status.isEmpty();
1197    }
1198
1199    /**
1200     * @param value {@link #status} (The status of the marketing authorization.)
1201     */
1202    public MedicinalProductAuthorization setStatus(CodeableConcept value) { 
1203      this.status = value;
1204      return this;
1205    }
1206
1207    /**
1208     * @return {@link #statusDate} (The date at which the given status has become applicable.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
1209     */
1210    public DateTimeType getStatusDateElement() { 
1211      if (this.statusDate == null)
1212        if (Configuration.errorOnAutoCreate())
1213          throw new Error("Attempt to auto-create MedicinalProductAuthorization.statusDate");
1214        else if (Configuration.doAutoCreate())
1215          this.statusDate = new DateTimeType(); // bb
1216      return this.statusDate;
1217    }
1218
1219    public boolean hasStatusDateElement() { 
1220      return this.statusDate != null && !this.statusDate.isEmpty();
1221    }
1222
1223    public boolean hasStatusDate() { 
1224      return this.statusDate != null && !this.statusDate.isEmpty();
1225    }
1226
1227    /**
1228     * @param value {@link #statusDate} (The date at which the given status has become applicable.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
1229     */
1230    public MedicinalProductAuthorization setStatusDateElement(DateTimeType value) { 
1231      this.statusDate = value;
1232      return this;
1233    }
1234
1235    /**
1236     * @return The date at which the given status has become applicable.
1237     */
1238    public Date getStatusDate() { 
1239      return this.statusDate == null ? null : this.statusDate.getValue();
1240    }
1241
1242    /**
1243     * @param value The date at which the given status has become applicable.
1244     */
1245    public MedicinalProductAuthorization setStatusDate(Date value) { 
1246      if (value == null)
1247        this.statusDate = null;
1248      else {
1249        if (this.statusDate == null)
1250          this.statusDate = new DateTimeType();
1251        this.statusDate.setValue(value);
1252      }
1253      return this;
1254    }
1255
1256    /**
1257     * @return {@link #restoreDate} (The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.). This is the underlying object with id, value and extensions. The accessor "getRestoreDate" gives direct access to the value
1258     */
1259    public DateTimeType getRestoreDateElement() { 
1260      if (this.restoreDate == null)
1261        if (Configuration.errorOnAutoCreate())
1262          throw new Error("Attempt to auto-create MedicinalProductAuthorization.restoreDate");
1263        else if (Configuration.doAutoCreate())
1264          this.restoreDate = new DateTimeType(); // bb
1265      return this.restoreDate;
1266    }
1267
1268    public boolean hasRestoreDateElement() { 
1269      return this.restoreDate != null && !this.restoreDate.isEmpty();
1270    }
1271
1272    public boolean hasRestoreDate() { 
1273      return this.restoreDate != null && !this.restoreDate.isEmpty();
1274    }
1275
1276    /**
1277     * @param value {@link #restoreDate} (The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.). This is the underlying object with id, value and extensions. The accessor "getRestoreDate" gives direct access to the value
1278     */
1279    public MedicinalProductAuthorization setRestoreDateElement(DateTimeType value) { 
1280      this.restoreDate = value;
1281      return this;
1282    }
1283
1284    /**
1285     * @return The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.
1286     */
1287    public Date getRestoreDate() { 
1288      return this.restoreDate == null ? null : this.restoreDate.getValue();
1289    }
1290
1291    /**
1292     * @param value The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.
1293     */
1294    public MedicinalProductAuthorization setRestoreDate(Date value) { 
1295      if (value == null)
1296        this.restoreDate = null;
1297      else {
1298        if (this.restoreDate == null)
1299          this.restoreDate = new DateTimeType();
1300        this.restoreDate.setValue(value);
1301      }
1302      return this;
1303    }
1304
1305    /**
1306     * @return {@link #validityPeriod} (The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format.)
1307     */
1308    public Period getValidityPeriod() { 
1309      if (this.validityPeriod == null)
1310        if (Configuration.errorOnAutoCreate())
1311          throw new Error("Attempt to auto-create MedicinalProductAuthorization.validityPeriod");
1312        else if (Configuration.doAutoCreate())
1313          this.validityPeriod = new Period(); // cc
1314      return this.validityPeriod;
1315    }
1316
1317    public boolean hasValidityPeriod() { 
1318      return this.validityPeriod != null && !this.validityPeriod.isEmpty();
1319    }
1320
1321    /**
1322     * @param value {@link #validityPeriod} (The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format.)
1323     */
1324    public MedicinalProductAuthorization setValidityPeriod(Period value) { 
1325      this.validityPeriod = value;
1326      return this;
1327    }
1328
1329    /**
1330     * @return {@link #dataExclusivityPeriod} (A period of time after authorization before generic product applicatiosn can be submitted.)
1331     */
1332    public Period getDataExclusivityPeriod() { 
1333      if (this.dataExclusivityPeriod == null)
1334        if (Configuration.errorOnAutoCreate())
1335          throw new Error("Attempt to auto-create MedicinalProductAuthorization.dataExclusivityPeriod");
1336        else if (Configuration.doAutoCreate())
1337          this.dataExclusivityPeriod = new Period(); // cc
1338      return this.dataExclusivityPeriod;
1339    }
1340
1341    public boolean hasDataExclusivityPeriod() { 
1342      return this.dataExclusivityPeriod != null && !this.dataExclusivityPeriod.isEmpty();
1343    }
1344
1345    /**
1346     * @param value {@link #dataExclusivityPeriod} (A period of time after authorization before generic product applicatiosn can be submitted.)
1347     */
1348    public MedicinalProductAuthorization setDataExclusivityPeriod(Period value) { 
1349      this.dataExclusivityPeriod = value;
1350      return this;
1351    }
1352
1353    /**
1354     * @return {@link #dateOfFirstAuthorization} (The date when the first authorization was granted by a Medicines Regulatory Agency.). This is the underlying object with id, value and extensions. The accessor "getDateOfFirstAuthorization" gives direct access to the value
1355     */
1356    public DateTimeType getDateOfFirstAuthorizationElement() { 
1357      if (this.dateOfFirstAuthorization == null)
1358        if (Configuration.errorOnAutoCreate())
1359          throw new Error("Attempt to auto-create MedicinalProductAuthorization.dateOfFirstAuthorization");
1360        else if (Configuration.doAutoCreate())
1361          this.dateOfFirstAuthorization = new DateTimeType(); // bb
1362      return this.dateOfFirstAuthorization;
1363    }
1364
1365    public boolean hasDateOfFirstAuthorizationElement() { 
1366      return this.dateOfFirstAuthorization != null && !this.dateOfFirstAuthorization.isEmpty();
1367    }
1368
1369    public boolean hasDateOfFirstAuthorization() { 
1370      return this.dateOfFirstAuthorization != null && !this.dateOfFirstAuthorization.isEmpty();
1371    }
1372
1373    /**
1374     * @param value {@link #dateOfFirstAuthorization} (The date when the first authorization was granted by a Medicines Regulatory Agency.). This is the underlying object with id, value and extensions. The accessor "getDateOfFirstAuthorization" gives direct access to the value
1375     */
1376    public MedicinalProductAuthorization setDateOfFirstAuthorizationElement(DateTimeType value) { 
1377      this.dateOfFirstAuthorization = value;
1378      return this;
1379    }
1380
1381    /**
1382     * @return The date when the first authorization was granted by a Medicines Regulatory Agency.
1383     */
1384    public Date getDateOfFirstAuthorization() { 
1385      return this.dateOfFirstAuthorization == null ? null : this.dateOfFirstAuthorization.getValue();
1386    }
1387
1388    /**
1389     * @param value The date when the first authorization was granted by a Medicines Regulatory Agency.
1390     */
1391    public MedicinalProductAuthorization setDateOfFirstAuthorization(Date value) { 
1392      if (value == null)
1393        this.dateOfFirstAuthorization = null;
1394      else {
1395        if (this.dateOfFirstAuthorization == null)
1396          this.dateOfFirstAuthorization = new DateTimeType();
1397        this.dateOfFirstAuthorization.setValue(value);
1398      }
1399      return this;
1400    }
1401
1402    /**
1403     * @return {@link #internationalBirthDate} (Date of first marketing authorization for a company's new medicinal product in any country in the World.). This is the underlying object with id, value and extensions. The accessor "getInternationalBirthDate" gives direct access to the value
1404     */
1405    public DateTimeType getInternationalBirthDateElement() { 
1406      if (this.internationalBirthDate == null)
1407        if (Configuration.errorOnAutoCreate())
1408          throw new Error("Attempt to auto-create MedicinalProductAuthorization.internationalBirthDate");
1409        else if (Configuration.doAutoCreate())
1410          this.internationalBirthDate = new DateTimeType(); // bb
1411      return this.internationalBirthDate;
1412    }
1413
1414    public boolean hasInternationalBirthDateElement() { 
1415      return this.internationalBirthDate != null && !this.internationalBirthDate.isEmpty();
1416    }
1417
1418    public boolean hasInternationalBirthDate() { 
1419      return this.internationalBirthDate != null && !this.internationalBirthDate.isEmpty();
1420    }
1421
1422    /**
1423     * @param value {@link #internationalBirthDate} (Date of first marketing authorization for a company's new medicinal product in any country in the World.). This is the underlying object with id, value and extensions. The accessor "getInternationalBirthDate" gives direct access to the value
1424     */
1425    public MedicinalProductAuthorization setInternationalBirthDateElement(DateTimeType value) { 
1426      this.internationalBirthDate = value;
1427      return this;
1428    }
1429
1430    /**
1431     * @return Date of first marketing authorization for a company's new medicinal product in any country in the World.
1432     */
1433    public Date getInternationalBirthDate() { 
1434      return this.internationalBirthDate == null ? null : this.internationalBirthDate.getValue();
1435    }
1436
1437    /**
1438     * @param value Date of first marketing authorization for a company's new medicinal product in any country in the World.
1439     */
1440    public MedicinalProductAuthorization setInternationalBirthDate(Date value) { 
1441      if (value == null)
1442        this.internationalBirthDate = null;
1443      else {
1444        if (this.internationalBirthDate == null)
1445          this.internationalBirthDate = new DateTimeType();
1446        this.internationalBirthDate.setValue(value);
1447      }
1448      return this;
1449    }
1450
1451    /**
1452     * @return {@link #legalBasis} (The legal framework against which this authorization is granted.)
1453     */
1454    public CodeableConcept getLegalBasis() { 
1455      if (this.legalBasis == null)
1456        if (Configuration.errorOnAutoCreate())
1457          throw new Error("Attempt to auto-create MedicinalProductAuthorization.legalBasis");
1458        else if (Configuration.doAutoCreate())
1459          this.legalBasis = new CodeableConcept(); // cc
1460      return this.legalBasis;
1461    }
1462
1463    public boolean hasLegalBasis() { 
1464      return this.legalBasis != null && !this.legalBasis.isEmpty();
1465    }
1466
1467    /**
1468     * @param value {@link #legalBasis} (The legal framework against which this authorization is granted.)
1469     */
1470    public MedicinalProductAuthorization setLegalBasis(CodeableConcept value) { 
1471      this.legalBasis = value;
1472      return this;
1473    }
1474
1475    /**
1476     * @return {@link #jurisdictionalAuthorization} (Authorization in areas within a country.)
1477     */
1478    public List<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent> getJurisdictionalAuthorization() { 
1479      if (this.jurisdictionalAuthorization == null)
1480        this.jurisdictionalAuthorization = new ArrayList<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent>();
1481      return this.jurisdictionalAuthorization;
1482    }
1483
1484    /**
1485     * @return Returns a reference to <code>this</code> for easy method chaining
1486     */
1487    public MedicinalProductAuthorization setJurisdictionalAuthorization(List<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent> theJurisdictionalAuthorization) { 
1488      this.jurisdictionalAuthorization = theJurisdictionalAuthorization;
1489      return this;
1490    }
1491
1492    public boolean hasJurisdictionalAuthorization() { 
1493      if (this.jurisdictionalAuthorization == null)
1494        return false;
1495      for (MedicinalProductAuthorizationJurisdictionalAuthorizationComponent item : this.jurisdictionalAuthorization)
1496        if (!item.isEmpty())
1497          return true;
1498      return false;
1499    }
1500
1501    public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent addJurisdictionalAuthorization() { //3
1502      MedicinalProductAuthorizationJurisdictionalAuthorizationComponent t = new MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
1503      if (this.jurisdictionalAuthorization == null)
1504        this.jurisdictionalAuthorization = new ArrayList<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent>();
1505      this.jurisdictionalAuthorization.add(t);
1506      return t;
1507    }
1508
1509    public MedicinalProductAuthorization addJurisdictionalAuthorization(MedicinalProductAuthorizationJurisdictionalAuthorizationComponent t) { //3
1510      if (t == null)
1511        return this;
1512      if (this.jurisdictionalAuthorization == null)
1513        this.jurisdictionalAuthorization = new ArrayList<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent>();
1514      this.jurisdictionalAuthorization.add(t);
1515      return this;
1516    }
1517
1518    /**
1519     * @return The first repetition of repeating field {@link #jurisdictionalAuthorization}, creating it if it does not already exist
1520     */
1521    public MedicinalProductAuthorizationJurisdictionalAuthorizationComponent getJurisdictionalAuthorizationFirstRep() { 
1522      if (getJurisdictionalAuthorization().isEmpty()) {
1523        addJurisdictionalAuthorization();
1524      }
1525      return getJurisdictionalAuthorization().get(0);
1526    }
1527
1528    /**
1529     * @return {@link #holder} (Marketing Authorization Holder.)
1530     */
1531    public Reference getHolder() { 
1532      if (this.holder == null)
1533        if (Configuration.errorOnAutoCreate())
1534          throw new Error("Attempt to auto-create MedicinalProductAuthorization.holder");
1535        else if (Configuration.doAutoCreate())
1536          this.holder = new Reference(); // cc
1537      return this.holder;
1538    }
1539
1540    public boolean hasHolder() { 
1541      return this.holder != null && !this.holder.isEmpty();
1542    }
1543
1544    /**
1545     * @param value {@link #holder} (Marketing Authorization Holder.)
1546     */
1547    public MedicinalProductAuthorization setHolder(Reference value) { 
1548      this.holder = value;
1549      return this;
1550    }
1551
1552    /**
1553     * @return {@link #holder} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Marketing Authorization Holder.)
1554     */
1555    public Organization getHolderTarget() { 
1556      if (this.holderTarget == null)
1557        if (Configuration.errorOnAutoCreate())
1558          throw new Error("Attempt to auto-create MedicinalProductAuthorization.holder");
1559        else if (Configuration.doAutoCreate())
1560          this.holderTarget = new Organization(); // aa
1561      return this.holderTarget;
1562    }
1563
1564    /**
1565     * @param value {@link #holder} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Marketing Authorization Holder.)
1566     */
1567    public MedicinalProductAuthorization setHolderTarget(Organization value) { 
1568      this.holderTarget = value;
1569      return this;
1570    }
1571
1572    /**
1573     * @return {@link #regulator} (Medicines Regulatory Agency.)
1574     */
1575    public Reference getRegulator() { 
1576      if (this.regulator == null)
1577        if (Configuration.errorOnAutoCreate())
1578          throw new Error("Attempt to auto-create MedicinalProductAuthorization.regulator");
1579        else if (Configuration.doAutoCreate())
1580          this.regulator = new Reference(); // cc
1581      return this.regulator;
1582    }
1583
1584    public boolean hasRegulator() { 
1585      return this.regulator != null && !this.regulator.isEmpty();
1586    }
1587
1588    /**
1589     * @param value {@link #regulator} (Medicines Regulatory Agency.)
1590     */
1591    public MedicinalProductAuthorization setRegulator(Reference value) { 
1592      this.regulator = value;
1593      return this;
1594    }
1595
1596    /**
1597     * @return {@link #regulator} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Medicines Regulatory Agency.)
1598     */
1599    public Organization getRegulatorTarget() { 
1600      if (this.regulatorTarget == null)
1601        if (Configuration.errorOnAutoCreate())
1602          throw new Error("Attempt to auto-create MedicinalProductAuthorization.regulator");
1603        else if (Configuration.doAutoCreate())
1604          this.regulatorTarget = new Organization(); // aa
1605      return this.regulatorTarget;
1606    }
1607
1608    /**
1609     * @param value {@link #regulator} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Medicines Regulatory Agency.)
1610     */
1611    public MedicinalProductAuthorization setRegulatorTarget(Organization value) { 
1612      this.regulatorTarget = value;
1613      return this;
1614    }
1615
1616    /**
1617     * @return {@link #procedure} (The regulatory procedure for granting or amending a marketing authorization.)
1618     */
1619    public MedicinalProductAuthorizationProcedureComponent getProcedure() { 
1620      if (this.procedure == null)
1621        if (Configuration.errorOnAutoCreate())
1622          throw new Error("Attempt to auto-create MedicinalProductAuthorization.procedure");
1623        else if (Configuration.doAutoCreate())
1624          this.procedure = new MedicinalProductAuthorizationProcedureComponent(); // cc
1625      return this.procedure;
1626    }
1627
1628    public boolean hasProcedure() { 
1629      return this.procedure != null && !this.procedure.isEmpty();
1630    }
1631
1632    /**
1633     * @param value {@link #procedure} (The regulatory procedure for granting or amending a marketing authorization.)
1634     */
1635    public MedicinalProductAuthorization setProcedure(MedicinalProductAuthorizationProcedureComponent value) { 
1636      this.procedure = value;
1637      return this;
1638    }
1639
1640      protected void listChildren(List<Property> children) {
1641        super.listChildren(children);
1642        children.add(new Property("identifier", "Identifier", "Business identifier for the marketing authorization, as assigned by a regulator.", 0, java.lang.Integer.MAX_VALUE, identifier));
1643        children.add(new Property("subject", "Reference(MedicinalProduct|MedicinalProductPackaged)", "The medicinal product that is being authorized.", 0, 1, subject));
1644        children.add(new Property("country", "CodeableConcept", "The country in which the marketing authorization has been granted.", 0, java.lang.Integer.MAX_VALUE, country));
1645        children.add(new Property("jurisdiction", "CodeableConcept", "Jurisdiction within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
1646        children.add(new Property("legalStatusOfSupply", "CodeableConcept", "The legal status of supply of the medicinal product as classified by the regulator.", 0, 1, legalStatusOfSupply));
1647        children.add(new Property("status", "CodeableConcept", "The status of the marketing authorization.", 0, 1, status));
1648        children.add(new Property("statusDate", "dateTime", "The date at which the given status has become applicable.", 0, 1, statusDate));
1649        children.add(new Property("restoreDate", "dateTime", "The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.", 0, 1, restoreDate));
1650        children.add(new Property("validityPeriod", "Period", "The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format.", 0, 1, validityPeriod));
1651        children.add(new Property("dataExclusivityPeriod", "Period", "A period of time after authorization before generic product applicatiosn can be submitted.", 0, 1, dataExclusivityPeriod));
1652        children.add(new Property("dateOfFirstAuthorization", "dateTime", "The date when the first authorization was granted by a Medicines Regulatory Agency.", 0, 1, dateOfFirstAuthorization));
1653        children.add(new Property("internationalBirthDate", "dateTime", "Date of first marketing authorization for a company's new medicinal product in any country in the World.", 0, 1, internationalBirthDate));
1654        children.add(new Property("legalBasis", "CodeableConcept", "The legal framework against which this authorization is granted.", 0, 1, legalBasis));
1655        children.add(new Property("jurisdictionalAuthorization", "", "Authorization in areas within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdictionalAuthorization));
1656        children.add(new Property("holder", "Reference(Organization)", "Marketing Authorization Holder.", 0, 1, holder));
1657        children.add(new Property("regulator", "Reference(Organization)", "Medicines Regulatory Agency.", 0, 1, regulator));
1658        children.add(new Property("procedure", "", "The regulatory procedure for granting or amending a marketing authorization.", 0, 1, procedure));
1659      }
1660
1661      @Override
1662      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1663        switch (_hash) {
1664        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifier for the marketing authorization, as assigned by a regulator.", 0, java.lang.Integer.MAX_VALUE, identifier);
1665        case -1867885268: /*subject*/  return new Property("subject", "Reference(MedicinalProduct|MedicinalProductPackaged)", "The medicinal product that is being authorized.", 0, 1, subject);
1666        case 957831062: /*country*/  return new Property("country", "CodeableConcept", "The country in which the marketing authorization has been granted.", 0, java.lang.Integer.MAX_VALUE, country);
1667        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "Jurisdiction within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
1668        case -844874031: /*legalStatusOfSupply*/  return new Property("legalStatusOfSupply", "CodeableConcept", "The legal status of supply of the medicinal product as classified by the regulator.", 0, 1, legalStatusOfSupply);
1669        case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The status of the marketing authorization.", 0, 1, status);
1670        case 247524032: /*statusDate*/  return new Property("statusDate", "dateTime", "The date at which the given status has become applicable.", 0, 1, statusDate);
1671        case 329465692: /*restoreDate*/  return new Property("restoreDate", "dateTime", "The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored.", 0, 1, restoreDate);
1672        case -1434195053: /*validityPeriod*/  return new Property("validityPeriod", "Period", "The beginning of the time period in which the marketing authorization is in the specific status shall be specified A complete date consisting of day, month and year shall be specified using the ISO 8601 date format.", 0, 1, validityPeriod);
1673        case 1940655806: /*dataExclusivityPeriod*/  return new Property("dataExclusivityPeriod", "Period", "A period of time after authorization before generic product applicatiosn can be submitted.", 0, 1, dataExclusivityPeriod);
1674        case -1026933074: /*dateOfFirstAuthorization*/  return new Property("dateOfFirstAuthorization", "dateTime", "The date when the first authorization was granted by a Medicines Regulatory Agency.", 0, 1, dateOfFirstAuthorization);
1675        case 400069151: /*internationalBirthDate*/  return new Property("internationalBirthDate", "dateTime", "Date of first marketing authorization for a company's new medicinal product in any country in the World.", 0, 1, internationalBirthDate);
1676        case 552357125: /*legalBasis*/  return new Property("legalBasis", "CodeableConcept", "The legal framework against which this authorization is granted.", 0, 1, legalBasis);
1677        case 1459432557: /*jurisdictionalAuthorization*/  return new Property("jurisdictionalAuthorization", "", "Authorization in areas within a country.", 0, java.lang.Integer.MAX_VALUE, jurisdictionalAuthorization);
1678        case -1211707988: /*holder*/  return new Property("holder", "Reference(Organization)", "Marketing Authorization Holder.", 0, 1, holder);
1679        case 414760449: /*regulator*/  return new Property("regulator", "Reference(Organization)", "Medicines Regulatory Agency.", 0, 1, regulator);
1680        case -1095204141: /*procedure*/  return new Property("procedure", "", "The regulatory procedure for granting or amending a marketing authorization.", 0, 1, procedure);
1681        default: return super.getNamedProperty(_hash, _name, _checkValid);
1682        }
1683
1684      }
1685
1686      @Override
1687      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1688        switch (hash) {
1689        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1690        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1691        case 957831062: /*country*/ return this.country == null ? new Base[0] : this.country.toArray(new Base[this.country.size()]); // CodeableConcept
1692        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
1693        case -844874031: /*legalStatusOfSupply*/ return this.legalStatusOfSupply == null ? new Base[0] : new Base[] {this.legalStatusOfSupply}; // CodeableConcept
1694        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
1695        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : new Base[] {this.statusDate}; // DateTimeType
1696        case 329465692: /*restoreDate*/ return this.restoreDate == null ? new Base[0] : new Base[] {this.restoreDate}; // DateTimeType
1697        case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period
1698        case 1940655806: /*dataExclusivityPeriod*/ return this.dataExclusivityPeriod == null ? new Base[0] : new Base[] {this.dataExclusivityPeriod}; // Period
1699        case -1026933074: /*dateOfFirstAuthorization*/ return this.dateOfFirstAuthorization == null ? new Base[0] : new Base[] {this.dateOfFirstAuthorization}; // DateTimeType
1700        case 400069151: /*internationalBirthDate*/ return this.internationalBirthDate == null ? new Base[0] : new Base[] {this.internationalBirthDate}; // DateTimeType
1701        case 552357125: /*legalBasis*/ return this.legalBasis == null ? new Base[0] : new Base[] {this.legalBasis}; // CodeableConcept
1702        case 1459432557: /*jurisdictionalAuthorization*/ return this.jurisdictionalAuthorization == null ? new Base[0] : this.jurisdictionalAuthorization.toArray(new Base[this.jurisdictionalAuthorization.size()]); // MedicinalProductAuthorizationJurisdictionalAuthorizationComponent
1703        case -1211707988: /*holder*/ return this.holder == null ? new Base[0] : new Base[] {this.holder}; // Reference
1704        case 414760449: /*regulator*/ return this.regulator == null ? new Base[0] : new Base[] {this.regulator}; // Reference
1705        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // MedicinalProductAuthorizationProcedureComponent
1706        default: return super.getProperty(hash, name, checkValid);
1707        }
1708
1709      }
1710
1711      @Override
1712      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1713        switch (hash) {
1714        case -1618432855: // identifier
1715          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1716          return value;
1717        case -1867885268: // subject
1718          this.subject = castToReference(value); // Reference
1719          return value;
1720        case 957831062: // country
1721          this.getCountry().add(castToCodeableConcept(value)); // CodeableConcept
1722          return value;
1723        case -507075711: // jurisdiction
1724          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
1725          return value;
1726        case -844874031: // legalStatusOfSupply
1727          this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
1728          return value;
1729        case -892481550: // status
1730          this.status = castToCodeableConcept(value); // CodeableConcept
1731          return value;
1732        case 247524032: // statusDate
1733          this.statusDate = castToDateTime(value); // DateTimeType
1734          return value;
1735        case 329465692: // restoreDate
1736          this.restoreDate = castToDateTime(value); // DateTimeType
1737          return value;
1738        case -1434195053: // validityPeriod
1739          this.validityPeriod = castToPeriod(value); // Period
1740          return value;
1741        case 1940655806: // dataExclusivityPeriod
1742          this.dataExclusivityPeriod = castToPeriod(value); // Period
1743          return value;
1744        case -1026933074: // dateOfFirstAuthorization
1745          this.dateOfFirstAuthorization = castToDateTime(value); // DateTimeType
1746          return value;
1747        case 400069151: // internationalBirthDate
1748          this.internationalBirthDate = castToDateTime(value); // DateTimeType
1749          return value;
1750        case 552357125: // legalBasis
1751          this.legalBasis = castToCodeableConcept(value); // CodeableConcept
1752          return value;
1753        case 1459432557: // jurisdictionalAuthorization
1754          this.getJurisdictionalAuthorization().add((MedicinalProductAuthorizationJurisdictionalAuthorizationComponent) value); // MedicinalProductAuthorizationJurisdictionalAuthorizationComponent
1755          return value;
1756        case -1211707988: // holder
1757          this.holder = castToReference(value); // Reference
1758          return value;
1759        case 414760449: // regulator
1760          this.regulator = castToReference(value); // Reference
1761          return value;
1762        case -1095204141: // procedure
1763          this.procedure = (MedicinalProductAuthorizationProcedureComponent) value; // MedicinalProductAuthorizationProcedureComponent
1764          return value;
1765        default: return super.setProperty(hash, name, value);
1766        }
1767
1768      }
1769
1770      @Override
1771      public Base setProperty(String name, Base value) throws FHIRException {
1772        if (name.equals("identifier")) {
1773          this.getIdentifier().add(castToIdentifier(value));
1774        } else if (name.equals("subject")) {
1775          this.subject = castToReference(value); // Reference
1776        } else if (name.equals("country")) {
1777          this.getCountry().add(castToCodeableConcept(value));
1778        } else if (name.equals("jurisdiction")) {
1779          this.getJurisdiction().add(castToCodeableConcept(value));
1780        } else if (name.equals("legalStatusOfSupply")) {
1781          this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
1782        } else if (name.equals("status")) {
1783          this.status = castToCodeableConcept(value); // CodeableConcept
1784        } else if (name.equals("statusDate")) {
1785          this.statusDate = castToDateTime(value); // DateTimeType
1786        } else if (name.equals("restoreDate")) {
1787          this.restoreDate = castToDateTime(value); // DateTimeType
1788        } else if (name.equals("validityPeriod")) {
1789          this.validityPeriod = castToPeriod(value); // Period
1790        } else if (name.equals("dataExclusivityPeriod")) {
1791          this.dataExclusivityPeriod = castToPeriod(value); // Period
1792        } else if (name.equals("dateOfFirstAuthorization")) {
1793          this.dateOfFirstAuthorization = castToDateTime(value); // DateTimeType
1794        } else if (name.equals("internationalBirthDate")) {
1795          this.internationalBirthDate = castToDateTime(value); // DateTimeType
1796        } else if (name.equals("legalBasis")) {
1797          this.legalBasis = castToCodeableConcept(value); // CodeableConcept
1798        } else if (name.equals("jurisdictionalAuthorization")) {
1799          this.getJurisdictionalAuthorization().add((MedicinalProductAuthorizationJurisdictionalAuthorizationComponent) value);
1800        } else if (name.equals("holder")) {
1801          this.holder = castToReference(value); // Reference
1802        } else if (name.equals("regulator")) {
1803          this.regulator = castToReference(value); // Reference
1804        } else if (name.equals("procedure")) {
1805          this.procedure = (MedicinalProductAuthorizationProcedureComponent) value; // MedicinalProductAuthorizationProcedureComponent
1806        } else
1807          return super.setProperty(name, value);
1808        return value;
1809      }
1810
1811      @Override
1812      public Base makeProperty(int hash, String name) throws FHIRException {
1813        switch (hash) {
1814        case -1618432855:  return addIdentifier(); 
1815        case -1867885268:  return getSubject(); 
1816        case 957831062:  return addCountry(); 
1817        case -507075711:  return addJurisdiction(); 
1818        case -844874031:  return getLegalStatusOfSupply(); 
1819        case -892481550:  return getStatus(); 
1820        case 247524032:  return getStatusDateElement();
1821        case 329465692:  return getRestoreDateElement();
1822        case -1434195053:  return getValidityPeriod(); 
1823        case 1940655806:  return getDataExclusivityPeriod(); 
1824        case -1026933074:  return getDateOfFirstAuthorizationElement();
1825        case 400069151:  return getInternationalBirthDateElement();
1826        case 552357125:  return getLegalBasis(); 
1827        case 1459432557:  return addJurisdictionalAuthorization(); 
1828        case -1211707988:  return getHolder(); 
1829        case 414760449:  return getRegulator(); 
1830        case -1095204141:  return getProcedure(); 
1831        default: return super.makeProperty(hash, name);
1832        }
1833
1834      }
1835
1836      @Override
1837      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1838        switch (hash) {
1839        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1840        case -1867885268: /*subject*/ return new String[] {"Reference"};
1841        case 957831062: /*country*/ return new String[] {"CodeableConcept"};
1842        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
1843        case -844874031: /*legalStatusOfSupply*/ return new String[] {"CodeableConcept"};
1844        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
1845        case 247524032: /*statusDate*/ return new String[] {"dateTime"};
1846        case 329465692: /*restoreDate*/ return new String[] {"dateTime"};
1847        case -1434195053: /*validityPeriod*/ return new String[] {"Period"};
1848        case 1940655806: /*dataExclusivityPeriod*/ return new String[] {"Period"};
1849        case -1026933074: /*dateOfFirstAuthorization*/ return new String[] {"dateTime"};
1850        case 400069151: /*internationalBirthDate*/ return new String[] {"dateTime"};
1851        case 552357125: /*legalBasis*/ return new String[] {"CodeableConcept"};
1852        case 1459432557: /*jurisdictionalAuthorization*/ return new String[] {};
1853        case -1211707988: /*holder*/ return new String[] {"Reference"};
1854        case 414760449: /*regulator*/ return new String[] {"Reference"};
1855        case -1095204141: /*procedure*/ return new String[] {};
1856        default: return super.getTypesForProperty(hash, name);
1857        }
1858
1859      }
1860
1861      @Override
1862      public Base addChild(String name) throws FHIRException {
1863        if (name.equals("identifier")) {
1864          return addIdentifier();
1865        }
1866        else if (name.equals("subject")) {
1867          this.subject = new Reference();
1868          return this.subject;
1869        }
1870        else if (name.equals("country")) {
1871          return addCountry();
1872        }
1873        else if (name.equals("jurisdiction")) {
1874          return addJurisdiction();
1875        }
1876        else if (name.equals("legalStatusOfSupply")) {
1877          this.legalStatusOfSupply = new CodeableConcept();
1878          return this.legalStatusOfSupply;
1879        }
1880        else if (name.equals("status")) {
1881          this.status = new CodeableConcept();
1882          return this.status;
1883        }
1884        else if (name.equals("statusDate")) {
1885          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductAuthorization.statusDate");
1886        }
1887        else if (name.equals("restoreDate")) {
1888          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductAuthorization.restoreDate");
1889        }
1890        else if (name.equals("validityPeriod")) {
1891          this.validityPeriod = new Period();
1892          return this.validityPeriod;
1893        }
1894        else if (name.equals("dataExclusivityPeriod")) {
1895          this.dataExclusivityPeriod = new Period();
1896          return this.dataExclusivityPeriod;
1897        }
1898        else if (name.equals("dateOfFirstAuthorization")) {
1899          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductAuthorization.dateOfFirstAuthorization");
1900        }
1901        else if (name.equals("internationalBirthDate")) {
1902          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductAuthorization.internationalBirthDate");
1903        }
1904        else if (name.equals("legalBasis")) {
1905          this.legalBasis = new CodeableConcept();
1906          return this.legalBasis;
1907        }
1908        else if (name.equals("jurisdictionalAuthorization")) {
1909          return addJurisdictionalAuthorization();
1910        }
1911        else if (name.equals("holder")) {
1912          this.holder = new Reference();
1913          return this.holder;
1914        }
1915        else if (name.equals("regulator")) {
1916          this.regulator = new Reference();
1917          return this.regulator;
1918        }
1919        else if (name.equals("procedure")) {
1920          this.procedure = new MedicinalProductAuthorizationProcedureComponent();
1921          return this.procedure;
1922        }
1923        else
1924          return super.addChild(name);
1925      }
1926
1927  public String fhirType() {
1928    return "MedicinalProductAuthorization";
1929
1930  }
1931
1932      public MedicinalProductAuthorization copy() {
1933        MedicinalProductAuthorization dst = new MedicinalProductAuthorization();
1934        copyValues(dst);
1935        if (identifier != null) {
1936          dst.identifier = new ArrayList<Identifier>();
1937          for (Identifier i : identifier)
1938            dst.identifier.add(i.copy());
1939        };
1940        dst.subject = subject == null ? null : subject.copy();
1941        if (country != null) {
1942          dst.country = new ArrayList<CodeableConcept>();
1943          for (CodeableConcept i : country)
1944            dst.country.add(i.copy());
1945        };
1946        if (jurisdiction != null) {
1947          dst.jurisdiction = new ArrayList<CodeableConcept>();
1948          for (CodeableConcept i : jurisdiction)
1949            dst.jurisdiction.add(i.copy());
1950        };
1951        dst.legalStatusOfSupply = legalStatusOfSupply == null ? null : legalStatusOfSupply.copy();
1952        dst.status = status == null ? null : status.copy();
1953        dst.statusDate = statusDate == null ? null : statusDate.copy();
1954        dst.restoreDate = restoreDate == null ? null : restoreDate.copy();
1955        dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy();
1956        dst.dataExclusivityPeriod = dataExclusivityPeriod == null ? null : dataExclusivityPeriod.copy();
1957        dst.dateOfFirstAuthorization = dateOfFirstAuthorization == null ? null : dateOfFirstAuthorization.copy();
1958        dst.internationalBirthDate = internationalBirthDate == null ? null : internationalBirthDate.copy();
1959        dst.legalBasis = legalBasis == null ? null : legalBasis.copy();
1960        if (jurisdictionalAuthorization != null) {
1961          dst.jurisdictionalAuthorization = new ArrayList<MedicinalProductAuthorizationJurisdictionalAuthorizationComponent>();
1962          for (MedicinalProductAuthorizationJurisdictionalAuthorizationComponent i : jurisdictionalAuthorization)
1963            dst.jurisdictionalAuthorization.add(i.copy());
1964        };
1965        dst.holder = holder == null ? null : holder.copy();
1966        dst.regulator = regulator == null ? null : regulator.copy();
1967        dst.procedure = procedure == null ? null : procedure.copy();
1968        return dst;
1969      }
1970
1971      protected MedicinalProductAuthorization typedCopy() {
1972        return copy();
1973      }
1974
1975      @Override
1976      public boolean equalsDeep(Base other_) {
1977        if (!super.equalsDeep(other_))
1978          return false;
1979        if (!(other_ instanceof MedicinalProductAuthorization))
1980          return false;
1981        MedicinalProductAuthorization o = (MedicinalProductAuthorization) other_;
1982        return compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) && compareDeep(country, o.country, true)
1983           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(legalStatusOfSupply, o.legalStatusOfSupply, true)
1984           && compareDeep(status, o.status, true) && compareDeep(statusDate, o.statusDate, true) && compareDeep(restoreDate, o.restoreDate, true)
1985           && compareDeep(validityPeriod, o.validityPeriod, true) && compareDeep(dataExclusivityPeriod, o.dataExclusivityPeriod, true)
1986           && compareDeep(dateOfFirstAuthorization, o.dateOfFirstAuthorization, true) && compareDeep(internationalBirthDate, o.internationalBirthDate, true)
1987           && compareDeep(legalBasis, o.legalBasis, true) && compareDeep(jurisdictionalAuthorization, o.jurisdictionalAuthorization, true)
1988           && compareDeep(holder, o.holder, true) && compareDeep(regulator, o.regulator, true) && compareDeep(procedure, o.procedure, true)
1989          ;
1990      }
1991
1992      @Override
1993      public boolean equalsShallow(Base other_) {
1994        if (!super.equalsShallow(other_))
1995          return false;
1996        if (!(other_ instanceof MedicinalProductAuthorization))
1997          return false;
1998        MedicinalProductAuthorization o = (MedicinalProductAuthorization) other_;
1999        return compareValues(statusDate, o.statusDate, true) && compareValues(restoreDate, o.restoreDate, true)
2000           && compareValues(dateOfFirstAuthorization, o.dateOfFirstAuthorization, true) && compareValues(internationalBirthDate, o.internationalBirthDate, true)
2001          ;
2002      }
2003
2004      public boolean isEmpty() {
2005        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, subject, country
2006          , jurisdiction, legalStatusOfSupply, status, statusDate, restoreDate, validityPeriod
2007          , dataExclusivityPeriod, dateOfFirstAuthorization, internationalBirthDate, legalBasis
2008          , jurisdictionalAuthorization, holder, regulator, procedure);
2009      }
2010
2011  @Override
2012  public ResourceType getResourceType() {
2013    return ResourceType.MedicinalProductAuthorization;
2014   }
2015
2016 /**
2017   * Search parameter: <b>subject</b>
2018   * <p>
2019   * Description: <b>The item that is being authorized</b><br>
2020   * Type: <b>reference</b><br>
2021   * Path: <b>MedicinalProductAuthorization.subject</b><br>
2022   * </p>
2023   */
2024  @SearchParamDefinition(name="subject", path="MedicinalProductAuthorization.subject", description="The item that is being authorized", type="reference", target={MedicinalProduct.class, MedicinalProductPackaged.class } )
2025  public static final String SP_SUBJECT = "subject";
2026 /**
2027   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2028   * <p>
2029   * Description: <b>The item that is being authorized</b><br>
2030   * Type: <b>reference</b><br>
2031   * Path: <b>MedicinalProductAuthorization.subject</b><br>
2032   * </p>
2033   */
2034  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2035
2036/**
2037   * Constant for fluent queries to be used to add include statements. Specifies
2038   * the path value of "<b>MedicinalProductAuthorization:subject</b>".
2039   */
2040  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicinalProductAuthorization:subject").toLocked();
2041
2042
2043}
2044