All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hl7.fhir.r4.model.EnrollmentRequest Maven / Gradle / Ivy

The newest version!
package org.hl7.fhir.r4.model;

/*
  Copyright (c) 2011+, HL7, Inc.
  All rights reserved.
  
  Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:
  
   * Redistributions of source code must retain the above copyright notice, this 
     list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice, 
     this list of conditions and the following disclaimer in the documentation 
     and/or other materials provided with the distribution.
   * Neither the name of HL7 nor the names of its contributors may be used to 
     endorse or promote products derived from this software without specific 
     prior written permission.
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
  POSSIBILITY OF SUCH DAMAGE.
  
*/

// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.hl7.fhir.exceptions.FHIRException;

import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;

/**
 * This resource provides the insurance enrollment details to the insurer
 * regarding a specified coverage.
 */
@ResourceDef(name = "EnrollmentRequest", profile = "http://hl7.org/fhir/StructureDefinition/EnrollmentRequest")
public class EnrollmentRequest extends DomainResource {

  public enum EnrollmentRequestStatus {
    /**
     * The instance is currently in-force.
     */
    ACTIVE,
    /**
     * The instance is withdrawn, rescinded or reversed.
     */
    CANCELLED,
    /**
     * A new instance the contents of which is not complete.
     */
    DRAFT,
    /**
     * The instance was entered in error.
     */
    ENTEREDINERROR,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static EnrollmentRequestStatus fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("active".equals(codeString))
        return ACTIVE;
      if ("cancelled".equals(codeString))
        return CANCELLED;
      if ("draft".equals(codeString))
        return DRAFT;
      if ("entered-in-error".equals(codeString))
        return ENTEREDINERROR;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown EnrollmentRequestStatus code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case ACTIVE:
        return "active";
      case CANCELLED:
        return "cancelled";
      case DRAFT:
        return "draft";
      case ENTEREDINERROR:
        return "entered-in-error";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case ACTIVE:
        return "http://hl7.org/fhir/fm-status";
      case CANCELLED:
        return "http://hl7.org/fhir/fm-status";
      case DRAFT:
        return "http://hl7.org/fhir/fm-status";
      case ENTEREDINERROR:
        return "http://hl7.org/fhir/fm-status";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case ACTIVE:
        return "The instance is currently in-force.";
      case CANCELLED:
        return "The instance is withdrawn, rescinded or reversed.";
      case DRAFT:
        return "A new instance the contents of which is not complete.";
      case ENTEREDINERROR:
        return "The instance was entered in error.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case ACTIVE:
        return "Active";
      case CANCELLED:
        return "Cancelled";
      case DRAFT:
        return "Draft";
      case ENTEREDINERROR:
        return "Entered in Error";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class EnrollmentRequestStatusEnumFactory implements EnumFactory {
    public EnrollmentRequestStatus fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("active".equals(codeString))
        return EnrollmentRequestStatus.ACTIVE;
      if ("cancelled".equals(codeString))
        return EnrollmentRequestStatus.CANCELLED;
      if ("draft".equals(codeString))
        return EnrollmentRequestStatus.DRAFT;
      if ("entered-in-error".equals(codeString))
        return EnrollmentRequestStatus.ENTEREDINERROR;
      throw new IllegalArgumentException("Unknown EnrollmentRequestStatus code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, EnrollmentRequestStatus.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, EnrollmentRequestStatus.NULL, code);
      if ("active".equals(codeString))
        return new Enumeration(this, EnrollmentRequestStatus.ACTIVE, code);
      if ("cancelled".equals(codeString))
        return new Enumeration(this, EnrollmentRequestStatus.CANCELLED, code);
      if ("draft".equals(codeString))
        return new Enumeration(this, EnrollmentRequestStatus.DRAFT, code);
      if ("entered-in-error".equals(codeString))
        return new Enumeration(this, EnrollmentRequestStatus.ENTEREDINERROR, code);
      throw new FHIRException("Unknown EnrollmentRequestStatus code '" + codeString + "'");
    }

    public String toCode(EnrollmentRequestStatus code) {
       if (code == EnrollmentRequestStatus.NULL)
           return null;
       if (code == EnrollmentRequestStatus.ACTIVE)
        return "active";
      if (code == EnrollmentRequestStatus.CANCELLED)
        return "cancelled";
      if (code == EnrollmentRequestStatus.DRAFT)
        return "draft";
      if (code == EnrollmentRequestStatus.ENTEREDINERROR)
        return "entered-in-error";
      return "?";
   }

    public String toSystem(EnrollmentRequestStatus code) {
      return code.getSystem();
    }
  }

  /**
   * The Response business identifier.
   */
  @Child(name = "identifier", type = {
      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Business Identifier", formalDefinition = "The Response business identifier.")
  protected List identifier;

  /**
   * The status of the resource instance.
   */
  @Child(name = "status", type = { CodeType.class }, order = 1, min = 0, max = 1, modifier = true, summary = true)
  @Description(shortDefinition = "active | cancelled | draft | entered-in-error", formalDefinition = "The status of the resource instance.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fm-status")
  protected Enumeration status;

  /**
   * The date when this resource was created.
   */
  @Child(name = "created", type = {
      DateTimeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "Creation date", formalDefinition = "The date when this resource was created.")
  protected DateTimeType created;

  /**
   * The Insurer who is target of the request.
   */
  @Child(name = "insurer", type = {
      Organization.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "Target", formalDefinition = "The Insurer who is target  of the request.")
  protected Reference insurer;

  /**
   * The actual object that is the target of the reference (The Insurer who is
   * target of the request.)
   */
  protected Organization insurerTarget;

  /**
   * The practitioner who is responsible for the services rendered to the patient.
   */
  @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
      Organization.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "Responsible practitioner", formalDefinition = "The practitioner who is responsible for the services rendered to the patient.")
  protected Reference provider;

  /**
   * The actual object that is the target of the reference (The practitioner who
   * is responsible for the services rendered to the patient.)
   */
  protected Resource providerTarget;

  /**
   * Patient Resource.
   */
  @Child(name = "candidate", type = { Patient.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "The subject to be enrolled", formalDefinition = "Patient Resource.")
  protected Reference candidate;

  /**
   * The actual object that is the target of the reference (Patient Resource.)
   */
  protected Patient candidateTarget;

  /**
   * Reference to the program or plan identification, underwriter or payor.
   */
  @Child(name = "coverage", type = { Coverage.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "Insurance information", formalDefinition = "Reference to the program or plan identification, underwriter or payor.")
  protected Reference coverage;

  /**
   * The actual object that is the target of the reference (Reference to the
   * program or plan identification, underwriter or payor.)
   */
  protected Coverage coverageTarget;

  private static final long serialVersionUID = 631501951L;

  /**
   * Constructor
   */
  public EnrollmentRequest() {
    super();
  }

  /**
   * @return {@link #identifier} (The Response business identifier.)
   */
  public List getIdentifier() {
    if (this.identifier == null)
      this.identifier = new ArrayList();
    return this.identifier;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public EnrollmentRequest setIdentifier(List theIdentifier) {
    this.identifier = theIdentifier;
    return this;
  }

  public boolean hasIdentifier() {
    if (this.identifier == null)
      return false;
    for (Identifier item : this.identifier)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Identifier addIdentifier() { // 3
    Identifier t = new Identifier();
    if (this.identifier == null)
      this.identifier = new ArrayList();
    this.identifier.add(t);
    return t;
  }

  public EnrollmentRequest addIdentifier(Identifier t) { // 3
    if (t == null)
      return this;
    if (this.identifier == null)
      this.identifier = new ArrayList();
    this.identifier.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #identifier}, creating
   *         it if it does not already exist
   */
  public Identifier getIdentifierFirstRep() {
    if (getIdentifier().isEmpty()) {
      addIdentifier();
    }
    return getIdentifier().get(0);
  }

  /**
   * @return {@link #status} (The status of the resource instance.). This is the
   *         underlying object with id, value and extensions. The accessor
   *         "getStatus" gives direct access to the value
   */
  public Enumeration getStatusElement() {
    if (this.status == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create EnrollmentRequest.status");
      else if (Configuration.doAutoCreate())
        this.status = new Enumeration(new EnrollmentRequestStatusEnumFactory()); // bb
    return this.status;
  }

  public boolean hasStatusElement() {
    return this.status != null && !this.status.isEmpty();
  }

  public boolean hasStatus() {
    return this.status != null && !this.status.isEmpty();
  }

  /**
   * @param value {@link #status} (The status of the resource instance.). This is
   *              the underlying object with id, value and extensions. The
   *              accessor "getStatus" gives direct access to the value
   */
  public EnrollmentRequest setStatusElement(Enumeration value) {
    this.status = value;
    return this;
  }

  /**
   * @return The status of the resource instance.
   */
  public EnrollmentRequestStatus getStatus() {
    return this.status == null ? null : this.status.getValue();
  }

  /**
   * @param value The status of the resource instance.
   */
  public EnrollmentRequest setStatus(EnrollmentRequestStatus value) {
    if (value == null)
      this.status = null;
    else {
      if (this.status == null)
        this.status = new Enumeration(new EnrollmentRequestStatusEnumFactory());
      this.status.setValue(value);
    }
    return this;
  }

  /**
   * @return {@link #created} (The date when this resource was created.). This is
   *         the underlying object with id, value and extensions. The accessor
   *         "getCreated" gives direct access to the value
   */
  public DateTimeType getCreatedElement() {
    if (this.created == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create EnrollmentRequest.created");
      else if (Configuration.doAutoCreate())
        this.created = new DateTimeType(); // bb
    return this.created;
  }

  public boolean hasCreatedElement() {
    return this.created != null && !this.created.isEmpty();
  }

  public boolean hasCreated() {
    return this.created != null && !this.created.isEmpty();
  }

  /**
   * @param value {@link #created} (The date when this resource was created.).
   *              This is the underlying object with id, value and extensions. The
   *              accessor "getCreated" gives direct access to the value
   */
  public EnrollmentRequest setCreatedElement(DateTimeType value) {
    this.created = value;
    return this;
  }

  /**
   * @return The date when this resource was created.
   */
  public Date getCreated() {
    return this.created == null ? null : this.created.getValue();
  }

  /**
   * @param value The date when this resource was created.
   */
  public EnrollmentRequest setCreated(Date value) {
    if (value == null)
      this.created = null;
    else {
      if (this.created == null)
        this.created = new DateTimeType();
      this.created.setValue(value);
    }
    return this;
  }

  /**
   * @return {@link #insurer} (The Insurer who is target of the request.)
   */
  public Reference getInsurer() {
    if (this.insurer == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create EnrollmentRequest.insurer");
      else if (Configuration.doAutoCreate())
        this.insurer = new Reference(); // cc
    return this.insurer;
  }

  public boolean hasInsurer() {
    return this.insurer != null && !this.insurer.isEmpty();
  }

  /**
   * @param value {@link #insurer} (The Insurer who is target of the request.)
   */
  public EnrollmentRequest setInsurer(Reference value) {
    this.insurer = value;
    return this;
  }

  /**
   * @return {@link #insurer} 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 Insurer who is
   *         target of the request.)
   */
  public Organization getInsurerTarget() {
    if (this.insurerTarget == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create EnrollmentRequest.insurer");
      else if (Configuration.doAutoCreate())
        this.insurerTarget = new Organization(); // aa
    return this.insurerTarget;
  }

  /**
   * @param value {@link #insurer} 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 Insurer who
   *              is target of the request.)
   */
  public EnrollmentRequest setInsurerTarget(Organization value) {
    this.insurerTarget = value;
    return this;
  }

  /**
   * @return {@link #provider} (The practitioner who is responsible for the
   *         services rendered to the patient.)
   */
  public Reference getProvider() {
    if (this.provider == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create EnrollmentRequest.provider");
      else if (Configuration.doAutoCreate())
        this.provider = new Reference(); // cc
    return this.provider;
  }

  public boolean hasProvider() {
    return this.provider != null && !this.provider.isEmpty();
  }

  /**
   * @param value {@link #provider} (The practitioner who is responsible for the
   *              services rendered to the patient.)
   */
  public EnrollmentRequest setProvider(Reference value) {
    this.provider = value;
    return this;
  }

  /**
   * @return {@link #provider} 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 practitioner who
   *         is responsible for the services rendered to the patient.)
   */
  public Resource getProviderTarget() {
    return this.providerTarget;
  }

  /**
   * @param value {@link #provider} 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 practitioner
   *              who is responsible for the services rendered to the patient.)
   */
  public EnrollmentRequest setProviderTarget(Resource value) {
    this.providerTarget = value;
    return this;
  }

  /**
   * @return {@link #candidate} (Patient Resource.)
   */
  public Reference getCandidate() {
    if (this.candidate == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create EnrollmentRequest.candidate");
      else if (Configuration.doAutoCreate())
        this.candidate = new Reference(); // cc
    return this.candidate;
  }

  public boolean hasCandidate() {
    return this.candidate != null && !this.candidate.isEmpty();
  }

  /**
   * @param value {@link #candidate} (Patient Resource.)
   */
  public EnrollmentRequest setCandidate(Reference value) {
    this.candidate = value;
    return this;
  }

  /**
   * @return {@link #candidate} 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. (Patient Resource.)
   */
  public Patient getCandidateTarget() {
    if (this.candidateTarget == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create EnrollmentRequest.candidate");
      else if (Configuration.doAutoCreate())
        this.candidateTarget = new Patient(); // aa
    return this.candidateTarget;
  }

  /**
   * @param value {@link #candidate} 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. (Patient
   *              Resource.)
   */
  public EnrollmentRequest setCandidateTarget(Patient value) {
    this.candidateTarget = value;
    return this;
  }

  /**
   * @return {@link #coverage} (Reference to the program or plan identification,
   *         underwriter or payor.)
   */
  public Reference getCoverage() {
    if (this.coverage == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create EnrollmentRequest.coverage");
      else if (Configuration.doAutoCreate())
        this.coverage = new Reference(); // cc
    return this.coverage;
  }

  public boolean hasCoverage() {
    return this.coverage != null && !this.coverage.isEmpty();
  }

  /**
   * @param value {@link #coverage} (Reference to the program or plan
   *              identification, underwriter or payor.)
   */
  public EnrollmentRequest setCoverage(Reference value) {
    this.coverage = value;
    return this;
  }

  /**
   * @return {@link #coverage} 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. (Reference to the
   *         program or plan identification, underwriter or payor.)
   */
  public Coverage getCoverageTarget() {
    if (this.coverageTarget == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create EnrollmentRequest.coverage");
      else if (Configuration.doAutoCreate())
        this.coverageTarget = new Coverage(); // aa
    return this.coverageTarget;
  }

  /**
   * @param value {@link #coverage} 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. (Reference to the
   *              program or plan identification, underwriter or payor.)
   */
  public EnrollmentRequest setCoverageTarget(Coverage value) {
    this.coverageTarget = value;
    return this;
  }

  protected void listChildren(List children) {
    super.listChildren(children);
    children.add(new Property("identifier", "Identifier", "The Response business identifier.", 0,
        java.lang.Integer.MAX_VALUE, identifier));
    children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
    children.add(new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created));
    children.add(new Property("insurer", "Reference(Organization)", "The Insurer who is target  of the request.", 0, 1,
        insurer));
    children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
        "The practitioner who is responsible for the services rendered to the patient.", 0, 1, provider));
    children.add(new Property("candidate", "Reference(Patient)", "Patient Resource.", 0, 1, candidate));
    children.add(new Property("coverage", "Reference(Coverage)",
        "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage));
  }

  @Override
  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
    switch (_hash) {
    case -1618432855:
      /* identifier */ return new Property("identifier", "Identifier", "The Response business identifier.", 0,
          java.lang.Integer.MAX_VALUE, identifier);
    case -892481550:
      /* status */ return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
    case 1028554472:
      /* created */ return new Property("created", "dateTime", "The date when this resource was created.", 0, 1,
          created);
    case 1957615864:
      /* insurer */ return new Property("insurer", "Reference(Organization)",
          "The Insurer who is target  of the request.", 0, 1, insurer);
    case -987494927:
      /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
          "The practitioner who is responsible for the services rendered to the patient.", 0, 1, provider);
    case 508663171:
      /* candidate */ return new Property("candidate", "Reference(Patient)", "Patient Resource.", 0, 1, candidate);
    case -351767064:
      /* coverage */ return new Property("coverage", "Reference(Coverage)",
          "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage);
    default:
      return super.getNamedProperty(_hash, _name, _checkValid);
    }

  }

  @Override
  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
    switch (hash) {
    case -1618432855:
      /* identifier */ return this.identifier == null ? new Base[0]
          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
    case -892481550:
      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration
    case 1028554472:
      /* created */ return this.created == null ? new Base[0] : new Base[] { this.created }; // DateTimeType
    case 1957615864:
      /* insurer */ return this.insurer == null ? new Base[0] : new Base[] { this.insurer }; // Reference
    case -987494927:
      /* provider */ return this.provider == null ? new Base[0] : new Base[] { this.provider }; // Reference
    case 508663171:
      /* candidate */ return this.candidate == null ? new Base[0] : new Base[] { this.candidate }; // Reference
    case -351767064:
      /* coverage */ return this.coverage == null ? new Base[0] : new Base[] { this.coverage }; // Reference
    default:
      return super.getProperty(hash, name, checkValid);
    }

  }

  @Override
  public Base setProperty(int hash, String name, Base value) throws FHIRException {
    switch (hash) {
    case -1618432855: // identifier
      this.getIdentifier().add(castToIdentifier(value)); // Identifier
      return value;
    case -892481550: // status
      value = new EnrollmentRequestStatusEnumFactory().fromType(castToCode(value));
      this.status = (Enumeration) value; // Enumeration
      return value;
    case 1028554472: // created
      this.created = castToDateTime(value); // DateTimeType
      return value;
    case 1957615864: // insurer
      this.insurer = castToReference(value); // Reference
      return value;
    case -987494927: // provider
      this.provider = castToReference(value); // Reference
      return value;
    case 508663171: // candidate
      this.candidate = castToReference(value); // Reference
      return value;
    case -351767064: // coverage
      this.coverage = castToReference(value); // Reference
      return value;
    default:
      return super.setProperty(hash, name, value);
    }

  }

  @Override
  public Base setProperty(String name, Base value) throws FHIRException {
    if (name.equals("identifier")) {
      this.getIdentifier().add(castToIdentifier(value));
    } else if (name.equals("status")) {
      value = new EnrollmentRequestStatusEnumFactory().fromType(castToCode(value));
      this.status = (Enumeration) value; // Enumeration
    } else if (name.equals("created")) {
      this.created = castToDateTime(value); // DateTimeType
    } else if (name.equals("insurer")) {
      this.insurer = castToReference(value); // Reference
    } else if (name.equals("provider")) {
      this.provider = castToReference(value); // Reference
    } else if (name.equals("candidate")) {
      this.candidate = castToReference(value); // Reference
    } else if (name.equals("coverage")) {
      this.coverage = castToReference(value); // Reference
    } else
      return super.setProperty(name, value);
    return value;
  }

  @Override
  public void removeChild(String name, Base value) throws FHIRException {
    if (name.equals("identifier")) {
      this.getIdentifier().remove(castToIdentifier(value));
    } else if (name.equals("status")) {
      this.status = null;
    } else if (name.equals("created")) {
      this.created = null;
    } else if (name.equals("insurer")) {
      this.insurer = null;
    } else if (name.equals("provider")) {
      this.provider = null;
    } else if (name.equals("candidate")) {
      this.candidate = null;
    } else if (name.equals("coverage")) {
      this.coverage = null;
    } else
      super.removeChild(name, value);
    
  }

  @Override
  public Base makeProperty(int hash, String name) throws FHIRException {
    switch (hash) {
    case -1618432855:
      return addIdentifier();
    case -892481550:
      return getStatusElement();
    case 1028554472:
      return getCreatedElement();
    case 1957615864:
      return getInsurer();
    case -987494927:
      return getProvider();
    case 508663171:
      return getCandidate();
    case -351767064:
      return getCoverage();
    default:
      return super.makeProperty(hash, name);
    }

  }

  @Override
  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
    switch (hash) {
    case -1618432855:
      /* identifier */ return new String[] { "Identifier" };
    case -892481550:
      /* status */ return new String[] { "code" };
    case 1028554472:
      /* created */ return new String[] { "dateTime" };
    case 1957615864:
      /* insurer */ return new String[] { "Reference" };
    case -987494927:
      /* provider */ return new String[] { "Reference" };
    case 508663171:
      /* candidate */ return new String[] { "Reference" };
    case -351767064:
      /* coverage */ return new String[] { "Reference" };
    default:
      return super.getTypesForProperty(hash, name);
    }

  }

  @Override
  public Base addChild(String name) throws FHIRException {
    if (name.equals("identifier")) {
      return addIdentifier();
    } else if (name.equals("status")) {
      throw new FHIRException("Cannot call addChild on a singleton property EnrollmentRequest.status");
    } else if (name.equals("created")) {
      throw new FHIRException("Cannot call addChild on a singleton property EnrollmentRequest.created");
    } else if (name.equals("insurer")) {
      this.insurer = new Reference();
      return this.insurer;
    } else if (name.equals("provider")) {
      this.provider = new Reference();
      return this.provider;
    } else if (name.equals("candidate")) {
      this.candidate = new Reference();
      return this.candidate;
    } else if (name.equals("coverage")) {
      this.coverage = new Reference();
      return this.coverage;
    } else
      return super.addChild(name);
  }

  public String fhirType() {
    return "EnrollmentRequest";

  }

  public EnrollmentRequest copy() {
    EnrollmentRequest dst = new EnrollmentRequest();
    copyValues(dst);
    return dst;
  }

  public void copyValues(EnrollmentRequest dst) {
    super.copyValues(dst);
    if (identifier != null) {
      dst.identifier = new ArrayList();
      for (Identifier i : identifier)
        dst.identifier.add(i.copy());
    }
    ;
    dst.status = status == null ? null : status.copy();
    dst.created = created == null ? null : created.copy();
    dst.insurer = insurer == null ? null : insurer.copy();
    dst.provider = provider == null ? null : provider.copy();
    dst.candidate = candidate == null ? null : candidate.copy();
    dst.coverage = coverage == null ? null : coverage.copy();
  }

  protected EnrollmentRequest typedCopy() {
    return copy();
  }

  @Override
  public boolean equalsDeep(Base other_) {
    if (!super.equalsDeep(other_))
      return false;
    if (!(other_ instanceof EnrollmentRequest))
      return false;
    EnrollmentRequest o = (EnrollmentRequest) other_;
    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
        && compareDeep(created, o.created, true) && compareDeep(insurer, o.insurer, true)
        && compareDeep(provider, o.provider, true) && compareDeep(candidate, o.candidate, true)
        && compareDeep(coverage, o.coverage, true);
  }

  @Override
  public boolean equalsShallow(Base other_) {
    if (!super.equalsShallow(other_))
      return false;
    if (!(other_ instanceof EnrollmentRequest))
      return false;
    EnrollmentRequest o = (EnrollmentRequest) other_;
    return compareValues(status, o.status, true) && compareValues(created, o.created, true);
  }

  public boolean isEmpty() {
    return super.isEmpty()
        && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, created, insurer, provider, candidate, coverage);
  }

  @Override
  public ResourceType getResourceType() {
    return ResourceType.EnrollmentRequest;
  }

  /**
   * Search parameter: identifier
   * 

* Description: The business identifier of the Enrollment
* Type: token
* Path: EnrollmentRequest.identifier
*

*/ @SearchParamDefinition(name = "identifier", path = "EnrollmentRequest.identifier", description = "The business identifier of the Enrollment", type = "token") public static final String SP_IDENTIFIER = "identifier"; /** * Fluent Client search parameter constant for identifier *

* Description: The business identifier of the Enrollment
* Type: token
* Path: EnrollmentRequest.identifier
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_IDENTIFIER); /** * Search parameter: subject *

* Description: The party to be enrolled
* Type: reference
* Path: EnrollmentRequest.candidate
*

*/ @SearchParamDefinition(name = "subject", path = "EnrollmentRequest.candidate", description = "The party to be enrolled", type = "reference", providesMembershipIn = { @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class }) public static final String SP_SUBJECT = "subject"; /** * Fluent Client search parameter constant for subject *

* Description: The party to be enrolled
* Type: reference
* Path: EnrollmentRequest.candidate
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_SUBJECT); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "EnrollmentRequest:subject". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include( "EnrollmentRequest:subject").toLocked(); /** * Search parameter: patient *

* Description: The party to be enrolled
* Type: reference
* Path: EnrollmentRequest.candidate
*

*/ @SearchParamDefinition(name = "patient", path = "EnrollmentRequest.candidate", description = "The party to be enrolled", type = "reference", target = { Patient.class }) public static final String SP_PATIENT = "patient"; /** * Fluent Client search parameter constant for patient *

* Description: The party to be enrolled
* Type: reference
* Path: EnrollmentRequest.candidate
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_PATIENT); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "EnrollmentRequest:patient". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include( "EnrollmentRequest:patient").toLocked(); /** * Search parameter: status *

* Description: The status of the enrollment
* Type: token
* Path: EnrollmentRequest.status
*

*/ @SearchParamDefinition(name = "status", path = "EnrollmentRequest.status", description = "The status of the enrollment", type = "token") public static final String SP_STATUS = "status"; /** * Fluent Client search parameter constant for status *

* Description: The status of the enrollment
* Type: token
* Path: EnrollmentRequest.status
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_STATUS); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy