001package org.hl7.fhir.r5.openehr;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.r5.openehr.Enumerations.*;
038import org.hl7.fhir.exceptions.FHIRException;
039import org.hl7.fhir.r5.model.*;
040import org.hl7.fhir.instance.model.api.ICompositeType;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.DatatypeDef;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046
047/**
048 * An identity owned by a Party, such as a person name or company name, and which is used by the Party to identify itself. Actual structure is archetyped.
049 */
050@DatatypeDef(name="PARTY_IDENTITY")
051public class PARTY_IDENTITY extends LOCATABLE implements ICompositeType {
052
053    /**
054     * The value of the identity. This will often taken the form of a parseable string or a small structure of strings.
055     */
056    @Child(name = "details", type = {ITEM_STRUCTURE.class}, order=0, min=0, max=1, modifier=false, summary=false)
057    @Description(shortDefinition="The value of the identity. This will often taken the form of a parseable string or a small structure of strings", formalDefinition="The value of the identity. This will often taken the form of a parseable string or a small structure of strings." )
058    protected ITEM_STRUCTURE details;
059
060    private static final long serialVersionUID = -713027011L;
061
062  /**
063   * Constructor
064   */
065    public PARTY_IDENTITY() {
066      super();
067    }
068
069    /**
070     * @return {@link #details} (The value of the identity. This will often taken the form of a parseable string or a small structure of strings.)
071     */
072    public ITEM_STRUCTURE getDetails() { 
073      return this.details;
074    }
075
076    public boolean hasDetails() { 
077      return this.details != null && !this.details.isEmpty();
078    }
079
080    /**
081     * @param value {@link #details} (The value of the identity. This will often taken the form of a parseable string or a small structure of strings.)
082     */
083    public PARTY_IDENTITY setDetails(ITEM_STRUCTURE value) { 
084      this.details = value;
085      return this;
086    }
087
088      protected void listChildren(List<Property> children) {
089        super.listChildren(children);
090        children.add(new Property("details", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "The value of the identity. This will often taken the form of a parseable string or a small structure of strings.", 0, 1, details));
091      }
092
093      @Override
094      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
095        switch (_hash) {
096        case 1557721666: /*details*/  return new Property("details", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "The value of the identity. This will often taken the form of a parseable string or a small structure of strings.", 0, 1, details);
097        default: return super.getNamedProperty(_hash, _name, _checkValid);
098        }
099
100      }
101
102      @Override
103      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
104        switch (hash) {
105        case 1557721666: /*details*/ return this.details == null ? new Base[0] : new Base[] {this.details}; // ITEM_STRUCTURE
106        default: return super.getProperty(hash, name, checkValid);
107        }
108
109      }
110
111      @Override
112      public Base setProperty(int hash, String name, Base value) throws FHIRException {
113        switch (hash) {
114        case 1557721666: // details
115          this.details = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE
116          return value;
117        default: return super.setProperty(hash, name, value);
118        }
119
120      }
121
122      @Override
123      public Base setProperty(String name, Base value) throws FHIRException {
124        if (name.equals("details")) {
125          this.details = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE
126        } else
127          return super.setProperty(name, value);
128        return value;
129      }
130
131      @Override
132      public Base makeProperty(int hash, String name) throws FHIRException {
133        switch (hash) {
134        case 1557721666: /*div*/
135          throw new Error("Unable to make an instance of the abstract property 'details'");
136        default: return super.makeProperty(hash, name);
137        }
138
139      }
140
141      @Override
142      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
143        switch (hash) {
144        case 1557721666: /*details*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE"};
145        default: return super.getTypesForProperty(hash, name);
146        }
147
148      }
149
150      @Override
151      public Base addChild(String name) throws FHIRException {
152        if (name.equals("details")) {
153          throw new FHIRException("Cannot call addChild on an abstract type PARTY_IDENTITY.details");
154        }
155        else
156          return super.addChild(name);
157      }
158
159  public String fhirType() {
160    return "PARTY_IDENTITY";
161
162  }
163
164      public PARTY_IDENTITY copy() {
165        PARTY_IDENTITY dst = new PARTY_IDENTITY();
166        copyValues(dst);
167        return dst;
168      }
169
170      public void copyValues(PARTY_IDENTITY dst) {
171        super.copyValues(dst);
172        dst.details = details == null ? null : details.copy();
173      }
174
175      protected PARTY_IDENTITY typedCopy() {
176        return copy();
177      }
178
179      @Override
180      public boolean equalsDeep(Base other_) {
181        if (!super.equalsDeep(other_))
182          return false;
183        if (!(other_ instanceof PARTY_IDENTITY))
184          return false;
185        PARTY_IDENTITY o = (PARTY_IDENTITY) other_;
186        return compareDeep(details, o.details, true);
187      }
188
189      @Override
190      public boolean equalsShallow(Base other_) {
191        if (!super.equalsShallow(other_))
192          return false;
193        if (!(other_ instanceof PARTY_IDENTITY))
194          return false;
195        PARTY_IDENTITY o = (PARTY_IDENTITY) other_;
196        return true;
197      }
198
199      public boolean isEmpty() {
200        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(details);
201      }
202
203
204}
205