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, Dec 27, 2018 10:06-0500 for FHIR v4.0.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.r4.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046/**
047 * Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.
048 */
049@ResourceDef(name="RelatedPerson", profile="http://hl7.org/fhir/StructureDefinition/RelatedPerson")
050public class RelatedPerson extends DomainResource {
051
052    @Block()
053    public static class RelatedPersonCommunicationComponent extends BackboneElement implements IBaseBackboneElement {
054        /**
055         * The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.
056         */
057        @Child(name = "language", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
058        @Description(shortDefinition="The language which can be used to communicate with the patient about his or her health", formalDefinition="The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English." )
059        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
060        protected CodeableConcept language;
061
062        /**
063         * Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).
064         */
065        @Child(name = "preferred", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
066        @Description(shortDefinition="Language preference indicator", formalDefinition="Indicates whether or not the patient prefers this language (over other languages he masters up a certain level)." )
067        protected BooleanType preferred;
068
069        private static final long serialVersionUID = 633792918L;
070
071    /**
072     * Constructor
073     */
074      public RelatedPersonCommunicationComponent() {
075        super();
076      }
077
078    /**
079     * Constructor
080     */
081      public RelatedPersonCommunicationComponent(CodeableConcept language) {
082        super();
083        this.language = language;
084      }
085
086        /**
087         * @return {@link #language} (The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.)
088         */
089        public CodeableConcept getLanguage() { 
090          if (this.language == null)
091            if (Configuration.errorOnAutoCreate())
092              throw new Error("Attempt to auto-create RelatedPersonCommunicationComponent.language");
093            else if (Configuration.doAutoCreate())
094              this.language = new CodeableConcept(); // cc
095          return this.language;
096        }
097
098        public boolean hasLanguage() { 
099          return this.language != null && !this.language.isEmpty();
100        }
101
102        /**
103         * @param value {@link #language} (The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.)
104         */
105        public RelatedPersonCommunicationComponent setLanguage(CodeableConcept value) { 
106          this.language = value;
107          return this;
108        }
109
110        /**
111         * @return {@link #preferred} (Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).). This is the underlying object with id, value and extensions. The accessor "getPreferred" gives direct access to the value
112         */
113        public BooleanType getPreferredElement() { 
114          if (this.preferred == null)
115            if (Configuration.errorOnAutoCreate())
116              throw new Error("Attempt to auto-create RelatedPersonCommunicationComponent.preferred");
117            else if (Configuration.doAutoCreate())
118              this.preferred = new BooleanType(); // bb
119          return this.preferred;
120        }
121
122        public boolean hasPreferredElement() { 
123          return this.preferred != null && !this.preferred.isEmpty();
124        }
125
126        public boolean hasPreferred() { 
127          return this.preferred != null && !this.preferred.isEmpty();
128        }
129
130        /**
131         * @param value {@link #preferred} (Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).). This is the underlying object with id, value and extensions. The accessor "getPreferred" gives direct access to the value
132         */
133        public RelatedPersonCommunicationComponent setPreferredElement(BooleanType value) { 
134          this.preferred = value;
135          return this;
136        }
137
138        /**
139         * @return Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).
140         */
141        public boolean getPreferred() { 
142          return this.preferred == null || this.preferred.isEmpty() ? false : this.preferred.getValue();
143        }
144
145        /**
146         * @param value Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).
147         */
148        public RelatedPersonCommunicationComponent setPreferred(boolean value) { 
149            if (this.preferred == null)
150              this.preferred = new BooleanType();
151            this.preferred.setValue(value);
152          return this;
153        }
154
155        protected void listChildren(List<Property> children) {
156          super.listChildren(children);
157          children.add(new Property("language", "CodeableConcept", "The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English.", 0, 1, language));
158          children.add(new Property("preferred", "boolean", "Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).", 0, 1, preferred));
159        }
160
161        @Override
162        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
163          switch (_hash) {
164          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English.", 0, 1, language);
165          case -1294005119: /*preferred*/  return new Property("preferred", "boolean", "Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).", 0, 1, preferred);
166          default: return super.getNamedProperty(_hash, _name, _checkValid);
167          }
168
169        }
170
171      @Override
172      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
173        switch (hash) {
174        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
175        case -1294005119: /*preferred*/ return this.preferred == null ? new Base[0] : new Base[] {this.preferred}; // BooleanType
176        default: return super.getProperty(hash, name, checkValid);
177        }
178
179      }
180
181      @Override
182      public Base setProperty(int hash, String name, Base value) throws FHIRException {
183        switch (hash) {
184        case -1613589672: // language
185          this.language = castToCodeableConcept(value); // CodeableConcept
186          return value;
187        case -1294005119: // preferred
188          this.preferred = castToBoolean(value); // BooleanType
189          return value;
190        default: return super.setProperty(hash, name, value);
191        }
192
193      }
194
195      @Override
196      public Base setProperty(String name, Base value) throws FHIRException {
197        if (name.equals("language")) {
198          this.language = castToCodeableConcept(value); // CodeableConcept
199        } else if (name.equals("preferred")) {
200          this.preferred = castToBoolean(value); // BooleanType
201        } else
202          return super.setProperty(name, value);
203        return value;
204      }
205
206      @Override
207      public Base makeProperty(int hash, String name) throws FHIRException {
208        switch (hash) {
209        case -1613589672:  return getLanguage(); 
210        case -1294005119:  return getPreferredElement();
211        default: return super.makeProperty(hash, name);
212        }
213
214      }
215
216      @Override
217      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
218        switch (hash) {
219        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
220        case -1294005119: /*preferred*/ return new String[] {"boolean"};
221        default: return super.getTypesForProperty(hash, name);
222        }
223
224      }
225
226      @Override
227      public Base addChild(String name) throws FHIRException {
228        if (name.equals("language")) {
229          this.language = new CodeableConcept();
230          return this.language;
231        }
232        else if (name.equals("preferred")) {
233          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.preferred");
234        }
235        else
236          return super.addChild(name);
237      }
238
239      public RelatedPersonCommunicationComponent copy() {
240        RelatedPersonCommunicationComponent dst = new RelatedPersonCommunicationComponent();
241        copyValues(dst);
242        dst.language = language == null ? null : language.copy();
243        dst.preferred = preferred == null ? null : preferred.copy();
244        return dst;
245      }
246
247      @Override
248      public boolean equalsDeep(Base other_) {
249        if (!super.equalsDeep(other_))
250          return false;
251        if (!(other_ instanceof RelatedPersonCommunicationComponent))
252          return false;
253        RelatedPersonCommunicationComponent o = (RelatedPersonCommunicationComponent) other_;
254        return compareDeep(language, o.language, true) && compareDeep(preferred, o.preferred, true);
255      }
256
257      @Override
258      public boolean equalsShallow(Base other_) {
259        if (!super.equalsShallow(other_))
260          return false;
261        if (!(other_ instanceof RelatedPersonCommunicationComponent))
262          return false;
263        RelatedPersonCommunicationComponent o = (RelatedPersonCommunicationComponent) other_;
264        return compareValues(preferred, o.preferred, true);
265      }
266
267      public boolean isEmpty() {
268        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(language, preferred);
269      }
270
271  public String fhirType() {
272    return "RelatedPerson.communication";
273
274  }
275
276  }
277
278    /**
279     * Identifier for a person within a particular scope.
280     */
281    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
282    @Description(shortDefinition="A human identifier for this person", formalDefinition="Identifier for a person within a particular scope." )
283    protected List<Identifier> identifier;
284
285    /**
286     * Whether this related person record is in active use.
287     */
288    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
289    @Description(shortDefinition="Whether this related person's record is in active use", formalDefinition="Whether this related person record is in active use." )
290    protected BooleanType active;
291
292    /**
293     * The patient this person is related to.
294     */
295    @Child(name = "patient", type = {Patient.class}, order=2, min=1, max=1, modifier=false, summary=true)
296    @Description(shortDefinition="The patient this person is related to", formalDefinition="The patient this person is related to." )
297    protected Reference patient;
298
299    /**
300     * The actual object that is the target of the reference (The patient this person is related to.)
301     */
302    protected Patient patientTarget;
303
304    /**
305     * The nature of the relationship between a patient and the related person.
306     */
307    @Child(name = "relationship", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
308    @Description(shortDefinition="The nature of the relationship", formalDefinition="The nature of the relationship between a patient and the related person." )
309    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/relatedperson-relationshiptype")
310    protected List<CodeableConcept> relationship;
311
312    /**
313     * A name associated with the person.
314     */
315    @Child(name = "name", type = {HumanName.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
316    @Description(shortDefinition="A name associated with the person", formalDefinition="A name associated with the person." )
317    protected List<HumanName> name;
318
319    /**
320     * A contact detail for the person, e.g. a telephone number or an email address.
321     */
322    @Child(name = "telecom", type = {ContactPoint.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
323    @Description(shortDefinition="A contact detail for the person", formalDefinition="A contact detail for the person, e.g. a telephone number or an email address." )
324    protected List<ContactPoint> telecom;
325
326    /**
327     * Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
328     */
329    @Child(name = "gender", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
330    @Description(shortDefinition="male | female | other | unknown", formalDefinition="Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes." )
331    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/administrative-gender")
332    protected Enumeration<AdministrativeGender> gender;
333
334    /**
335     * The date on which the related person was born.
336     */
337    @Child(name = "birthDate", type = {DateType.class}, order=7, min=0, max=1, modifier=false, summary=true)
338    @Description(shortDefinition="The date on which the related person was born", formalDefinition="The date on which the related person was born." )
339    protected DateType birthDate;
340
341    /**
342     * Address where the related person can be contacted or visited.
343     */
344    @Child(name = "address", type = {Address.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
345    @Description(shortDefinition="Address where the related person can be contacted or visited", formalDefinition="Address where the related person can be contacted or visited." )
346    protected List<Address> address;
347
348    /**
349     * Image of the person.
350     */
351    @Child(name = "photo", type = {Attachment.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
352    @Description(shortDefinition="Image of the person", formalDefinition="Image of the person." )
353    protected List<Attachment> photo;
354
355    /**
356     * The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown.
357     */
358    @Child(name = "period", type = {Period.class}, order=10, min=0, max=1, modifier=false, summary=false)
359    @Description(shortDefinition="Period of time that this relationship is considered valid", formalDefinition="The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown." )
360    protected Period period;
361
362    /**
363     * A language which may be used to communicate with about the patient's health.
364     */
365    @Child(name = "communication", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
366    @Description(shortDefinition="A language which may be used to communicate with about the patient's health", formalDefinition="A language which may be used to communicate with about the patient's health." )
367    protected List<RelatedPersonCommunicationComponent> communication;
368
369    private static final long serialVersionUID = -1396330390L;
370
371  /**
372   * Constructor
373   */
374    public RelatedPerson() {
375      super();
376    }
377
378  /**
379   * Constructor
380   */
381    public RelatedPerson(Reference patient) {
382      super();
383      this.patient = patient;
384    }
385
386    /**
387     * @return {@link #identifier} (Identifier for a person within a particular scope.)
388     */
389    public List<Identifier> getIdentifier() { 
390      if (this.identifier == null)
391        this.identifier = new ArrayList<Identifier>();
392      return this.identifier;
393    }
394
395    /**
396     * @return Returns a reference to <code>this</code> for easy method chaining
397     */
398    public RelatedPerson setIdentifier(List<Identifier> theIdentifier) { 
399      this.identifier = theIdentifier;
400      return this;
401    }
402
403    public boolean hasIdentifier() { 
404      if (this.identifier == null)
405        return false;
406      for (Identifier item : this.identifier)
407        if (!item.isEmpty())
408          return true;
409      return false;
410    }
411
412    public Identifier addIdentifier() { //3
413      Identifier t = new Identifier();
414      if (this.identifier == null)
415        this.identifier = new ArrayList<Identifier>();
416      this.identifier.add(t);
417      return t;
418    }
419
420    public RelatedPerson addIdentifier(Identifier t) { //3
421      if (t == null)
422        return this;
423      if (this.identifier == null)
424        this.identifier = new ArrayList<Identifier>();
425      this.identifier.add(t);
426      return this;
427    }
428
429    /**
430     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
431     */
432    public Identifier getIdentifierFirstRep() { 
433      if (getIdentifier().isEmpty()) {
434        addIdentifier();
435      }
436      return getIdentifier().get(0);
437    }
438
439    /**
440     * @return {@link #active} (Whether this related person record is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
441     */
442    public BooleanType getActiveElement() { 
443      if (this.active == null)
444        if (Configuration.errorOnAutoCreate())
445          throw new Error("Attempt to auto-create RelatedPerson.active");
446        else if (Configuration.doAutoCreate())
447          this.active = new BooleanType(); // bb
448      return this.active;
449    }
450
451    public boolean hasActiveElement() { 
452      return this.active != null && !this.active.isEmpty();
453    }
454
455    public boolean hasActive() { 
456      return this.active != null && !this.active.isEmpty();
457    }
458
459    /**
460     * @param value {@link #active} (Whether this related person record is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
461     */
462    public RelatedPerson setActiveElement(BooleanType value) { 
463      this.active = value;
464      return this;
465    }
466
467    /**
468     * @return Whether this related person record is in active use.
469     */
470    public boolean getActive() { 
471      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
472    }
473
474    /**
475     * @param value Whether this related person record is in active use.
476     */
477    public RelatedPerson setActive(boolean value) { 
478        if (this.active == null)
479          this.active = new BooleanType();
480        this.active.setValue(value);
481      return this;
482    }
483
484    /**
485     * @return {@link #patient} (The patient this person is related to.)
486     */
487    public Reference getPatient() { 
488      if (this.patient == null)
489        if (Configuration.errorOnAutoCreate())
490          throw new Error("Attempt to auto-create RelatedPerson.patient");
491        else if (Configuration.doAutoCreate())
492          this.patient = new Reference(); // cc
493      return this.patient;
494    }
495
496    public boolean hasPatient() { 
497      return this.patient != null && !this.patient.isEmpty();
498    }
499
500    /**
501     * @param value {@link #patient} (The patient this person is related to.)
502     */
503    public RelatedPerson setPatient(Reference value) { 
504      this.patient = value;
505      return this;
506    }
507
508    /**
509     * @return {@link #patient} 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 patient this person is related to.)
510     */
511    public Patient getPatientTarget() { 
512      if (this.patientTarget == null)
513        if (Configuration.errorOnAutoCreate())
514          throw new Error("Attempt to auto-create RelatedPerson.patient");
515        else if (Configuration.doAutoCreate())
516          this.patientTarget = new Patient(); // aa
517      return this.patientTarget;
518    }
519
520    /**
521     * @param value {@link #patient} 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 patient this person is related to.)
522     */
523    public RelatedPerson setPatientTarget(Patient value) { 
524      this.patientTarget = value;
525      return this;
526    }
527
528    /**
529     * @return {@link #relationship} (The nature of the relationship between a patient and the related person.)
530     */
531    public List<CodeableConcept> getRelationship() { 
532      if (this.relationship == null)
533        this.relationship = new ArrayList<CodeableConcept>();
534      return this.relationship;
535    }
536
537    /**
538     * @return Returns a reference to <code>this</code> for easy method chaining
539     */
540    public RelatedPerson setRelationship(List<CodeableConcept> theRelationship) { 
541      this.relationship = theRelationship;
542      return this;
543    }
544
545    public boolean hasRelationship() { 
546      if (this.relationship == null)
547        return false;
548      for (CodeableConcept item : this.relationship)
549        if (!item.isEmpty())
550          return true;
551      return false;
552    }
553
554    public CodeableConcept addRelationship() { //3
555      CodeableConcept t = new CodeableConcept();
556      if (this.relationship == null)
557        this.relationship = new ArrayList<CodeableConcept>();
558      this.relationship.add(t);
559      return t;
560    }
561
562    public RelatedPerson addRelationship(CodeableConcept t) { //3
563      if (t == null)
564        return this;
565      if (this.relationship == null)
566        this.relationship = new ArrayList<CodeableConcept>();
567      this.relationship.add(t);
568      return this;
569    }
570
571    /**
572     * @return The first repetition of repeating field {@link #relationship}, creating it if it does not already exist
573     */
574    public CodeableConcept getRelationshipFirstRep() { 
575      if (getRelationship().isEmpty()) {
576        addRelationship();
577      }
578      return getRelationship().get(0);
579    }
580
581    /**
582     * @return {@link #name} (A name associated with the person.)
583     */
584    public List<HumanName> getName() { 
585      if (this.name == null)
586        this.name = new ArrayList<HumanName>();
587      return this.name;
588    }
589
590    /**
591     * @return Returns a reference to <code>this</code> for easy method chaining
592     */
593    public RelatedPerson setName(List<HumanName> theName) { 
594      this.name = theName;
595      return this;
596    }
597
598    public boolean hasName() { 
599      if (this.name == null)
600        return false;
601      for (HumanName item : this.name)
602        if (!item.isEmpty())
603          return true;
604      return false;
605    }
606
607    public HumanName addName() { //3
608      HumanName t = new HumanName();
609      if (this.name == null)
610        this.name = new ArrayList<HumanName>();
611      this.name.add(t);
612      return t;
613    }
614
615    public RelatedPerson addName(HumanName t) { //3
616      if (t == null)
617        return this;
618      if (this.name == null)
619        this.name = new ArrayList<HumanName>();
620      this.name.add(t);
621      return this;
622    }
623
624    /**
625     * @return The first repetition of repeating field {@link #name}, creating it if it does not already exist
626     */
627    public HumanName getNameFirstRep() { 
628      if (getName().isEmpty()) {
629        addName();
630      }
631      return getName().get(0);
632    }
633
634    /**
635     * @return {@link #telecom} (A contact detail for the person, e.g. a telephone number or an email address.)
636     */
637    public List<ContactPoint> getTelecom() { 
638      if (this.telecom == null)
639        this.telecom = new ArrayList<ContactPoint>();
640      return this.telecom;
641    }
642
643    /**
644     * @return Returns a reference to <code>this</code> for easy method chaining
645     */
646    public RelatedPerson setTelecom(List<ContactPoint> theTelecom) { 
647      this.telecom = theTelecom;
648      return this;
649    }
650
651    public boolean hasTelecom() { 
652      if (this.telecom == null)
653        return false;
654      for (ContactPoint item : this.telecom)
655        if (!item.isEmpty())
656          return true;
657      return false;
658    }
659
660    public ContactPoint addTelecom() { //3
661      ContactPoint t = new ContactPoint();
662      if (this.telecom == null)
663        this.telecom = new ArrayList<ContactPoint>();
664      this.telecom.add(t);
665      return t;
666    }
667
668    public RelatedPerson addTelecom(ContactPoint t) { //3
669      if (t == null)
670        return this;
671      if (this.telecom == null)
672        this.telecom = new ArrayList<ContactPoint>();
673      this.telecom.add(t);
674      return this;
675    }
676
677    /**
678     * @return The first repetition of repeating field {@link #telecom}, creating it if it does not already exist
679     */
680    public ContactPoint getTelecomFirstRep() { 
681      if (getTelecom().isEmpty()) {
682        addTelecom();
683      }
684      return getTelecom().get(0);
685    }
686
687    /**
688     * @return {@link #gender} (Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
689     */
690    public Enumeration<AdministrativeGender> getGenderElement() { 
691      if (this.gender == null)
692        if (Configuration.errorOnAutoCreate())
693          throw new Error("Attempt to auto-create RelatedPerson.gender");
694        else if (Configuration.doAutoCreate())
695          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
696      return this.gender;
697    }
698
699    public boolean hasGenderElement() { 
700      return this.gender != null && !this.gender.isEmpty();
701    }
702
703    public boolean hasGender() { 
704      return this.gender != null && !this.gender.isEmpty();
705    }
706
707    /**
708     * @param value {@link #gender} (Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
709     */
710    public RelatedPerson setGenderElement(Enumeration<AdministrativeGender> value) { 
711      this.gender = value;
712      return this;
713    }
714
715    /**
716     * @return Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
717     */
718    public AdministrativeGender getGender() { 
719      return this.gender == null ? null : this.gender.getValue();
720    }
721
722    /**
723     * @param value Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
724     */
725    public RelatedPerson setGender(AdministrativeGender value) { 
726      if (value == null)
727        this.gender = null;
728      else {
729        if (this.gender == null)
730          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
731        this.gender.setValue(value);
732      }
733      return this;
734    }
735
736    /**
737     * @return {@link #birthDate} (The date on which the related person was born.). This is the underlying object with id, value and extensions. The accessor "getBirthDate" gives direct access to the value
738     */
739    public DateType getBirthDateElement() { 
740      if (this.birthDate == null)
741        if (Configuration.errorOnAutoCreate())
742          throw new Error("Attempt to auto-create RelatedPerson.birthDate");
743        else if (Configuration.doAutoCreate())
744          this.birthDate = new DateType(); // bb
745      return this.birthDate;
746    }
747
748    public boolean hasBirthDateElement() { 
749      return this.birthDate != null && !this.birthDate.isEmpty();
750    }
751
752    public boolean hasBirthDate() { 
753      return this.birthDate != null && !this.birthDate.isEmpty();
754    }
755
756    /**
757     * @param value {@link #birthDate} (The date on which the related person was born.). This is the underlying object with id, value and extensions. The accessor "getBirthDate" gives direct access to the value
758     */
759    public RelatedPerson setBirthDateElement(DateType value) { 
760      this.birthDate = value;
761      return this;
762    }
763
764    /**
765     * @return The date on which the related person was born.
766     */
767    public Date getBirthDate() { 
768      return this.birthDate == null ? null : this.birthDate.getValue();
769    }
770
771    /**
772     * @param value The date on which the related person was born.
773     */
774    public RelatedPerson setBirthDate(Date value) { 
775      if (value == null)
776        this.birthDate = null;
777      else {
778        if (this.birthDate == null)
779          this.birthDate = new DateType();
780        this.birthDate.setValue(value);
781      }
782      return this;
783    }
784
785    /**
786     * @return {@link #address} (Address where the related person can be contacted or visited.)
787     */
788    public List<Address> getAddress() { 
789      if (this.address == null)
790        this.address = new ArrayList<Address>();
791      return this.address;
792    }
793
794    /**
795     * @return Returns a reference to <code>this</code> for easy method chaining
796     */
797    public RelatedPerson setAddress(List<Address> theAddress) { 
798      this.address = theAddress;
799      return this;
800    }
801
802    public boolean hasAddress() { 
803      if (this.address == null)
804        return false;
805      for (Address item : this.address)
806        if (!item.isEmpty())
807          return true;
808      return false;
809    }
810
811    public Address addAddress() { //3
812      Address t = new Address();
813      if (this.address == null)
814        this.address = new ArrayList<Address>();
815      this.address.add(t);
816      return t;
817    }
818
819    public RelatedPerson addAddress(Address t) { //3
820      if (t == null)
821        return this;
822      if (this.address == null)
823        this.address = new ArrayList<Address>();
824      this.address.add(t);
825      return this;
826    }
827
828    /**
829     * @return The first repetition of repeating field {@link #address}, creating it if it does not already exist
830     */
831    public Address getAddressFirstRep() { 
832      if (getAddress().isEmpty()) {
833        addAddress();
834      }
835      return getAddress().get(0);
836    }
837
838    /**
839     * @return {@link #photo} (Image of the person.)
840     */
841    public List<Attachment> getPhoto() { 
842      if (this.photo == null)
843        this.photo = new ArrayList<Attachment>();
844      return this.photo;
845    }
846
847    /**
848     * @return Returns a reference to <code>this</code> for easy method chaining
849     */
850    public RelatedPerson setPhoto(List<Attachment> thePhoto) { 
851      this.photo = thePhoto;
852      return this;
853    }
854
855    public boolean hasPhoto() { 
856      if (this.photo == null)
857        return false;
858      for (Attachment item : this.photo)
859        if (!item.isEmpty())
860          return true;
861      return false;
862    }
863
864    public Attachment addPhoto() { //3
865      Attachment t = new Attachment();
866      if (this.photo == null)
867        this.photo = new ArrayList<Attachment>();
868      this.photo.add(t);
869      return t;
870    }
871
872    public RelatedPerson addPhoto(Attachment t) { //3
873      if (t == null)
874        return this;
875      if (this.photo == null)
876        this.photo = new ArrayList<Attachment>();
877      this.photo.add(t);
878      return this;
879    }
880
881    /**
882     * @return The first repetition of repeating field {@link #photo}, creating it if it does not already exist
883     */
884    public Attachment getPhotoFirstRep() { 
885      if (getPhoto().isEmpty()) {
886        addPhoto();
887      }
888      return getPhoto().get(0);
889    }
890
891    /**
892     * @return {@link #period} (The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown.)
893     */
894    public Period getPeriod() { 
895      if (this.period == null)
896        if (Configuration.errorOnAutoCreate())
897          throw new Error("Attempt to auto-create RelatedPerson.period");
898        else if (Configuration.doAutoCreate())
899          this.period = new Period(); // cc
900      return this.period;
901    }
902
903    public boolean hasPeriod() { 
904      return this.period != null && !this.period.isEmpty();
905    }
906
907    /**
908     * @param value {@link #period} (The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown.)
909     */
910    public RelatedPerson setPeriod(Period value) { 
911      this.period = value;
912      return this;
913    }
914
915    /**
916     * @return {@link #communication} (A language which may be used to communicate with about the patient's health.)
917     */
918    public List<RelatedPersonCommunicationComponent> getCommunication() { 
919      if (this.communication == null)
920        this.communication = new ArrayList<RelatedPersonCommunicationComponent>();
921      return this.communication;
922    }
923
924    /**
925     * @return Returns a reference to <code>this</code> for easy method chaining
926     */
927    public RelatedPerson setCommunication(List<RelatedPersonCommunicationComponent> theCommunication) { 
928      this.communication = theCommunication;
929      return this;
930    }
931
932    public boolean hasCommunication() { 
933      if (this.communication == null)
934        return false;
935      for (RelatedPersonCommunicationComponent item : this.communication)
936        if (!item.isEmpty())
937          return true;
938      return false;
939    }
940
941    public RelatedPersonCommunicationComponent addCommunication() { //3
942      RelatedPersonCommunicationComponent t = new RelatedPersonCommunicationComponent();
943      if (this.communication == null)
944        this.communication = new ArrayList<RelatedPersonCommunicationComponent>();
945      this.communication.add(t);
946      return t;
947    }
948
949    public RelatedPerson addCommunication(RelatedPersonCommunicationComponent t) { //3
950      if (t == null)
951        return this;
952      if (this.communication == null)
953        this.communication = new ArrayList<RelatedPersonCommunicationComponent>();
954      this.communication.add(t);
955      return this;
956    }
957
958    /**
959     * @return The first repetition of repeating field {@link #communication}, creating it if it does not already exist
960     */
961    public RelatedPersonCommunicationComponent getCommunicationFirstRep() { 
962      if (getCommunication().isEmpty()) {
963        addCommunication();
964      }
965      return getCommunication().get(0);
966    }
967
968      protected void listChildren(List<Property> children) {
969        super.listChildren(children);
970        children.add(new Property("identifier", "Identifier", "Identifier for a person within a particular scope.", 0, java.lang.Integer.MAX_VALUE, identifier));
971        children.add(new Property("active", "boolean", "Whether this related person record is in active use.", 0, 1, active));
972        children.add(new Property("patient", "Reference(Patient)", "The patient this person is related to.", 0, 1, patient));
973        children.add(new Property("relationship", "CodeableConcept", "The nature of the relationship between a patient and the related person.", 0, java.lang.Integer.MAX_VALUE, relationship));
974        children.add(new Property("name", "HumanName", "A name associated with the person.", 0, java.lang.Integer.MAX_VALUE, name));
975        children.add(new Property("telecom", "ContactPoint", "A contact detail for the person, e.g. a telephone number or an email address.", 0, java.lang.Integer.MAX_VALUE, telecom));
976        children.add(new Property("gender", "code", "Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.", 0, 1, gender));
977        children.add(new Property("birthDate", "date", "The date on which the related person was born.", 0, 1, birthDate));
978        children.add(new Property("address", "Address", "Address where the related person can be contacted or visited.", 0, java.lang.Integer.MAX_VALUE, address));
979        children.add(new Property("photo", "Attachment", "Image of the person.", 0, java.lang.Integer.MAX_VALUE, photo));
980        children.add(new Property("period", "Period", "The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown.", 0, 1, period));
981        children.add(new Property("communication", "", "A language which may be used to communicate with about the patient's health.", 0, java.lang.Integer.MAX_VALUE, communication));
982      }
983
984      @Override
985      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
986        switch (_hash) {
987        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier for a person within a particular scope.", 0, java.lang.Integer.MAX_VALUE, identifier);
988        case -1422950650: /*active*/  return new Property("active", "boolean", "Whether this related person record is in active use.", 0, 1, active);
989        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The patient this person is related to.", 0, 1, patient);
990        case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "The nature of the relationship between a patient and the related person.", 0, java.lang.Integer.MAX_VALUE, relationship);
991        case 3373707: /*name*/  return new Property("name", "HumanName", "A name associated with the person.", 0, java.lang.Integer.MAX_VALUE, name);
992        case -1429363305: /*telecom*/  return new Property("telecom", "ContactPoint", "A contact detail for the person, e.g. a telephone number or an email address.", 0, java.lang.Integer.MAX_VALUE, telecom);
993        case -1249512767: /*gender*/  return new Property("gender", "code", "Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.", 0, 1, gender);
994        case -1210031859: /*birthDate*/  return new Property("birthDate", "date", "The date on which the related person was born.", 0, 1, birthDate);
995        case -1147692044: /*address*/  return new Property("address", "Address", "Address where the related person can be contacted or visited.", 0, java.lang.Integer.MAX_VALUE, address);
996        case 106642994: /*photo*/  return new Property("photo", "Attachment", "Image of the person.", 0, java.lang.Integer.MAX_VALUE, photo);
997        case -991726143: /*period*/  return new Property("period", "Period", "The period of time during which this relationship is or was active. If there are no dates defined, then the interval is unknown.", 0, 1, period);
998        case -1035284522: /*communication*/  return new Property("communication", "", "A language which may be used to communicate with about the patient's health.", 0, java.lang.Integer.MAX_VALUE, communication);
999        default: return super.getNamedProperty(_hash, _name, _checkValid);
1000        }
1001
1002      }
1003
1004      @Override
1005      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1006        switch (hash) {
1007        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1008        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
1009        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1010        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : this.relationship.toArray(new Base[this.relationship.size()]); // CodeableConcept
1011        case 3373707: /*name*/ return this.name == null ? new Base[0] : this.name.toArray(new Base[this.name.size()]); // HumanName
1012        case -1429363305: /*telecom*/ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
1013        case -1249512767: /*gender*/ return this.gender == null ? new Base[0] : new Base[] {this.gender}; // Enumeration<AdministrativeGender>
1014        case -1210031859: /*birthDate*/ return this.birthDate == null ? new Base[0] : new Base[] {this.birthDate}; // DateType
1015        case -1147692044: /*address*/ return this.address == null ? new Base[0] : this.address.toArray(new Base[this.address.size()]); // Address
1016        case 106642994: /*photo*/ return this.photo == null ? new Base[0] : this.photo.toArray(new Base[this.photo.size()]); // Attachment
1017        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1018        case -1035284522: /*communication*/ return this.communication == null ? new Base[0] : this.communication.toArray(new Base[this.communication.size()]); // RelatedPersonCommunicationComponent
1019        default: return super.getProperty(hash, name, checkValid);
1020        }
1021
1022      }
1023
1024      @Override
1025      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1026        switch (hash) {
1027        case -1618432855: // identifier
1028          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1029          return value;
1030        case -1422950650: // active
1031          this.active = castToBoolean(value); // BooleanType
1032          return value;
1033        case -791418107: // patient
1034          this.patient = castToReference(value); // Reference
1035          return value;
1036        case -261851592: // relationship
1037          this.getRelationship().add(castToCodeableConcept(value)); // CodeableConcept
1038          return value;
1039        case 3373707: // name
1040          this.getName().add(castToHumanName(value)); // HumanName
1041          return value;
1042        case -1429363305: // telecom
1043          this.getTelecom().add(castToContactPoint(value)); // ContactPoint
1044          return value;
1045        case -1249512767: // gender
1046          value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
1047          this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
1048          return value;
1049        case -1210031859: // birthDate
1050          this.birthDate = castToDate(value); // DateType
1051          return value;
1052        case -1147692044: // address
1053          this.getAddress().add(castToAddress(value)); // Address
1054          return value;
1055        case 106642994: // photo
1056          this.getPhoto().add(castToAttachment(value)); // Attachment
1057          return value;
1058        case -991726143: // period
1059          this.period = castToPeriod(value); // Period
1060          return value;
1061        case -1035284522: // communication
1062          this.getCommunication().add((RelatedPersonCommunicationComponent) value); // RelatedPersonCommunicationComponent
1063          return value;
1064        default: return super.setProperty(hash, name, value);
1065        }
1066
1067      }
1068
1069      @Override
1070      public Base setProperty(String name, Base value) throws FHIRException {
1071        if (name.equals("identifier")) {
1072          this.getIdentifier().add(castToIdentifier(value));
1073        } else if (name.equals("active")) {
1074          this.active = castToBoolean(value); // BooleanType
1075        } else if (name.equals("patient")) {
1076          this.patient = castToReference(value); // Reference
1077        } else if (name.equals("relationship")) {
1078          this.getRelationship().add(castToCodeableConcept(value));
1079        } else if (name.equals("name")) {
1080          this.getName().add(castToHumanName(value));
1081        } else if (name.equals("telecom")) {
1082          this.getTelecom().add(castToContactPoint(value));
1083        } else if (name.equals("gender")) {
1084          value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
1085          this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
1086        } else if (name.equals("birthDate")) {
1087          this.birthDate = castToDate(value); // DateType
1088        } else if (name.equals("address")) {
1089          this.getAddress().add(castToAddress(value));
1090        } else if (name.equals("photo")) {
1091          this.getPhoto().add(castToAttachment(value));
1092        } else if (name.equals("period")) {
1093          this.period = castToPeriod(value); // Period
1094        } else if (name.equals("communication")) {
1095          this.getCommunication().add((RelatedPersonCommunicationComponent) value);
1096        } else
1097          return super.setProperty(name, value);
1098        return value;
1099      }
1100
1101      @Override
1102      public Base makeProperty(int hash, String name) throws FHIRException {
1103        switch (hash) {
1104        case -1618432855:  return addIdentifier(); 
1105        case -1422950650:  return getActiveElement();
1106        case -791418107:  return getPatient(); 
1107        case -261851592:  return addRelationship(); 
1108        case 3373707:  return addName(); 
1109        case -1429363305:  return addTelecom(); 
1110        case -1249512767:  return getGenderElement();
1111        case -1210031859:  return getBirthDateElement();
1112        case -1147692044:  return addAddress(); 
1113        case 106642994:  return addPhoto(); 
1114        case -991726143:  return getPeriod(); 
1115        case -1035284522:  return addCommunication(); 
1116        default: return super.makeProperty(hash, name);
1117        }
1118
1119      }
1120
1121      @Override
1122      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1123        switch (hash) {
1124        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1125        case -1422950650: /*active*/ return new String[] {"boolean"};
1126        case -791418107: /*patient*/ return new String[] {"Reference"};
1127        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
1128        case 3373707: /*name*/ return new String[] {"HumanName"};
1129        case -1429363305: /*telecom*/ return new String[] {"ContactPoint"};
1130        case -1249512767: /*gender*/ return new String[] {"code"};
1131        case -1210031859: /*birthDate*/ return new String[] {"date"};
1132        case -1147692044: /*address*/ return new String[] {"Address"};
1133        case 106642994: /*photo*/ return new String[] {"Attachment"};
1134        case -991726143: /*period*/ return new String[] {"Period"};
1135        case -1035284522: /*communication*/ return new String[] {};
1136        default: return super.getTypesForProperty(hash, name);
1137        }
1138
1139      }
1140
1141      @Override
1142      public Base addChild(String name) throws FHIRException {
1143        if (name.equals("identifier")) {
1144          return addIdentifier();
1145        }
1146        else if (name.equals("active")) {
1147          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.active");
1148        }
1149        else if (name.equals("patient")) {
1150          this.patient = new Reference();
1151          return this.patient;
1152        }
1153        else if (name.equals("relationship")) {
1154          return addRelationship();
1155        }
1156        else if (name.equals("name")) {
1157          return addName();
1158        }
1159        else if (name.equals("telecom")) {
1160          return addTelecom();
1161        }
1162        else if (name.equals("gender")) {
1163          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.gender");
1164        }
1165        else if (name.equals("birthDate")) {
1166          throw new FHIRException("Cannot call addChild on a primitive type RelatedPerson.birthDate");
1167        }
1168        else if (name.equals("address")) {
1169          return addAddress();
1170        }
1171        else if (name.equals("photo")) {
1172          return addPhoto();
1173        }
1174        else if (name.equals("period")) {
1175          this.period = new Period();
1176          return this.period;
1177        }
1178        else if (name.equals("communication")) {
1179          return addCommunication();
1180        }
1181        else
1182          return super.addChild(name);
1183      }
1184
1185  public String fhirType() {
1186    return "RelatedPerson";
1187
1188  }
1189
1190      public RelatedPerson copy() {
1191        RelatedPerson dst = new RelatedPerson();
1192        copyValues(dst);
1193        if (identifier != null) {
1194          dst.identifier = new ArrayList<Identifier>();
1195          for (Identifier i : identifier)
1196            dst.identifier.add(i.copy());
1197        };
1198        dst.active = active == null ? null : active.copy();
1199        dst.patient = patient == null ? null : patient.copy();
1200        if (relationship != null) {
1201          dst.relationship = new ArrayList<CodeableConcept>();
1202          for (CodeableConcept i : relationship)
1203            dst.relationship.add(i.copy());
1204        };
1205        if (name != null) {
1206          dst.name = new ArrayList<HumanName>();
1207          for (HumanName i : name)
1208            dst.name.add(i.copy());
1209        };
1210        if (telecom != null) {
1211          dst.telecom = new ArrayList<ContactPoint>();
1212          for (ContactPoint i : telecom)
1213            dst.telecom.add(i.copy());
1214        };
1215        dst.gender = gender == null ? null : gender.copy();
1216        dst.birthDate = birthDate == null ? null : birthDate.copy();
1217        if (address != null) {
1218          dst.address = new ArrayList<Address>();
1219          for (Address i : address)
1220            dst.address.add(i.copy());
1221        };
1222        if (photo != null) {
1223          dst.photo = new ArrayList<Attachment>();
1224          for (Attachment i : photo)
1225            dst.photo.add(i.copy());
1226        };
1227        dst.period = period == null ? null : period.copy();
1228        if (communication != null) {
1229          dst.communication = new ArrayList<RelatedPersonCommunicationComponent>();
1230          for (RelatedPersonCommunicationComponent i : communication)
1231            dst.communication.add(i.copy());
1232        };
1233        return dst;
1234      }
1235
1236      protected RelatedPerson typedCopy() {
1237        return copy();
1238      }
1239
1240      @Override
1241      public boolean equalsDeep(Base other_) {
1242        if (!super.equalsDeep(other_))
1243          return false;
1244        if (!(other_ instanceof RelatedPerson))
1245          return false;
1246        RelatedPerson o = (RelatedPerson) other_;
1247        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(patient, o.patient, true)
1248           && compareDeep(relationship, o.relationship, true) && compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true)
1249           && compareDeep(gender, o.gender, true) && compareDeep(birthDate, o.birthDate, true) && compareDeep(address, o.address, true)
1250           && compareDeep(photo, o.photo, true) && compareDeep(period, o.period, true) && compareDeep(communication, o.communication, true)
1251          ;
1252      }
1253
1254      @Override
1255      public boolean equalsShallow(Base other_) {
1256        if (!super.equalsShallow(other_))
1257          return false;
1258        if (!(other_ instanceof RelatedPerson))
1259          return false;
1260        RelatedPerson o = (RelatedPerson) other_;
1261        return compareValues(active, o.active, true) && compareValues(gender, o.gender, true) && compareValues(birthDate, o.birthDate, true)
1262          ;
1263      }
1264
1265      public boolean isEmpty() {
1266        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, patient
1267          , relationship, name, telecom, gender, birthDate, address, photo, period, communication
1268          );
1269      }
1270
1271  @Override
1272  public ResourceType getResourceType() {
1273    return ResourceType.RelatedPerson;
1274   }
1275
1276 /**
1277   * Search parameter: <b>identifier</b>
1278   * <p>
1279   * Description: <b>An Identifier of the RelatedPerson</b><br>
1280   * Type: <b>token</b><br>
1281   * Path: <b>RelatedPerson.identifier</b><br>
1282   * </p>
1283   */
1284  @SearchParamDefinition(name="identifier", path="RelatedPerson.identifier", description="An Identifier of the RelatedPerson", type="token" )
1285  public static final String SP_IDENTIFIER = "identifier";
1286 /**
1287   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1288   * <p>
1289   * Description: <b>An Identifier of the RelatedPerson</b><br>
1290   * Type: <b>token</b><br>
1291   * Path: <b>RelatedPerson.identifier</b><br>
1292   * </p>
1293   */
1294  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1295
1296 /**
1297   * Search parameter: <b>address</b>
1298   * <p>
1299   * Description: <b>A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text</b><br>
1300   * Type: <b>string</b><br>
1301   * Path: <b>RelatedPerson.address</b><br>
1302   * </p>
1303   */
1304  @SearchParamDefinition(name="address", path="RelatedPerson.address", description="A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text", type="string" )
1305  public static final String SP_ADDRESS = "address";
1306 /**
1307   * <b>Fluent Client</b> search parameter constant for <b>address</b>
1308   * <p>
1309   * Description: <b>A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text</b><br>
1310   * Type: <b>string</b><br>
1311   * Path: <b>RelatedPerson.address</b><br>
1312   * </p>
1313   */
1314  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS);
1315
1316 /**
1317   * Search parameter: <b>birthdate</b>
1318   * <p>
1319   * Description: <b>The Related Person's date of birth</b><br>
1320   * Type: <b>date</b><br>
1321   * Path: <b>RelatedPerson.birthDate</b><br>
1322   * </p>
1323   */
1324  @SearchParamDefinition(name="birthdate", path="RelatedPerson.birthDate", description="The Related Person's date of birth", type="date" )
1325  public static final String SP_BIRTHDATE = "birthdate";
1326 /**
1327   * <b>Fluent Client</b> search parameter constant for <b>birthdate</b>
1328   * <p>
1329   * Description: <b>The Related Person's date of birth</b><br>
1330   * Type: <b>date</b><br>
1331   * Path: <b>RelatedPerson.birthDate</b><br>
1332   * </p>
1333   */
1334  public static final ca.uhn.fhir.rest.gclient.DateClientParam BIRTHDATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_BIRTHDATE);
1335
1336 /**
1337   * Search parameter: <b>address-state</b>
1338   * <p>
1339   * Description: <b>A state specified in an address</b><br>
1340   * Type: <b>string</b><br>
1341   * Path: <b>RelatedPerson.address.state</b><br>
1342   * </p>
1343   */
1344  @SearchParamDefinition(name="address-state", path="RelatedPerson.address.state", description="A state specified in an address", type="string" )
1345  public static final String SP_ADDRESS_STATE = "address-state";
1346 /**
1347   * <b>Fluent Client</b> search parameter constant for <b>address-state</b>
1348   * <p>
1349   * Description: <b>A state specified in an address</b><br>
1350   * Type: <b>string</b><br>
1351   * Path: <b>RelatedPerson.address.state</b><br>
1352   * </p>
1353   */
1354  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_STATE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_STATE);
1355
1356 /**
1357   * Search parameter: <b>gender</b>
1358   * <p>
1359   * Description: <b>Gender of the related person</b><br>
1360   * Type: <b>token</b><br>
1361   * Path: <b>RelatedPerson.gender</b><br>
1362   * </p>
1363   */
1364  @SearchParamDefinition(name="gender", path="RelatedPerson.gender", description="Gender of the related person", type="token" )
1365  public static final String SP_GENDER = "gender";
1366 /**
1367   * <b>Fluent Client</b> search parameter constant for <b>gender</b>
1368   * <p>
1369   * Description: <b>Gender of the related person</b><br>
1370   * Type: <b>token</b><br>
1371   * Path: <b>RelatedPerson.gender</b><br>
1372   * </p>
1373   */
1374  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GENDER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GENDER);
1375
1376 /**
1377   * Search parameter: <b>active</b>
1378   * <p>
1379   * Description: <b>Indicates if the related person record is active</b><br>
1380   * Type: <b>token</b><br>
1381   * Path: <b>RelatedPerson.active</b><br>
1382   * </p>
1383   */
1384  @SearchParamDefinition(name="active", path="RelatedPerson.active", description="Indicates if the related person record is active", type="token" )
1385  public static final String SP_ACTIVE = "active";
1386 /**
1387   * <b>Fluent Client</b> search parameter constant for <b>active</b>
1388   * <p>
1389   * Description: <b>Indicates if the related person record is active</b><br>
1390   * Type: <b>token</b><br>
1391   * Path: <b>RelatedPerson.active</b><br>
1392   * </p>
1393   */
1394  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVE);
1395
1396 /**
1397   * Search parameter: <b>address-postalcode</b>
1398   * <p>
1399   * Description: <b>A postal code specified in an address</b><br>
1400   * Type: <b>string</b><br>
1401   * Path: <b>RelatedPerson.address.postalCode</b><br>
1402   * </p>
1403   */
1404  @SearchParamDefinition(name="address-postalcode", path="RelatedPerson.address.postalCode", description="A postal code specified in an address", type="string" )
1405  public static final String SP_ADDRESS_POSTALCODE = "address-postalcode";
1406 /**
1407   * <b>Fluent Client</b> search parameter constant for <b>address-postalcode</b>
1408   * <p>
1409   * Description: <b>A postal code specified in an address</b><br>
1410   * Type: <b>string</b><br>
1411   * Path: <b>RelatedPerson.address.postalCode</b><br>
1412   * </p>
1413   */
1414  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_POSTALCODE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_POSTALCODE);
1415
1416 /**
1417   * Search parameter: <b>address-country</b>
1418   * <p>
1419   * Description: <b>A country specified in an address</b><br>
1420   * Type: <b>string</b><br>
1421   * Path: <b>RelatedPerson.address.country</b><br>
1422   * </p>
1423   */
1424  @SearchParamDefinition(name="address-country", path="RelatedPerson.address.country", description="A country specified in an address", type="string" )
1425  public static final String SP_ADDRESS_COUNTRY = "address-country";
1426 /**
1427   * <b>Fluent Client</b> search parameter constant for <b>address-country</b>
1428   * <p>
1429   * Description: <b>A country specified in an address</b><br>
1430   * Type: <b>string</b><br>
1431   * Path: <b>RelatedPerson.address.country</b><br>
1432   * </p>
1433   */
1434  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_COUNTRY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_COUNTRY);
1435
1436 /**
1437   * Search parameter: <b>phonetic</b>
1438   * <p>
1439   * Description: <b>A portion of name using some kind of phonetic matching algorithm</b><br>
1440   * Type: <b>string</b><br>
1441   * Path: <b>RelatedPerson.name</b><br>
1442   * </p>
1443   */
1444  @SearchParamDefinition(name="phonetic", path="RelatedPerson.name", description="A portion of name using some kind of phonetic matching algorithm", type="string" )
1445  public static final String SP_PHONETIC = "phonetic";
1446 /**
1447   * <b>Fluent Client</b> search parameter constant for <b>phonetic</b>
1448   * <p>
1449   * Description: <b>A portion of name using some kind of phonetic matching algorithm</b><br>
1450   * Type: <b>string</b><br>
1451   * Path: <b>RelatedPerson.name</b><br>
1452   * </p>
1453   */
1454  public static final ca.uhn.fhir.rest.gclient.StringClientParam PHONETIC = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PHONETIC);
1455
1456 /**
1457   * Search parameter: <b>phone</b>
1458   * <p>
1459   * Description: <b>A value in a phone contact</b><br>
1460   * Type: <b>token</b><br>
1461   * Path: <b>RelatedPerson.telecom(system=phone)</b><br>
1462   * </p>
1463   */
1464  @SearchParamDefinition(name="phone", path="RelatedPerson.telecom.where(system='phone')", description="A value in a phone contact", type="token" )
1465  public static final String SP_PHONE = "phone";
1466 /**
1467   * <b>Fluent Client</b> search parameter constant for <b>phone</b>
1468   * <p>
1469   * Description: <b>A value in a phone contact</b><br>
1470   * Type: <b>token</b><br>
1471   * Path: <b>RelatedPerson.telecom(system=phone)</b><br>
1472   * </p>
1473   */
1474  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PHONE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PHONE);
1475
1476 /**
1477   * Search parameter: <b>patient</b>
1478   * <p>
1479   * Description: <b>The patient this related person is related to</b><br>
1480   * Type: <b>reference</b><br>
1481   * Path: <b>RelatedPerson.patient</b><br>
1482   * </p>
1483   */
1484  @SearchParamDefinition(name="patient", path="RelatedPerson.patient", description="The patient this related person is related to", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
1485  public static final String SP_PATIENT = "patient";
1486 /**
1487   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1488   * <p>
1489   * Description: <b>The patient this related person is related to</b><br>
1490   * Type: <b>reference</b><br>
1491   * Path: <b>RelatedPerson.patient</b><br>
1492   * </p>
1493   */
1494  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1495
1496/**
1497   * Constant for fluent queries to be used to add include statements. Specifies
1498   * the path value of "<b>RelatedPerson:patient</b>".
1499   */
1500  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("RelatedPerson:patient").toLocked();
1501
1502 /**
1503   * Search parameter: <b>name</b>
1504   * <p>
1505   * Description: <b>A server defined search that may match any of the string fields in the HumanName, including family, give, prefix, suffix, suffix, and/or text</b><br>
1506   * Type: <b>string</b><br>
1507   * Path: <b>RelatedPerson.name</b><br>
1508   * </p>
1509   */
1510  @SearchParamDefinition(name="name", path="RelatedPerson.name", description="A server defined search that may match any of the string fields in the HumanName, including family, give, prefix, suffix, suffix, and/or text", type="string" )
1511  public static final String SP_NAME = "name";
1512 /**
1513   * <b>Fluent Client</b> search parameter constant for <b>name</b>
1514   * <p>
1515   * Description: <b>A server defined search that may match any of the string fields in the HumanName, including family, give, prefix, suffix, suffix, and/or text</b><br>
1516   * Type: <b>string</b><br>
1517   * Path: <b>RelatedPerson.name</b><br>
1518   * </p>
1519   */
1520  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
1521
1522 /**
1523   * Search parameter: <b>address-use</b>
1524   * <p>
1525   * Description: <b>A use code specified in an address</b><br>
1526   * Type: <b>token</b><br>
1527   * Path: <b>RelatedPerson.address.use</b><br>
1528   * </p>
1529   */
1530  @SearchParamDefinition(name="address-use", path="RelatedPerson.address.use", description="A use code specified in an address", type="token" )
1531  public static final String SP_ADDRESS_USE = "address-use";
1532 /**
1533   * <b>Fluent Client</b> search parameter constant for <b>address-use</b>
1534   * <p>
1535   * Description: <b>A use code specified in an address</b><br>
1536   * Type: <b>token</b><br>
1537   * Path: <b>RelatedPerson.address.use</b><br>
1538   * </p>
1539   */
1540  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDRESS_USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDRESS_USE);
1541
1542 /**
1543   * Search parameter: <b>telecom</b>
1544   * <p>
1545   * Description: <b>The value in any kind of contact</b><br>
1546   * Type: <b>token</b><br>
1547   * Path: <b>RelatedPerson.telecom</b><br>
1548   * </p>
1549   */
1550  @SearchParamDefinition(name="telecom", path="RelatedPerson.telecom", description="The value in any kind of contact", type="token" )
1551  public static final String SP_TELECOM = "telecom";
1552 /**
1553   * <b>Fluent Client</b> search parameter constant for <b>telecom</b>
1554   * <p>
1555   * Description: <b>The value in any kind of contact</b><br>
1556   * Type: <b>token</b><br>
1557   * Path: <b>RelatedPerson.telecom</b><br>
1558   * </p>
1559   */
1560  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TELECOM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TELECOM);
1561
1562 /**
1563   * Search parameter: <b>address-city</b>
1564   * <p>
1565   * Description: <b>A city specified in an address</b><br>
1566   * Type: <b>string</b><br>
1567   * Path: <b>RelatedPerson.address.city</b><br>
1568   * </p>
1569   */
1570  @SearchParamDefinition(name="address-city", path="RelatedPerson.address.city", description="A city specified in an address", type="string" )
1571  public static final String SP_ADDRESS_CITY = "address-city";
1572 /**
1573   * <b>Fluent Client</b> search parameter constant for <b>address-city</b>
1574   * <p>
1575   * Description: <b>A city specified in an address</b><br>
1576   * Type: <b>string</b><br>
1577   * Path: <b>RelatedPerson.address.city</b><br>
1578   * </p>
1579   */
1580  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_CITY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_CITY);
1581
1582 /**
1583   * Search parameter: <b>relationship</b>
1584   * <p>
1585   * Description: <b>The relationship between the patient and the relatedperson</b><br>
1586   * Type: <b>token</b><br>
1587   * Path: <b>RelatedPerson.relationship</b><br>
1588   * </p>
1589   */
1590  @SearchParamDefinition(name="relationship", path="RelatedPerson.relationship", description="The relationship between the patient and the relatedperson", type="token" )
1591  public static final String SP_RELATIONSHIP = "relationship";
1592 /**
1593   * <b>Fluent Client</b> search parameter constant for <b>relationship</b>
1594   * <p>
1595   * Description: <b>The relationship between the patient and the relatedperson</b><br>
1596   * Type: <b>token</b><br>
1597   * Path: <b>RelatedPerson.relationship</b><br>
1598   * </p>
1599   */
1600  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATIONSHIP = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_RELATIONSHIP);
1601
1602 /**
1603   * Search parameter: <b>email</b>
1604   * <p>
1605   * Description: <b>A value in an email contact</b><br>
1606   * Type: <b>token</b><br>
1607   * Path: <b>RelatedPerson.telecom(system=email)</b><br>
1608   * </p>
1609   */
1610  @SearchParamDefinition(name="email", path="RelatedPerson.telecom.where(system='email')", description="A value in an email contact", type="token" )
1611  public static final String SP_EMAIL = "email";
1612 /**
1613   * <b>Fluent Client</b> search parameter constant for <b>email</b>
1614   * <p>
1615   * Description: <b>A value in an email contact</b><br>
1616   * Type: <b>token</b><br>
1617   * Path: <b>RelatedPerson.telecom(system=email)</b><br>
1618   * </p>
1619   */
1620  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EMAIL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EMAIL);
1621
1622
1623}
1624