text: import { setPropertiesFromJSON } from '../../json-helper';
  
  import SubstanceUse from './SubstanceUse';
  
  /**
   * Generated class for shr.behavior.NicotineUse.
   * @extends SubstanceUse
   */
  class NicotineUse extends SubstanceUse {
  
    /**
     * Get the entry information.
     * @returns {Entry} The shr.base.Entry
     */
    get entryInfo() {
      return this._entryInfo;
    }
  
    /**
     * Set the entry information.
     * @param {Entry} entryInfo - The shr.base.Entry
     */
    set entryInfo(entryInfo) {
      this._entryInfo = entryInfo;
    }
  
    /**
     * Set the entry information and return 'this' for chaining.
     * @param {Entry} entryInfo - The shr.base.Entry
     * @returns {NicotineUse} this.
     */
    withEntryInfo(entryInfo) {
      this.entryInfo = entryInfo; return this;
    }
  
    /**
     * Get the value (aliases codeableConcept).
     * @returns {CodeableConcept} The shr.core.CodeableConcept
     */
    get value() {
      return this._codeableConcept;
    }
  
    /**
     * Set the value (aliases codeableConcept).
     * This field/value is required.
     * @param {CodeableConcept} value - The shr.core.CodeableConcept
     */
    set value(value) {
      this._codeableConcept = value;
    }
  
    /**
     * Set the value (aliases codeableConcept) and return 'this' for chaining.
     * This field/value is required.
     * @param {CodeableConcept} value - The shr.core.CodeableConcept
     * @returns {NicotineUse} this.
     */
    withValue(value) {
      this.value = value; return this;
    }
  
    /**
     * Get the CodeableConcept.
     * @returns {CodeableConcept} The shr.core.CodeableConcept
     */
    get codeableConcept() {
      return this._codeableConcept;
    }
  
    /**
     * Set the CodeableConcept.
     * This field/value is required.
     * @param {CodeableConcept} codeableConcept - The shr.core.CodeableConcept
     */
    set codeableConcept(codeableConcept) {
      this._codeableConcept = codeableConcept;
    }
  
    /**
     * Set the CodeableConcept and return 'this' for chaining.
     * This field/value is required.
     * @param {CodeableConcept} codeableConcept - The shr.core.CodeableConcept
     * @returns {NicotineUse} this.
     */
    withCodeableConcept(codeableConcept) {
      this.codeableConcept = codeableConcept; return this;
    }
  
    /**
     * Deserializes JSON data to an instance of the NicotineUse class.
     * The JSON must be valid against the NicotineUse JSON schema, although this is not validated by the function.
     * @param {object} json - the JSON data to deserialize
     * @returns {NicotineUse} An instance of NicotineUse populated with the JSON data
     */
    static fromJSON(json={}) {
      const inst = new NicotineUse();
      setPropertiesFromJSON(inst, json);
      return inst;
    }
    /**
     * Serializes an instance of the NicotineUse class to a JSON object.
     * The JSON is expected to be valid against the NicotineUse JSON schema, but no validation checks are performed.
     * @returns {object} a JSON object populated with the data from the element
     */
    toJSON() {
      const inst = this._entryInfo.toJSON();
      inst['EntryType'] = { 'Value' : 'http://standardhealthrecord.org/spec/shr/behavior/NicotineUse' };
      if (this.value != null) {
        inst['Value'] = typeof this.value.toJSON === 'function' ? this.value.toJSON() : this.value;
      }
      if (this.relatedEncounter != null) {
        inst['RelatedEncounter'] = typeof this.relatedEncounter.toJSON === 'function' ? this.relatedEncounter.toJSON() : this.relatedEncounter;
      }
      if (this.author != null) {
        inst['Author'] = typeof this.author.toJSON === 'function' ? this.author.toJSON() : this.author;
      }
      if (this.informant != null) {
        inst['Informant'] = typeof this.informant.toJSON === 'function' ? this.informant.toJSON() : this.informant;
      }
      if (this.subject != null) {
        inst['Subject'] = typeof this.subject.toJSON === 'function' ? this.subject.toJSON() : this.subject;
      }
      if (this.focalSubject != null) {
        inst['FocalSubject'] = typeof this.focalSubject.toJSON === 'function' ? this.focalSubject.toJSON() : this.focalSubject;
      }
      if (this.focalSubjectReference != null) {
        inst['FocalSubjectReference'] = typeof this.focalSubjectReference.toJSON === 'function' ? this.focalSubjectReference.toJSON() : this.focalSubjectReference;
      }
      if (this.findingMethod != null) {
        inst['FindingMethod'] = typeof this.findingMethod.toJSON === 'function' ? this.findingMethod.toJSON() : this.findingMethod;
      }
      if (this.findingStatus != null) {
        inst['FindingStatus'] = typeof this.findingStatus.toJSON === 'function' ? this.findingStatus.toJSON() : this.findingStatus;
      }
      if (this.evidence != null) {
        inst['Evidence'] = this.evidence.map(f => f.toJSON());
      }
      if (this.valueAbsentReason != null) {
        inst['ValueAbsentReason'] = typeof this.valueAbsentReason.toJSON === 'function' ? this.valueAbsentReason.toJSON() : this.valueAbsentReason;
      }
      if (this.observationCode != null) {
        inst['ObservationCode'] = typeof this.observationCode.toJSON === 'function' ? this.observationCode.toJSON() : this.observationCode;
      }
      if (this.clinicallyRelevantTime != null) {
        inst['ClinicallyRelevantTime'] = typeof this.clinicallyRelevantTime.toJSON === 'function' ? this.clinicallyRelevantTime.toJSON() : this.clinicallyRelevantTime;
      }
      if (this.category != null) {
        inst['Category'] = this.category.map(f => f.toJSON());
      }
      if (this.bodySite != null) {
        inst['BodySite'] = typeof this.bodySite.toJSON === 'function' ? this.bodySite.toJSON() : this.bodySite;
      }
      if (this.changeFlag != null) {
        inst['ChangeFlag'] = typeof this.changeFlag.toJSON === 'function' ? this.changeFlag.toJSON() : this.changeFlag;
      }
      if (this.details != null) {
        inst['Details'] = typeof this.details.toJSON === 'function' ? this.details.toJSON() : this.details;
      }
      if (this.interpretation != null) {
        inst['Interpretation'] = typeof this.interpretation.toJSON === 'function' ? this.interpretation.toJSON() : this.interpretation;
      }
      if (this.observationQualifier != null) {
        inst['ObservationQualifier'] = this.observationQualifier.map(f => f.toJSON());
      }
      if (this.specimen != null) {
        inst['Specimen'] = typeof this.specimen.toJSON === 'function' ? this.specimen.toJSON() : this.specimen;
      }
      if (this.device != null) {
        inst['Device'] = typeof this.device.toJSON === 'function' ? this.device.toJSON() : this.device;
      }
      if (this.referenceRange != null) {
        inst['ReferenceRange'] = this.referenceRange.map(f => f.toJSON());
      }
      if (this.observationComponent != null) {
        inst['ObservationComponent'] = this.observationComponent.map(f => f.toJSON());
      }
      if (this.members != null) {
        inst['Members'] = typeof this.members.toJSON === 'function' ? this.members.toJSON() : this.members;
      }
      if (this.reasonForBehavior != null) {
        inst['ReasonForBehavior'] = this.reasonForBehavior.map(f => f.toJSON());
      }
      if (this.readinessToChange != null) {
        inst['ReadinessToChange'] = typeof this.readinessToChange.toJSON === 'function' ? this.readinessToChange.toJSON() : this.readinessToChange;
      }
      if (this.outcome != null) {
        inst['Outcome'] = this.outcome.map(f => f.toJSON());
      }
      return inst;
    }
  }
  export default NicotineUse;
  