001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * Prospective warnings of potential issues when providing care to the patient.
047 */
048@ResourceDef(name="Flag", profile="http://hl7.org/fhir/Profile/Flag")
049public class Flag extends DomainResource {
050
051    public enum FlagStatus {
052        /**
053         * A current flag that should be displayed to a user. A system may use the category to determine which roles should view the flag.
054         */
055        ACTIVE, 
056        /**
057         * The flag does not need to be displayed any more.
058         */
059        INACTIVE, 
060        /**
061         * The flag was added in error, and should no longer be displayed.
062         */
063        ENTEREDINERROR, 
064        /**
065         * added to help the parsers with the generic types
066         */
067        NULL;
068        public static FlagStatus fromCode(String codeString) throws FHIRException {
069            if (codeString == null || "".equals(codeString))
070                return null;
071        if ("active".equals(codeString))
072          return ACTIVE;
073        if ("inactive".equals(codeString))
074          return INACTIVE;
075        if ("entered-in-error".equals(codeString))
076          return ENTEREDINERROR;
077        if (Configuration.isAcceptInvalidEnums())
078          return null;
079        else
080          throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
081        }
082        public String toCode() {
083          switch (this) {
084            case ACTIVE: return "active";
085            case INACTIVE: return "inactive";
086            case ENTEREDINERROR: return "entered-in-error";
087            default: return "?";
088          }
089        }
090        public String getSystem() {
091          switch (this) {
092            case ACTIVE: return "http://hl7.org/fhir/flag-status";
093            case INACTIVE: return "http://hl7.org/fhir/flag-status";
094            case ENTEREDINERROR: return "http://hl7.org/fhir/flag-status";
095            default: return "?";
096          }
097        }
098        public String getDefinition() {
099          switch (this) {
100            case ACTIVE: return "A current flag that should be displayed to a user. A system may use the category to determine which roles should view the flag.";
101            case INACTIVE: return "The flag does not need to be displayed any more.";
102            case ENTEREDINERROR: return "The flag was added in error, and should no longer be displayed.";
103            default: return "?";
104          }
105        }
106        public String getDisplay() {
107          switch (this) {
108            case ACTIVE: return "Active";
109            case INACTIVE: return "Inactive";
110            case ENTEREDINERROR: return "Entered in Error";
111            default: return "?";
112          }
113        }
114    }
115
116  public static class FlagStatusEnumFactory implements EnumFactory<FlagStatus> {
117    public FlagStatus fromCode(String codeString) throws IllegalArgumentException {
118      if (codeString == null || "".equals(codeString))
119            if (codeString == null || "".equals(codeString))
120                return null;
121        if ("active".equals(codeString))
122          return FlagStatus.ACTIVE;
123        if ("inactive".equals(codeString))
124          return FlagStatus.INACTIVE;
125        if ("entered-in-error".equals(codeString))
126          return FlagStatus.ENTEREDINERROR;
127        throw new IllegalArgumentException("Unknown FlagStatus code '"+codeString+"'");
128        }
129        public Enumeration<FlagStatus> fromType(Base code) throws FHIRException {
130          if (code == null)
131            return null;
132          if (code.isEmpty())
133            return new Enumeration<FlagStatus>(this);
134          String codeString = ((PrimitiveType) code).asStringValue();
135          if (codeString == null || "".equals(codeString))
136            return null;
137        if ("active".equals(codeString))
138          return new Enumeration<FlagStatus>(this, FlagStatus.ACTIVE);
139        if ("inactive".equals(codeString))
140          return new Enumeration<FlagStatus>(this, FlagStatus.INACTIVE);
141        if ("entered-in-error".equals(codeString))
142          return new Enumeration<FlagStatus>(this, FlagStatus.ENTEREDINERROR);
143        throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
144        }
145    public String toCode(FlagStatus code) {
146      if (code == FlagStatus.ACTIVE)
147        return "active";
148      if (code == FlagStatus.INACTIVE)
149        return "inactive";
150      if (code == FlagStatus.ENTEREDINERROR)
151        return "entered-in-error";
152      return "?";
153      }
154    public String toSystem(FlagStatus code) {
155      return code.getSystem();
156      }
157    }
158
159    /**
160     * Business identifiers assigned to this flag by the performer or other systems which remain constant as the resource is updated and propagates from server to server.
161     */
162    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
163    @Description(shortDefinition="Business identifier", formalDefinition="Business identifiers assigned to this flag by the performer or other systems which remain constant as the resource is updated and propagates from server to server." )
164    protected List<Identifier> identifier;
165
166    /**
167     * Supports basic workflow.
168     */
169    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
170    @Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="Supports basic workflow." )
171    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/flag-status")
172    protected Enumeration<FlagStatus> status;
173
174    /**
175     * Allows a flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.
176     */
177    @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
178    @Description(shortDefinition="Clinical, administrative, etc.", formalDefinition="Allows a flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context." )
179    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/flag-category")
180    protected List<CodeableConcept> category;
181
182    /**
183     * The coded value or textual component of the flag to display to the user.
184     */
185    @Child(name = "code", type = {CodeableConcept.class}, order=3, min=1, max=1, modifier=false, summary=true)
186    @Description(shortDefinition="Coded or textual message to display to user", formalDefinition="The coded value or textual component of the flag to display to the user." )
187    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/flag-code")
188    protected CodeableConcept code;
189
190    /**
191     * The patient, location, group, organization, or practitioner etc. this is about record this flag is associated with.
192     */
193    @Child(name = "subject", type = {Patient.class, Location.class, Group.class, Organization.class, Practitioner.class, PlanDefinition.class, Medication.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=true)
194    @Description(shortDefinition="Who/What is flag about?", formalDefinition="The patient, location, group, organization, or practitioner etc. this is about record this flag is associated with." )
195    protected Reference subject;
196
197    /**
198     * The actual object that is the target of the reference (The patient, location, group, organization, or practitioner etc. this is about record this flag is associated with.)
199     */
200    protected Resource subjectTarget;
201
202    /**
203     * The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.
204     */
205    @Child(name = "period", type = {Period.class}, order=5, min=0, max=1, modifier=false, summary=true)
206    @Description(shortDefinition="Time period when flag is active", formalDefinition="The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified." )
207    protected Period period;
208
209    /**
210     * This alert is only relevant during the encounter.
211     */
212    @Child(name = "encounter", type = {Encounter.class}, order=6, min=0, max=1, modifier=false, summary=true)
213    @Description(shortDefinition="Alert relevant during encounter", formalDefinition="This alert is only relevant during the encounter." )
214    protected Reference encounter;
215
216    /**
217     * The actual object that is the target of the reference (This alert is only relevant during the encounter.)
218     */
219    protected Encounter encounterTarget;
220
221    /**
222     * The person, organization or device that created the flag.
223     */
224    @Child(name = "author", type = {Device.class, Organization.class, Patient.class, Practitioner.class}, order=7, min=0, max=1, modifier=false, summary=true)
225    @Description(shortDefinition="Flag creator", formalDefinition="The person, organization or device that created the flag." )
226    protected Reference author;
227
228    /**
229     * The actual object that is the target of the reference (The person, organization or device that created the flag.)
230     */
231    protected Resource authorTarget;
232
233    private static final long serialVersionUID = 163791439L;
234
235  /**
236   * Constructor
237   */
238    public Flag() {
239      super();
240    }
241
242  /**
243   * Constructor
244   */
245    public Flag(Enumeration<FlagStatus> status, CodeableConcept code, Reference subject) {
246      super();
247      this.status = status;
248      this.code = code;
249      this.subject = subject;
250    }
251
252    /**
253     * @return {@link #identifier} (Business identifiers assigned to this flag by the performer or other systems which remain constant as the resource is updated and propagates from server to server.)
254     */
255    public List<Identifier> getIdentifier() { 
256      if (this.identifier == null)
257        this.identifier = new ArrayList<Identifier>();
258      return this.identifier;
259    }
260
261    /**
262     * @return Returns a reference to <code>this</code> for easy method chaining
263     */
264    public Flag setIdentifier(List<Identifier> theIdentifier) { 
265      this.identifier = theIdentifier;
266      return this;
267    }
268
269    public boolean hasIdentifier() { 
270      if (this.identifier == null)
271        return false;
272      for (Identifier item : this.identifier)
273        if (!item.isEmpty())
274          return true;
275      return false;
276    }
277
278    public Identifier addIdentifier() { //3
279      Identifier t = new Identifier();
280      if (this.identifier == null)
281        this.identifier = new ArrayList<Identifier>();
282      this.identifier.add(t);
283      return t;
284    }
285
286    public Flag addIdentifier(Identifier t) { //3
287      if (t == null)
288        return this;
289      if (this.identifier == null)
290        this.identifier = new ArrayList<Identifier>();
291      this.identifier.add(t);
292      return this;
293    }
294
295    /**
296     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
297     */
298    public Identifier getIdentifierFirstRep() { 
299      if (getIdentifier().isEmpty()) {
300        addIdentifier();
301      }
302      return getIdentifier().get(0);
303    }
304
305    /**
306     * @return {@link #status} (Supports basic workflow.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
307     */
308    public Enumeration<FlagStatus> getStatusElement() { 
309      if (this.status == null)
310        if (Configuration.errorOnAutoCreate())
311          throw new Error("Attempt to auto-create Flag.status");
312        else if (Configuration.doAutoCreate())
313          this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory()); // bb
314      return this.status;
315    }
316
317    public boolean hasStatusElement() { 
318      return this.status != null && !this.status.isEmpty();
319    }
320
321    public boolean hasStatus() { 
322      return this.status != null && !this.status.isEmpty();
323    }
324
325    /**
326     * @param value {@link #status} (Supports basic workflow.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
327     */
328    public Flag setStatusElement(Enumeration<FlagStatus> value) { 
329      this.status = value;
330      return this;
331    }
332
333    /**
334     * @return Supports basic workflow.
335     */
336    public FlagStatus getStatus() { 
337      return this.status == null ? null : this.status.getValue();
338    }
339
340    /**
341     * @param value Supports basic workflow.
342     */
343    public Flag setStatus(FlagStatus value) { 
344        if (this.status == null)
345          this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory());
346        this.status.setValue(value);
347      return this;
348    }
349
350    /**
351     * @return {@link #category} (Allows a flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.)
352     */
353    public List<CodeableConcept> getCategory() { 
354      if (this.category == null)
355        this.category = new ArrayList<CodeableConcept>();
356      return this.category;
357    }
358
359    /**
360     * @return Returns a reference to <code>this</code> for easy method chaining
361     */
362    public Flag setCategory(List<CodeableConcept> theCategory) { 
363      this.category = theCategory;
364      return this;
365    }
366
367    public boolean hasCategory() { 
368      if (this.category == null)
369        return false;
370      for (CodeableConcept item : this.category)
371        if (!item.isEmpty())
372          return true;
373      return false;
374    }
375
376    public CodeableConcept addCategory() { //3
377      CodeableConcept t = new CodeableConcept();
378      if (this.category == null)
379        this.category = new ArrayList<CodeableConcept>();
380      this.category.add(t);
381      return t;
382    }
383
384    public Flag addCategory(CodeableConcept t) { //3
385      if (t == null)
386        return this;
387      if (this.category == null)
388        this.category = new ArrayList<CodeableConcept>();
389      this.category.add(t);
390      return this;
391    }
392
393    /**
394     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist
395     */
396    public CodeableConcept getCategoryFirstRep() { 
397      if (getCategory().isEmpty()) {
398        addCategory();
399      }
400      return getCategory().get(0);
401    }
402
403    /**
404     * @return {@link #code} (The coded value or textual component of the flag to display to the user.)
405     */
406    public CodeableConcept getCode() { 
407      if (this.code == null)
408        if (Configuration.errorOnAutoCreate())
409          throw new Error("Attempt to auto-create Flag.code");
410        else if (Configuration.doAutoCreate())
411          this.code = new CodeableConcept(); // cc
412      return this.code;
413    }
414
415    public boolean hasCode() { 
416      return this.code != null && !this.code.isEmpty();
417    }
418
419    /**
420     * @param value {@link #code} (The coded value or textual component of the flag to display to the user.)
421     */
422    public Flag setCode(CodeableConcept value) { 
423      this.code = value;
424      return this;
425    }
426
427    /**
428     * @return {@link #subject} (The patient, location, group, organization, or practitioner etc. this is about record this flag is associated with.)
429     */
430    public Reference getSubject() { 
431      if (this.subject == null)
432        if (Configuration.errorOnAutoCreate())
433          throw new Error("Attempt to auto-create Flag.subject");
434        else if (Configuration.doAutoCreate())
435          this.subject = new Reference(); // cc
436      return this.subject;
437    }
438
439    public boolean hasSubject() { 
440      return this.subject != null && !this.subject.isEmpty();
441    }
442
443    /**
444     * @param value {@link #subject} (The patient, location, group, organization, or practitioner etc. this is about record this flag is associated with.)
445     */
446    public Flag setSubject(Reference value) { 
447      this.subject = value;
448      return this;
449    }
450
451    /**
452     * @return {@link #subject} 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, location, group, organization, or practitioner etc. this is about record this flag is associated with.)
453     */
454    public Resource getSubjectTarget() { 
455      return this.subjectTarget;
456    }
457
458    /**
459     * @param value {@link #subject} 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, location, group, organization, or practitioner etc. this is about record this flag is associated with.)
460     */
461    public Flag setSubjectTarget(Resource value) { 
462      this.subjectTarget = value;
463      return this;
464    }
465
466    /**
467     * @return {@link #period} (The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.)
468     */
469    public Period getPeriod() { 
470      if (this.period == null)
471        if (Configuration.errorOnAutoCreate())
472          throw new Error("Attempt to auto-create Flag.period");
473        else if (Configuration.doAutoCreate())
474          this.period = new Period(); // cc
475      return this.period;
476    }
477
478    public boolean hasPeriod() { 
479      return this.period != null && !this.period.isEmpty();
480    }
481
482    /**
483     * @param value {@link #period} (The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.)
484     */
485    public Flag setPeriod(Period value) { 
486      this.period = value;
487      return this;
488    }
489
490    /**
491     * @return {@link #encounter} (This alert is only relevant during the encounter.)
492     */
493    public Reference getEncounter() { 
494      if (this.encounter == null)
495        if (Configuration.errorOnAutoCreate())
496          throw new Error("Attempt to auto-create Flag.encounter");
497        else if (Configuration.doAutoCreate())
498          this.encounter = new Reference(); // cc
499      return this.encounter;
500    }
501
502    public boolean hasEncounter() { 
503      return this.encounter != null && !this.encounter.isEmpty();
504    }
505
506    /**
507     * @param value {@link #encounter} (This alert is only relevant during the encounter.)
508     */
509    public Flag setEncounter(Reference value) { 
510      this.encounter = value;
511      return this;
512    }
513
514    /**
515     * @return {@link #encounter} 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. (This alert is only relevant during the encounter.)
516     */
517    public Encounter getEncounterTarget() { 
518      if (this.encounterTarget == null)
519        if (Configuration.errorOnAutoCreate())
520          throw new Error("Attempt to auto-create Flag.encounter");
521        else if (Configuration.doAutoCreate())
522          this.encounterTarget = new Encounter(); // aa
523      return this.encounterTarget;
524    }
525
526    /**
527     * @param value {@link #encounter} 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. (This alert is only relevant during the encounter.)
528     */
529    public Flag setEncounterTarget(Encounter value) { 
530      this.encounterTarget = value;
531      return this;
532    }
533
534    /**
535     * @return {@link #author} (The person, organization or device that created the flag.)
536     */
537    public Reference getAuthor() { 
538      if (this.author == null)
539        if (Configuration.errorOnAutoCreate())
540          throw new Error("Attempt to auto-create Flag.author");
541        else if (Configuration.doAutoCreate())
542          this.author = new Reference(); // cc
543      return this.author;
544    }
545
546    public boolean hasAuthor() { 
547      return this.author != null && !this.author.isEmpty();
548    }
549
550    /**
551     * @param value {@link #author} (The person, organization or device that created the flag.)
552     */
553    public Flag setAuthor(Reference value) { 
554      this.author = value;
555      return this;
556    }
557
558    /**
559     * @return {@link #author} 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 person, organization or device that created the flag.)
560     */
561    public Resource getAuthorTarget() { 
562      return this.authorTarget;
563    }
564
565    /**
566     * @param value {@link #author} 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 person, organization or device that created the flag.)
567     */
568    public Flag setAuthorTarget(Resource value) { 
569      this.authorTarget = value;
570      return this;
571    }
572
573      protected void listChildren(List<Property> children) {
574        super.listChildren(children);
575        children.add(new Property("identifier", "Identifier", "Business identifiers assigned to this flag by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
576        children.add(new Property("status", "code", "Supports basic workflow.", 0, 1, status));
577        children.add(new Property("category", "CodeableConcept", "Allows a flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.", 0, java.lang.Integer.MAX_VALUE, category));
578        children.add(new Property("code", "CodeableConcept", "The coded value or textual component of the flag to display to the user.", 0, 1, code));
579        children.add(new Property("subject", "Reference(Patient|Location|Group|Organization|Practitioner|PlanDefinition|Medication|Procedure)", "The patient, location, group, organization, or practitioner etc. this is about record this flag is associated with.", 0, 1, subject));
580        children.add(new Property("period", "Period", "The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.", 0, 1, period));
581        children.add(new Property("encounter", "Reference(Encounter)", "This alert is only relevant during the encounter.", 0, 1, encounter));
582        children.add(new Property("author", "Reference(Device|Organization|Patient|Practitioner)", "The person, organization or device that created the flag.", 0, 1, author));
583      }
584
585      @Override
586      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
587        switch (_hash) {
588        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifiers assigned to this flag by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
589        case -892481550: /*status*/  return new Property("status", "code", "Supports basic workflow.", 0, 1, status);
590        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Allows a flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.", 0, java.lang.Integer.MAX_VALUE, category);
591        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "The coded value or textual component of the flag to display to the user.", 0, 1, code);
592        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Location|Group|Organization|Practitioner|PlanDefinition|Medication|Procedure)", "The patient, location, group, organization, or practitioner etc. this is about record this flag is associated with.", 0, 1, subject);
593        case -991726143: /*period*/  return new Property("period", "Period", "The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.", 0, 1, period);
594        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "This alert is only relevant during the encounter.", 0, 1, encounter);
595        case -1406328437: /*author*/  return new Property("author", "Reference(Device|Organization|Patient|Practitioner)", "The person, organization or device that created the flag.", 0, 1, author);
596        default: return super.getNamedProperty(_hash, _name, _checkValid);
597        }
598
599      }
600
601      @Override
602      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
603        switch (hash) {
604        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
605        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<FlagStatus>
606        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
607        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
608        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
609        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
610        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
611        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
612        default: return super.getProperty(hash, name, checkValid);
613        }
614
615      }
616
617      @Override
618      public Base setProperty(int hash, String name, Base value) throws FHIRException {
619        switch (hash) {
620        case -1618432855: // identifier
621          this.getIdentifier().add(castToIdentifier(value)); // Identifier
622          return value;
623        case -892481550: // status
624          value = new FlagStatusEnumFactory().fromType(castToCode(value));
625          this.status = (Enumeration) value; // Enumeration<FlagStatus>
626          return value;
627        case 50511102: // category
628          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
629          return value;
630        case 3059181: // code
631          this.code = castToCodeableConcept(value); // CodeableConcept
632          return value;
633        case -1867885268: // subject
634          this.subject = castToReference(value); // Reference
635          return value;
636        case -991726143: // period
637          this.period = castToPeriod(value); // Period
638          return value;
639        case 1524132147: // encounter
640          this.encounter = castToReference(value); // Reference
641          return value;
642        case -1406328437: // author
643          this.author = castToReference(value); // Reference
644          return value;
645        default: return super.setProperty(hash, name, value);
646        }
647
648      }
649
650      @Override
651      public Base setProperty(String name, Base value) throws FHIRException {
652        if (name.equals("identifier")) {
653          this.getIdentifier().add(castToIdentifier(value));
654        } else if (name.equals("status")) {
655          value = new FlagStatusEnumFactory().fromType(castToCode(value));
656          this.status = (Enumeration) value; // Enumeration<FlagStatus>
657        } else if (name.equals("category")) {
658          this.getCategory().add(castToCodeableConcept(value));
659        } else if (name.equals("code")) {
660          this.code = castToCodeableConcept(value); // CodeableConcept
661        } else if (name.equals("subject")) {
662          this.subject = castToReference(value); // Reference
663        } else if (name.equals("period")) {
664          this.period = castToPeriod(value); // Period
665        } else if (name.equals("encounter")) {
666          this.encounter = castToReference(value); // Reference
667        } else if (name.equals("author")) {
668          this.author = castToReference(value); // Reference
669        } else
670          return super.setProperty(name, value);
671        return value;
672      }
673
674      @Override
675      public Base makeProperty(int hash, String name) throws FHIRException {
676        switch (hash) {
677        case -1618432855:  return addIdentifier(); 
678        case -892481550:  return getStatusElement();
679        case 50511102:  return addCategory(); 
680        case 3059181:  return getCode(); 
681        case -1867885268:  return getSubject(); 
682        case -991726143:  return getPeriod(); 
683        case 1524132147:  return getEncounter(); 
684        case -1406328437:  return getAuthor(); 
685        default: return super.makeProperty(hash, name);
686        }
687
688      }
689
690      @Override
691      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
692        switch (hash) {
693        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
694        case -892481550: /*status*/ return new String[] {"code"};
695        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
696        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
697        case -1867885268: /*subject*/ return new String[] {"Reference"};
698        case -991726143: /*period*/ return new String[] {"Period"};
699        case 1524132147: /*encounter*/ return new String[] {"Reference"};
700        case -1406328437: /*author*/ return new String[] {"Reference"};
701        default: return super.getTypesForProperty(hash, name);
702        }
703
704      }
705
706      @Override
707      public Base addChild(String name) throws FHIRException {
708        if (name.equals("identifier")) {
709          return addIdentifier();
710        }
711        else if (name.equals("status")) {
712          throw new FHIRException("Cannot call addChild on a primitive type Flag.status");
713        }
714        else if (name.equals("category")) {
715          return addCategory();
716        }
717        else if (name.equals("code")) {
718          this.code = new CodeableConcept();
719          return this.code;
720        }
721        else if (name.equals("subject")) {
722          this.subject = new Reference();
723          return this.subject;
724        }
725        else if (name.equals("period")) {
726          this.period = new Period();
727          return this.period;
728        }
729        else if (name.equals("encounter")) {
730          this.encounter = new Reference();
731          return this.encounter;
732        }
733        else if (name.equals("author")) {
734          this.author = new Reference();
735          return this.author;
736        }
737        else
738          return super.addChild(name);
739      }
740
741  public String fhirType() {
742    return "Flag";
743
744  }
745
746      public Flag copy() {
747        Flag dst = new Flag();
748        copyValues(dst);
749        if (identifier != null) {
750          dst.identifier = new ArrayList<Identifier>();
751          for (Identifier i : identifier)
752            dst.identifier.add(i.copy());
753        };
754        dst.status = status == null ? null : status.copy();
755        if (category != null) {
756          dst.category = new ArrayList<CodeableConcept>();
757          for (CodeableConcept i : category)
758            dst.category.add(i.copy());
759        };
760        dst.code = code == null ? null : code.copy();
761        dst.subject = subject == null ? null : subject.copy();
762        dst.period = period == null ? null : period.copy();
763        dst.encounter = encounter == null ? null : encounter.copy();
764        dst.author = author == null ? null : author.copy();
765        return dst;
766      }
767
768      protected Flag typedCopy() {
769        return copy();
770      }
771
772      @Override
773      public boolean equalsDeep(Base other_) {
774        if (!super.equalsDeep(other_))
775          return false;
776        if (!(other_ instanceof Flag))
777          return false;
778        Flag o = (Flag) other_;
779        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true)
780           && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) && compareDeep(period, o.period, true)
781           && compareDeep(encounter, o.encounter, true) && compareDeep(author, o.author, true);
782      }
783
784      @Override
785      public boolean equalsShallow(Base other_) {
786        if (!super.equalsShallow(other_))
787          return false;
788        if (!(other_ instanceof Flag))
789          return false;
790        Flag o = (Flag) other_;
791        return compareValues(status, o.status, true);
792      }
793
794      public boolean isEmpty() {
795        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, category
796          , code, subject, period, encounter, author);
797      }
798
799  @Override
800  public ResourceType getResourceType() {
801    return ResourceType.Flag;
802   }
803
804 /**
805   * Search parameter: <b>date</b>
806   * <p>
807   * Description: <b>Time period when flag is active</b><br>
808   * Type: <b>date</b><br>
809   * Path: <b>Flag.period</b><br>
810   * </p>
811   */
812  @SearchParamDefinition(name="date", path="Flag.period", description="Time period when flag is active", type="date" )
813  public static final String SP_DATE = "date";
814 /**
815   * <b>Fluent Client</b> search parameter constant for <b>date</b>
816   * <p>
817   * Description: <b>Time period when flag is active</b><br>
818   * Type: <b>date</b><br>
819   * Path: <b>Flag.period</b><br>
820   * </p>
821   */
822  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
823
824 /**
825   * Search parameter: <b>identifier</b>
826   * <p>
827   * Description: <b>Business identifier</b><br>
828   * Type: <b>token</b><br>
829   * Path: <b>Flag.identifier</b><br>
830   * </p>
831   */
832  @SearchParamDefinition(name="identifier", path="Flag.identifier", description="Business identifier", type="token" )
833  public static final String SP_IDENTIFIER = "identifier";
834 /**
835   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
836   * <p>
837   * Description: <b>Business identifier</b><br>
838   * Type: <b>token</b><br>
839   * Path: <b>Flag.identifier</b><br>
840   * </p>
841   */
842  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
843
844 /**
845   * Search parameter: <b>subject</b>
846   * <p>
847   * Description: <b>The identity of a subject to list flags for</b><br>
848   * Type: <b>reference</b><br>
849   * Path: <b>Flag.subject</b><br>
850   * </p>
851   */
852  @SearchParamDefinition(name="subject", path="Flag.subject", description="The identity of a subject to list flags for", type="reference", target={Group.class, Location.class, Medication.class, Organization.class, Patient.class, PlanDefinition.class, Practitioner.class, Procedure.class } )
853  public static final String SP_SUBJECT = "subject";
854 /**
855   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
856   * <p>
857   * Description: <b>The identity of a subject to list flags for</b><br>
858   * Type: <b>reference</b><br>
859   * Path: <b>Flag.subject</b><br>
860   * </p>
861   */
862  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
863
864/**
865   * Constant for fluent queries to be used to add include statements. Specifies
866   * the path value of "<b>Flag:subject</b>".
867   */
868  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Flag:subject").toLocked();
869
870 /**
871   * Search parameter: <b>patient</b>
872   * <p>
873   * Description: <b>The identity of a subject to list flags for</b><br>
874   * Type: <b>reference</b><br>
875   * Path: <b>Flag.subject</b><br>
876   * </p>
877   */
878  @SearchParamDefinition(name="patient", path="Flag.subject", description="The identity of a subject to list flags for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
879  public static final String SP_PATIENT = "patient";
880 /**
881   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
882   * <p>
883   * Description: <b>The identity of a subject to list flags for</b><br>
884   * Type: <b>reference</b><br>
885   * Path: <b>Flag.subject</b><br>
886   * </p>
887   */
888  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
889
890/**
891   * Constant for fluent queries to be used to add include statements. Specifies
892   * the path value of "<b>Flag:patient</b>".
893   */
894  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Flag:patient").toLocked();
895
896 /**
897   * Search parameter: <b>author</b>
898   * <p>
899   * Description: <b>Flag creator</b><br>
900   * Type: <b>reference</b><br>
901   * Path: <b>Flag.author</b><br>
902   * </p>
903   */
904  @SearchParamDefinition(name="author", path="Flag.author", description="Flag creator", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Organization.class, Patient.class, Practitioner.class } )
905  public static final String SP_AUTHOR = "author";
906 /**
907   * <b>Fluent Client</b> search parameter constant for <b>author</b>
908   * <p>
909   * Description: <b>Flag creator</b><br>
910   * Type: <b>reference</b><br>
911   * Path: <b>Flag.author</b><br>
912   * </p>
913   */
914  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
915
916/**
917   * Constant for fluent queries to be used to add include statements. Specifies
918   * the path value of "<b>Flag:author</b>".
919   */
920  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Flag:author").toLocked();
921
922 /**
923   * Search parameter: <b>encounter</b>
924   * <p>
925   * Description: <b>Alert relevant during encounter</b><br>
926   * Type: <b>reference</b><br>
927   * Path: <b>Flag.encounter</b><br>
928   * </p>
929   */
930  @SearchParamDefinition(name="encounter", path="Flag.encounter", description="Alert relevant during encounter", type="reference", target={Encounter.class } )
931  public static final String SP_ENCOUNTER = "encounter";
932 /**
933   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
934   * <p>
935   * Description: <b>Alert relevant during encounter</b><br>
936   * Type: <b>reference</b><br>
937   * Path: <b>Flag.encounter</b><br>
938   * </p>
939   */
940  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
941
942/**
943   * Constant for fluent queries to be used to add include statements. Specifies
944   * the path value of "<b>Flag:encounter</b>".
945   */
946  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Flag:encounter").toLocked();
947
948
949}
950