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 Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0
033
034import java.util.*;
035
036import ca.uhn.fhir.model.api.annotation.Child;
037import ca.uhn.fhir.model.api.annotation.ChildOrder;
038import ca.uhn.fhir.model.api.annotation.Description;
039import ca.uhn.fhir.model.api.annotation.DatatypeDef;
040import ca.uhn.fhir.model.api.annotation.Block;
041import org.hl7.fhir.instance.model.api.*;
042import org.hl7.fhir.exceptions.FHIRException;
043/**
044 * The marketing status describes the date when a medicinal product is actually put on the market or the date as of which it is no longer available.
045 */
046@DatatypeDef(name="MarketingStatus")
047public class MarketingStatus extends BackboneElement implements ICompositeType {
048
049    /**
050     * The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements.
051     */
052    @Child(name = "country", type = {CodeableConcept.class}, order=0, min=1, max=1, modifier=false, summary=true)
053    @Description(shortDefinition="The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements", formalDefinition="The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements." )
054    protected CodeableConcept country;
055
056    /**
057     * Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified.
058     */
059    @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
060    @Description(shortDefinition="Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified", formalDefinition="Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified." )
061    protected CodeableConcept jurisdiction;
062
063    /**
064     * This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples.
065     */
066    @Child(name = "status", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
067    @Description(shortDefinition="This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples", formalDefinition="This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples." )
068    protected CodeableConcept status;
069
070    /**
071     * The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.
072     */
073    @Child(name = "dateRange", type = {Period.class}, order=3, min=1, max=1, modifier=false, summary=true)
074    @Description(shortDefinition="The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain", formalDefinition="The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain." )
075    protected Period dateRange;
076
077    /**
078     * The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.
079     */
080    @Child(name = "restoreDate", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
081    @Description(shortDefinition="The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain", formalDefinition="The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain." )
082    protected DateTimeType restoreDate;
083
084    private static final long serialVersionUID = -1445736863L;
085
086  /**
087   * Constructor
088   */
089    public MarketingStatus() {
090      super();
091    }
092
093  /**
094   * Constructor
095   */
096    public MarketingStatus(CodeableConcept country, CodeableConcept status, Period dateRange) {
097      super();
098      this.country = country;
099      this.status = status;
100      this.dateRange = dateRange;
101    }
102
103    /**
104     * @return {@link #country} (The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements.)
105     */
106    public CodeableConcept getCountry() { 
107      if (this.country == null)
108        if (Configuration.errorOnAutoCreate())
109          throw new Error("Attempt to auto-create MarketingStatus.country");
110        else if (Configuration.doAutoCreate())
111          this.country = new CodeableConcept(); // cc
112      return this.country;
113    }
114
115    public boolean hasCountry() { 
116      return this.country != null && !this.country.isEmpty();
117    }
118
119    /**
120     * @param value {@link #country} (The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements.)
121     */
122    public MarketingStatus setCountry(CodeableConcept value) { 
123      this.country = value;
124      return this;
125    }
126
127    /**
128     * @return {@link #jurisdiction} (Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified.)
129     */
130    public CodeableConcept getJurisdiction() { 
131      if (this.jurisdiction == null)
132        if (Configuration.errorOnAutoCreate())
133          throw new Error("Attempt to auto-create MarketingStatus.jurisdiction");
134        else if (Configuration.doAutoCreate())
135          this.jurisdiction = new CodeableConcept(); // cc
136      return this.jurisdiction;
137    }
138
139    public boolean hasJurisdiction() { 
140      return this.jurisdiction != null && !this.jurisdiction.isEmpty();
141    }
142
143    /**
144     * @param value {@link #jurisdiction} (Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified.)
145     */
146    public MarketingStatus setJurisdiction(CodeableConcept value) { 
147      this.jurisdiction = value;
148      return this;
149    }
150
151    /**
152     * @return {@link #status} (This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples.)
153     */
154    public CodeableConcept getStatus() { 
155      if (this.status == null)
156        if (Configuration.errorOnAutoCreate())
157          throw new Error("Attempt to auto-create MarketingStatus.status");
158        else if (Configuration.doAutoCreate())
159          this.status = new CodeableConcept(); // cc
160      return this.status;
161    }
162
163    public boolean hasStatus() { 
164      return this.status != null && !this.status.isEmpty();
165    }
166
167    /**
168     * @param value {@link #status} (This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples.)
169     */
170    public MarketingStatus setStatus(CodeableConcept value) { 
171      this.status = value;
172      return this;
173    }
174
175    /**
176     * @return {@link #dateRange} (The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.)
177     */
178    public Period getDateRange() { 
179      if (this.dateRange == null)
180        if (Configuration.errorOnAutoCreate())
181          throw new Error("Attempt to auto-create MarketingStatus.dateRange");
182        else if (Configuration.doAutoCreate())
183          this.dateRange = new Period(); // cc
184      return this.dateRange;
185    }
186
187    public boolean hasDateRange() { 
188      return this.dateRange != null && !this.dateRange.isEmpty();
189    }
190
191    /**
192     * @param value {@link #dateRange} (The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.)
193     */
194    public MarketingStatus setDateRange(Period value) { 
195      this.dateRange = value;
196      return this;
197    }
198
199    /**
200     * @return {@link #restoreDate} (The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.). This is the underlying object with id, value and extensions. The accessor "getRestoreDate" gives direct access to the value
201     */
202    public DateTimeType getRestoreDateElement() { 
203      if (this.restoreDate == null)
204        if (Configuration.errorOnAutoCreate())
205          throw new Error("Attempt to auto-create MarketingStatus.restoreDate");
206        else if (Configuration.doAutoCreate())
207          this.restoreDate = new DateTimeType(); // bb
208      return this.restoreDate;
209    }
210
211    public boolean hasRestoreDateElement() { 
212      return this.restoreDate != null && !this.restoreDate.isEmpty();
213    }
214
215    public boolean hasRestoreDate() { 
216      return this.restoreDate != null && !this.restoreDate.isEmpty();
217    }
218
219    /**
220     * @param value {@link #restoreDate} (The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.). This is the underlying object with id, value and extensions. The accessor "getRestoreDate" gives direct access to the value
221     */
222    public MarketingStatus setRestoreDateElement(DateTimeType value) { 
223      this.restoreDate = value;
224      return this;
225    }
226
227    /**
228     * @return The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.
229     */
230    public Date getRestoreDate() { 
231      return this.restoreDate == null ? null : this.restoreDate.getValue();
232    }
233
234    /**
235     * @param value The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.
236     */
237    public MarketingStatus setRestoreDate(Date value) { 
238      if (value == null)
239        this.restoreDate = null;
240      else {
241        if (this.restoreDate == null)
242          this.restoreDate = new DateTimeType();
243        this.restoreDate.setValue(value);
244      }
245      return this;
246    }
247
248      protected void listChildren(List<Property> children) {
249        super.listChildren(children);
250        children.add(new Property("country", "CodeableConcept", "The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements.", 0, 1, country));
251        children.add(new Property("jurisdiction", "CodeableConcept", "Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified.", 0, 1, jurisdiction));
252        children.add(new Property("status", "CodeableConcept", "This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples.", 0, 1, status));
253        children.add(new Property("dateRange", "Period", "The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.", 0, 1, dateRange));
254        children.add(new Property("restoreDate", "dateTime", "The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.", 0, 1, restoreDate));
255      }
256
257      @Override
258      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
259        switch (_hash) {
260        case 957831062: /*country*/  return new Property("country", "CodeableConcept", "The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements.", 0, 1, country);
261        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified.", 0, 1, jurisdiction);
262        case -892481550: /*status*/  return new Property("status", "CodeableConcept", "This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples.", 0, 1, status);
263        case -261425617: /*dateRange*/  return new Property("dateRange", "Period", "The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.", 0, 1, dateRange);
264        case 329465692: /*restoreDate*/  return new Property("restoreDate", "dateTime", "The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.", 0, 1, restoreDate);
265        default: return super.getNamedProperty(_hash, _name, _checkValid);
266        }
267
268      }
269
270      @Override
271      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
272        switch (hash) {
273        case 957831062: /*country*/ return this.country == null ? new Base[0] : new Base[] {this.country}; // CodeableConcept
274        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : new Base[] {this.jurisdiction}; // CodeableConcept
275        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
276        case -261425617: /*dateRange*/ return this.dateRange == null ? new Base[0] : new Base[] {this.dateRange}; // Period
277        case 329465692: /*restoreDate*/ return this.restoreDate == null ? new Base[0] : new Base[] {this.restoreDate}; // DateTimeType
278        default: return super.getProperty(hash, name, checkValid);
279        }
280
281      }
282
283      @Override
284      public Base setProperty(int hash, String name, Base value) throws FHIRException {
285        switch (hash) {
286        case 957831062: // country
287          this.country = castToCodeableConcept(value); // CodeableConcept
288          return value;
289        case -507075711: // jurisdiction
290          this.jurisdiction = castToCodeableConcept(value); // CodeableConcept
291          return value;
292        case -892481550: // status
293          this.status = castToCodeableConcept(value); // CodeableConcept
294          return value;
295        case -261425617: // dateRange
296          this.dateRange = castToPeriod(value); // Period
297          return value;
298        case 329465692: // restoreDate
299          this.restoreDate = castToDateTime(value); // DateTimeType
300          return value;
301        default: return super.setProperty(hash, name, value);
302        }
303
304      }
305
306      @Override
307      public Base setProperty(String name, Base value) throws FHIRException {
308        if (name.equals("country")) {
309          this.country = castToCodeableConcept(value); // CodeableConcept
310        } else if (name.equals("jurisdiction")) {
311          this.jurisdiction = castToCodeableConcept(value); // CodeableConcept
312        } else if (name.equals("status")) {
313          this.status = castToCodeableConcept(value); // CodeableConcept
314        } else if (name.equals("dateRange")) {
315          this.dateRange = castToPeriod(value); // Period
316        } else if (name.equals("restoreDate")) {
317          this.restoreDate = castToDateTime(value); // DateTimeType
318        } else
319          return super.setProperty(name, value);
320        return value;
321      }
322
323      @Override
324      public Base makeProperty(int hash, String name) throws FHIRException {
325        switch (hash) {
326        case 957831062:  return getCountry(); 
327        case -507075711:  return getJurisdiction(); 
328        case -892481550:  return getStatus(); 
329        case -261425617:  return getDateRange(); 
330        case 329465692:  return getRestoreDateElement();
331        default: return super.makeProperty(hash, name);
332        }
333
334      }
335
336      @Override
337      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
338        switch (hash) {
339        case 957831062: /*country*/ return new String[] {"CodeableConcept"};
340        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
341        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
342        case -261425617: /*dateRange*/ return new String[] {"Period"};
343        case 329465692: /*restoreDate*/ return new String[] {"dateTime"};
344        default: return super.getTypesForProperty(hash, name);
345        }
346
347      }
348
349      @Override
350      public Base addChild(String name) throws FHIRException {
351        if (name.equals("country")) {
352          this.country = new CodeableConcept();
353          return this.country;
354        }
355        else if (name.equals("jurisdiction")) {
356          this.jurisdiction = new CodeableConcept();
357          return this.jurisdiction;
358        }
359        else if (name.equals("status")) {
360          this.status = new CodeableConcept();
361          return this.status;
362        }
363        else if (name.equals("dateRange")) {
364          this.dateRange = new Period();
365          return this.dateRange;
366        }
367        else if (name.equals("restoreDate")) {
368          throw new FHIRException("Cannot call addChild on a primitive type MarketingStatus.restoreDate");
369        }
370        else
371          return super.addChild(name);
372      }
373
374  public String fhirType() {
375    return "MarketingStatus";
376
377  }
378
379      public MarketingStatus copy() {
380        MarketingStatus dst = new MarketingStatus();
381        copyValues(dst);
382        dst.country = country == null ? null : country.copy();
383        dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy();
384        dst.status = status == null ? null : status.copy();
385        dst.dateRange = dateRange == null ? null : dateRange.copy();
386        dst.restoreDate = restoreDate == null ? null : restoreDate.copy();
387        return dst;
388      }
389
390      protected MarketingStatus typedCopy() {
391        return copy();
392      }
393
394      @Override
395      public boolean equalsDeep(Base other_) {
396        if (!super.equalsDeep(other_))
397          return false;
398        if (!(other_ instanceof MarketingStatus))
399          return false;
400        MarketingStatus o = (MarketingStatus) other_;
401        return compareDeep(country, o.country, true) && compareDeep(jurisdiction, o.jurisdiction, true)
402           && compareDeep(status, o.status, true) && compareDeep(dateRange, o.dateRange, true) && compareDeep(restoreDate, o.restoreDate, true)
403          ;
404      }
405
406      @Override
407      public boolean equalsShallow(Base other_) {
408        if (!super.equalsShallow(other_))
409          return false;
410        if (!(other_ instanceof MarketingStatus))
411          return false;
412        MarketingStatus o = (MarketingStatus) other_;
413        return compareValues(restoreDate, o.restoreDate, true);
414      }
415
416      public boolean isEmpty() {
417        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(country, jurisdiction, status
418          , dateRange, restoreDate);
419      }
420
421
422}
423