001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A report of inventory or stock items.
052 */
053@ResourceDef(name="InventoryReport", profile="http://hl7.org/fhir/StructureDefinition/InventoryReport")
054public class InventoryReport extends DomainResource {
055
056    public enum InventoryCountType {
057        /**
058         * The inventory report is a current absolute snapshot, i.e. it represents the quantities at hand.
059         */
060        SNAPSHOT, 
061        /**
062         * The inventory report is about the difference between a previous count and a current count, i.e. it represents the items that have been added/subtracted from inventory.
063         */
064        DIFFERENCE, 
065        /**
066         * added to help the parsers with the generic types
067         */
068        NULL;
069        public static InventoryCountType fromCode(String codeString) throws FHIRException {
070            if (codeString == null || "".equals(codeString))
071                return null;
072        if ("snapshot".equals(codeString))
073          return SNAPSHOT;
074        if ("difference".equals(codeString))
075          return DIFFERENCE;
076        if (Configuration.isAcceptInvalidEnums())
077          return null;
078        else
079          throw new FHIRException("Unknown InventoryCountType code '"+codeString+"'");
080        }
081        public String toCode() {
082          switch (this) {
083            case SNAPSHOT: return "snapshot";
084            case DIFFERENCE: return "difference";
085            default: return "?";
086          }
087        }
088        public String getSystem() {
089          switch (this) {
090            case SNAPSHOT: return "http://hl7.org/fhir/inventoryreport-counttype";
091            case DIFFERENCE: return "http://hl7.org/fhir/inventoryreport-counttype";
092            default: return "?";
093          }
094        }
095        public String getDefinition() {
096          switch (this) {
097            case SNAPSHOT: return "The inventory report is a current absolute snapshot, i.e. it represents the quantities at hand.";
098            case DIFFERENCE: return "The inventory report is about the difference between a previous count and a current count, i.e. it represents the items that have been added/subtracted from inventory.";
099            default: return "?";
100          }
101        }
102        public String getDisplay() {
103          switch (this) {
104            case SNAPSHOT: return "Snapshot";
105            case DIFFERENCE: return "Difference";
106            default: return "?";
107          }
108        }
109    }
110
111  public static class InventoryCountTypeEnumFactory implements EnumFactory<InventoryCountType> {
112    public InventoryCountType fromCode(String codeString) throws IllegalArgumentException {
113      if (codeString == null || "".equals(codeString))
114            if (codeString == null || "".equals(codeString))
115                return null;
116        if ("snapshot".equals(codeString))
117          return InventoryCountType.SNAPSHOT;
118        if ("difference".equals(codeString))
119          return InventoryCountType.DIFFERENCE;
120        throw new IllegalArgumentException("Unknown InventoryCountType code '"+codeString+"'");
121        }
122        public Enumeration<InventoryCountType> fromType(Base code) throws FHIRException {
123          if (code == null)
124            return null;
125          if (code.isEmpty())
126            return new Enumeration<InventoryCountType>(this);
127          String codeString = ((PrimitiveType) code).asStringValue();
128          if (codeString == null || "".equals(codeString))
129            return null;
130        if ("snapshot".equals(codeString))
131          return new Enumeration<InventoryCountType>(this, InventoryCountType.SNAPSHOT);
132        if ("difference".equals(codeString))
133          return new Enumeration<InventoryCountType>(this, InventoryCountType.DIFFERENCE);
134        throw new FHIRException("Unknown InventoryCountType code '"+codeString+"'");
135        }
136    public String toCode(InventoryCountType code) {
137      if (code == InventoryCountType.SNAPSHOT)
138        return "snapshot";
139      if (code == InventoryCountType.DIFFERENCE)
140        return "difference";
141      return "?";
142      }
143    public String toSystem(InventoryCountType code) {
144      return code.getSystem();
145      }
146    }
147
148    public enum InventoryReportStatus {
149        /**
150         * The existence of the report is registered, but it is still without content or only some preliminary content.
151         */
152        DRAFT, 
153        /**
154         * The inventory report has been requested but there is no data available.
155         */
156        REQUESTED, 
157        /**
158         * This report is submitted as current.
159         */
160        ACTIVE, 
161        /**
162         * The report has been withdrawn following a previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it.
163         */
164        ENTEREDINERROR, 
165        /**
166         * added to help the parsers with the generic types
167         */
168        NULL;
169        public static InventoryReportStatus fromCode(String codeString) throws FHIRException {
170            if (codeString == null || "".equals(codeString))
171                return null;
172        if ("draft".equals(codeString))
173          return DRAFT;
174        if ("requested".equals(codeString))
175          return REQUESTED;
176        if ("active".equals(codeString))
177          return ACTIVE;
178        if ("entered-in-error".equals(codeString))
179          return ENTEREDINERROR;
180        if (Configuration.isAcceptInvalidEnums())
181          return null;
182        else
183          throw new FHIRException("Unknown InventoryReportStatus code '"+codeString+"'");
184        }
185        public String toCode() {
186          switch (this) {
187            case DRAFT: return "draft";
188            case REQUESTED: return "requested";
189            case ACTIVE: return "active";
190            case ENTEREDINERROR: return "entered-in-error";
191            default: return "?";
192          }
193        }
194        public String getSystem() {
195          switch (this) {
196            case DRAFT: return "http://hl7.org/fhir/inventoryreport-status";
197            case REQUESTED: return "http://hl7.org/fhir/inventoryreport-status";
198            case ACTIVE: return "http://hl7.org/fhir/inventoryreport-status";
199            case ENTEREDINERROR: return "http://hl7.org/fhir/inventoryreport-status";
200            default: return "?";
201          }
202        }
203        public String getDefinition() {
204          switch (this) {
205            case DRAFT: return "The existence of the report is registered, but it is still without content or only some preliminary content.";
206            case REQUESTED: return "The inventory report has been requested but there is no data available.";
207            case ACTIVE: return "This report is submitted as current.";
208            case ENTEREDINERROR: return "The report has been withdrawn following a previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it.";
209            default: return "?";
210          }
211        }
212        public String getDisplay() {
213          switch (this) {
214            case DRAFT: return "Draft";
215            case REQUESTED: return "Requested";
216            case ACTIVE: return "Active";
217            case ENTEREDINERROR: return "Entered in Error";
218            default: return "?";
219          }
220        }
221    }
222
223  public static class InventoryReportStatusEnumFactory implements EnumFactory<InventoryReportStatus> {
224    public InventoryReportStatus fromCode(String codeString) throws IllegalArgumentException {
225      if (codeString == null || "".equals(codeString))
226            if (codeString == null || "".equals(codeString))
227                return null;
228        if ("draft".equals(codeString))
229          return InventoryReportStatus.DRAFT;
230        if ("requested".equals(codeString))
231          return InventoryReportStatus.REQUESTED;
232        if ("active".equals(codeString))
233          return InventoryReportStatus.ACTIVE;
234        if ("entered-in-error".equals(codeString))
235          return InventoryReportStatus.ENTEREDINERROR;
236        throw new IllegalArgumentException("Unknown InventoryReportStatus code '"+codeString+"'");
237        }
238        public Enumeration<InventoryReportStatus> fromType(Base code) throws FHIRException {
239          if (code == null)
240            return null;
241          if (code.isEmpty())
242            return new Enumeration<InventoryReportStatus>(this);
243          String codeString = ((PrimitiveType) code).asStringValue();
244          if (codeString == null || "".equals(codeString))
245            return null;
246        if ("draft".equals(codeString))
247          return new Enumeration<InventoryReportStatus>(this, InventoryReportStatus.DRAFT);
248        if ("requested".equals(codeString))
249          return new Enumeration<InventoryReportStatus>(this, InventoryReportStatus.REQUESTED);
250        if ("active".equals(codeString))
251          return new Enumeration<InventoryReportStatus>(this, InventoryReportStatus.ACTIVE);
252        if ("entered-in-error".equals(codeString))
253          return new Enumeration<InventoryReportStatus>(this, InventoryReportStatus.ENTEREDINERROR);
254        throw new FHIRException("Unknown InventoryReportStatus code '"+codeString+"'");
255        }
256    public String toCode(InventoryReportStatus code) {
257      if (code == InventoryReportStatus.DRAFT)
258        return "draft";
259      if (code == InventoryReportStatus.REQUESTED)
260        return "requested";
261      if (code == InventoryReportStatus.ACTIVE)
262        return "active";
263      if (code == InventoryReportStatus.ENTEREDINERROR)
264        return "entered-in-error";
265      return "?";
266      }
267    public String toSystem(InventoryReportStatus code) {
268      return code.getSystem();
269      }
270    }
271
272    @Block()
273    public static class InventoryReportInventoryListingComponent extends BackboneElement implements IBaseBackboneElement {
274        /**
275         * Location of the inventory items.
276         */
277        @Child(name = "location", type = {Location.class}, order=1, min=0, max=1, modifier=false, summary=false)
278        @Description(shortDefinition="Location of the inventory items", formalDefinition="Location of the inventory items." )
279        protected Reference location;
280
281        /**
282         * The status of the items.
283         */
284        @Child(name = "itemStatus", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
285        @Description(shortDefinition="The status of the items", formalDefinition="The status of the items." )
286        protected CodeableConcept itemStatus;
287
288        /**
289         * The date and time when the items were counted.
290         */
291        @Child(name = "countingDateTime", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
292        @Description(shortDefinition="The date and time when the items were counted", formalDefinition="The date and time when the items were counted." )
293        protected DateTimeType countingDateTime;
294
295        /**
296         * The item or items in this listing.
297         */
298        @Child(name = "items", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
299        @Description(shortDefinition="The item or items in this listing", formalDefinition="The item or items in this listing." )
300        protected List<InventoryReportInventoryListingItemsComponent> items;
301
302        private static final long serialVersionUID = -847152550L;
303
304    /**
305     * Constructor
306     */
307      public InventoryReportInventoryListingComponent() {
308        super();
309      }
310
311        /**
312         * @return {@link #location} (Location of the inventory items.)
313         */
314        public Reference getLocation() { 
315          if (this.location == null)
316            if (Configuration.errorOnAutoCreate())
317              throw new Error("Attempt to auto-create InventoryReportInventoryListingComponent.location");
318            else if (Configuration.doAutoCreate())
319              this.location = new Reference(); // cc
320          return this.location;
321        }
322
323        public boolean hasLocation() { 
324          return this.location != null && !this.location.isEmpty();
325        }
326
327        /**
328         * @param value {@link #location} (Location of the inventory items.)
329         */
330        public InventoryReportInventoryListingComponent setLocation(Reference value) { 
331          this.location = value;
332          return this;
333        }
334
335        /**
336         * @return {@link #itemStatus} (The status of the items.)
337         */
338        public CodeableConcept getItemStatus() { 
339          if (this.itemStatus == null)
340            if (Configuration.errorOnAutoCreate())
341              throw new Error("Attempt to auto-create InventoryReportInventoryListingComponent.itemStatus");
342            else if (Configuration.doAutoCreate())
343              this.itemStatus = new CodeableConcept(); // cc
344          return this.itemStatus;
345        }
346
347        public boolean hasItemStatus() { 
348          return this.itemStatus != null && !this.itemStatus.isEmpty();
349        }
350
351        /**
352         * @param value {@link #itemStatus} (The status of the items.)
353         */
354        public InventoryReportInventoryListingComponent setItemStatus(CodeableConcept value) { 
355          this.itemStatus = value;
356          return this;
357        }
358
359        /**
360         * @return {@link #countingDateTime} (The date and time when the items were counted.). This is the underlying object with id, value and extensions. The accessor "getCountingDateTime" gives direct access to the value
361         */
362        public DateTimeType getCountingDateTimeElement() { 
363          if (this.countingDateTime == null)
364            if (Configuration.errorOnAutoCreate())
365              throw new Error("Attempt to auto-create InventoryReportInventoryListingComponent.countingDateTime");
366            else if (Configuration.doAutoCreate())
367              this.countingDateTime = new DateTimeType(); // bb
368          return this.countingDateTime;
369        }
370
371        public boolean hasCountingDateTimeElement() { 
372          return this.countingDateTime != null && !this.countingDateTime.isEmpty();
373        }
374
375        public boolean hasCountingDateTime() { 
376          return this.countingDateTime != null && !this.countingDateTime.isEmpty();
377        }
378
379        /**
380         * @param value {@link #countingDateTime} (The date and time when the items were counted.). This is the underlying object with id, value and extensions. The accessor "getCountingDateTime" gives direct access to the value
381         */
382        public InventoryReportInventoryListingComponent setCountingDateTimeElement(DateTimeType value) { 
383          this.countingDateTime = value;
384          return this;
385        }
386
387        /**
388         * @return The date and time when the items were counted.
389         */
390        public Date getCountingDateTime() { 
391          return this.countingDateTime == null ? null : this.countingDateTime.getValue();
392        }
393
394        /**
395         * @param value The date and time when the items were counted.
396         */
397        public InventoryReportInventoryListingComponent setCountingDateTime(Date value) { 
398          if (value == null)
399            this.countingDateTime = null;
400          else {
401            if (this.countingDateTime == null)
402              this.countingDateTime = new DateTimeType();
403            this.countingDateTime.setValue(value);
404          }
405          return this;
406        }
407
408        /**
409         * @return {@link #items} (The item or items in this listing.)
410         */
411        public List<InventoryReportInventoryListingItemsComponent> getItems() { 
412          if (this.items == null)
413            this.items = new ArrayList<InventoryReportInventoryListingItemsComponent>();
414          return this.items;
415        }
416
417        /**
418         * @return Returns a reference to <code>this</code> for easy method chaining
419         */
420        public InventoryReportInventoryListingComponent setItems(List<InventoryReportInventoryListingItemsComponent> theItems) { 
421          this.items = theItems;
422          return this;
423        }
424
425        public boolean hasItems() { 
426          if (this.items == null)
427            return false;
428          for (InventoryReportInventoryListingItemsComponent item : this.items)
429            if (!item.isEmpty())
430              return true;
431          return false;
432        }
433
434        public InventoryReportInventoryListingItemsComponent addItems() { //3
435          InventoryReportInventoryListingItemsComponent t = new InventoryReportInventoryListingItemsComponent();
436          if (this.items == null)
437            this.items = new ArrayList<InventoryReportInventoryListingItemsComponent>();
438          this.items.add(t);
439          return t;
440        }
441
442        public InventoryReportInventoryListingComponent addItems(InventoryReportInventoryListingItemsComponent t) { //3
443          if (t == null)
444            return this;
445          if (this.items == null)
446            this.items = new ArrayList<InventoryReportInventoryListingItemsComponent>();
447          this.items.add(t);
448          return this;
449        }
450
451        /**
452         * @return The first repetition of repeating field {@link #items}, creating it if it does not already exist {3}
453         */
454        public InventoryReportInventoryListingItemsComponent getItemsFirstRep() { 
455          if (getItems().isEmpty()) {
456            addItems();
457          }
458          return getItems().get(0);
459        }
460
461        protected void listChildren(List<Property> children) {
462          super.listChildren(children);
463          children.add(new Property("location", "Reference(Location)", "Location of the inventory items.", 0, 1, location));
464          children.add(new Property("itemStatus", "CodeableConcept", "The status of the items.", 0, 1, itemStatus));
465          children.add(new Property("countingDateTime", "dateTime", "The date and time when the items were counted.", 0, 1, countingDateTime));
466          children.add(new Property("items", "", "The item or items in this listing.", 0, java.lang.Integer.MAX_VALUE, items));
467        }
468
469        @Override
470        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
471          switch (_hash) {
472          case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "Location of the inventory items.", 0, 1, location);
473          case 1999789285: /*itemStatus*/  return new Property("itemStatus", "CodeableConcept", "The status of the items.", 0, 1, itemStatus);
474          case -2075203282: /*countingDateTime*/  return new Property("countingDateTime", "dateTime", "The date and time when the items were counted.", 0, 1, countingDateTime);
475          case 100526016: /*items*/  return new Property("items", "", "The item or items in this listing.", 0, java.lang.Integer.MAX_VALUE, items);
476          default: return super.getNamedProperty(_hash, _name, _checkValid);
477          }
478
479        }
480
481      @Override
482      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
483        switch (hash) {
484        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
485        case 1999789285: /*itemStatus*/ return this.itemStatus == null ? new Base[0] : new Base[] {this.itemStatus}; // CodeableConcept
486        case -2075203282: /*countingDateTime*/ return this.countingDateTime == null ? new Base[0] : new Base[] {this.countingDateTime}; // DateTimeType
487        case 100526016: /*items*/ return this.items == null ? new Base[0] : this.items.toArray(new Base[this.items.size()]); // InventoryReportInventoryListingItemsComponent
488        default: return super.getProperty(hash, name, checkValid);
489        }
490
491      }
492
493      @Override
494      public Base setProperty(int hash, String name, Base value) throws FHIRException {
495        switch (hash) {
496        case 1901043637: // location
497          this.location = TypeConvertor.castToReference(value); // Reference
498          return value;
499        case 1999789285: // itemStatus
500          this.itemStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
501          return value;
502        case -2075203282: // countingDateTime
503          this.countingDateTime = TypeConvertor.castToDateTime(value); // DateTimeType
504          return value;
505        case 100526016: // items
506          this.getItems().add((InventoryReportInventoryListingItemsComponent) value); // InventoryReportInventoryListingItemsComponent
507          return value;
508        default: return super.setProperty(hash, name, value);
509        }
510
511      }
512
513      @Override
514      public Base setProperty(String name, Base value) throws FHIRException {
515        if (name.equals("location")) {
516          this.location = TypeConvertor.castToReference(value); // Reference
517        } else if (name.equals("itemStatus")) {
518          this.itemStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
519        } else if (name.equals("countingDateTime")) {
520          this.countingDateTime = TypeConvertor.castToDateTime(value); // DateTimeType
521        } else if (name.equals("items")) {
522          this.getItems().add((InventoryReportInventoryListingItemsComponent) value);
523        } else
524          return super.setProperty(name, value);
525        return value;
526      }
527
528      @Override
529      public Base makeProperty(int hash, String name) throws FHIRException {
530        switch (hash) {
531        case 1901043637:  return getLocation();
532        case 1999789285:  return getItemStatus();
533        case -2075203282:  return getCountingDateTimeElement();
534        case 100526016:  return addItems(); 
535        default: return super.makeProperty(hash, name);
536        }
537
538      }
539
540      @Override
541      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
542        switch (hash) {
543        case 1901043637: /*location*/ return new String[] {"Reference"};
544        case 1999789285: /*itemStatus*/ return new String[] {"CodeableConcept"};
545        case -2075203282: /*countingDateTime*/ return new String[] {"dateTime"};
546        case 100526016: /*items*/ return new String[] {};
547        default: return super.getTypesForProperty(hash, name);
548        }
549
550      }
551
552      @Override
553      public Base addChild(String name) throws FHIRException {
554        if (name.equals("location")) {
555          this.location = new Reference();
556          return this.location;
557        }
558        else if (name.equals("itemStatus")) {
559          this.itemStatus = new CodeableConcept();
560          return this.itemStatus;
561        }
562        else if (name.equals("countingDateTime")) {
563          throw new FHIRException("Cannot call addChild on a primitive type InventoryReport.inventoryListing.countingDateTime");
564        }
565        else if (name.equals("items")) {
566          return addItems();
567        }
568        else
569          return super.addChild(name);
570      }
571
572      public InventoryReportInventoryListingComponent copy() {
573        InventoryReportInventoryListingComponent dst = new InventoryReportInventoryListingComponent();
574        copyValues(dst);
575        return dst;
576      }
577
578      public void copyValues(InventoryReportInventoryListingComponent dst) {
579        super.copyValues(dst);
580        dst.location = location == null ? null : location.copy();
581        dst.itemStatus = itemStatus == null ? null : itemStatus.copy();
582        dst.countingDateTime = countingDateTime == null ? null : countingDateTime.copy();
583        if (items != null) {
584          dst.items = new ArrayList<InventoryReportInventoryListingItemsComponent>();
585          for (InventoryReportInventoryListingItemsComponent i : items)
586            dst.items.add(i.copy());
587        };
588      }
589
590      @Override
591      public boolean equalsDeep(Base other_) {
592        if (!super.equalsDeep(other_))
593          return false;
594        if (!(other_ instanceof InventoryReportInventoryListingComponent))
595          return false;
596        InventoryReportInventoryListingComponent o = (InventoryReportInventoryListingComponent) other_;
597        return compareDeep(location, o.location, true) && compareDeep(itemStatus, o.itemStatus, true) && compareDeep(countingDateTime, o.countingDateTime, true)
598           && compareDeep(items, o.items, true);
599      }
600
601      @Override
602      public boolean equalsShallow(Base other_) {
603        if (!super.equalsShallow(other_))
604          return false;
605        if (!(other_ instanceof InventoryReportInventoryListingComponent))
606          return false;
607        InventoryReportInventoryListingComponent o = (InventoryReportInventoryListingComponent) other_;
608        return compareValues(countingDateTime, o.countingDateTime, true);
609      }
610
611      public boolean isEmpty() {
612        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(location, itemStatus, countingDateTime
613          , items);
614      }
615
616  public String fhirType() {
617    return "InventoryReport.inventoryListing";
618
619  }
620
621  }
622
623    @Block()
624    public static class InventoryReportInventoryListingItemsComponent extends BackboneElement implements IBaseBackboneElement {
625        /**
626         * The category of the item or items.
627         */
628        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
629        @Description(shortDefinition="The category of the item or items", formalDefinition="The category of the item or items." )
630        protected CodeableConcept category;
631
632        /**
633         * The quantity of the item or items.
634         */
635        @Child(name = "quantity", type = {Quantity.class}, order=2, min=1, max=1, modifier=false, summary=true)
636        @Description(shortDefinition="The quantity of the item or items", formalDefinition="The quantity of the item or items." )
637        protected Quantity quantity;
638
639        /**
640         * The code or reference to the item type.
641         */
642        @Child(name = "item", type = {CodeableReference.class}, order=3, min=1, max=1, modifier=false, summary=true)
643        @Description(shortDefinition="The code or reference to the item type", formalDefinition="The code or reference to the item type." )
644        protected CodeableReference item;
645
646        /**
647         * The lot number of the item or items.
648         */
649        @Child(name = "lot", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
650        @Description(shortDefinition="The lot number of the item or items", formalDefinition="The lot number of the item or items." )
651        protected StringType lot;
652
653        /**
654         * The serial number of the item.
655         */
656        @Child(name = "serial", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
657        @Description(shortDefinition="The serial number of the item", formalDefinition="The serial number of the item." )
658        protected StringType serial;
659
660        /**
661         * The expiry date of the item or items.
662         */
663        @Child(name = "expiry", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
664        @Description(shortDefinition="The expiry date of the item or items", formalDefinition="The expiry date of the item or items." )
665        protected DateTimeType expiry;
666
667        /**
668         * The manufacturingDate of the item or items.
669         */
670        @Child(name = "manufacturingDate", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
671        @Description(shortDefinition="The manufacturingDate of the item or items", formalDefinition="The manufacturingDate of the item or items." )
672        protected DateTimeType manufacturingDate;
673
674        private static final long serialVersionUID = -848736270L;
675
676    /**
677     * Constructor
678     */
679      public InventoryReportInventoryListingItemsComponent() {
680        super();
681      }
682
683    /**
684     * Constructor
685     */
686      public InventoryReportInventoryListingItemsComponent(Quantity quantity, CodeableReference item) {
687        super();
688        this.setQuantity(quantity);
689        this.setItem(item);
690      }
691
692        /**
693         * @return {@link #category} (The category of the item or items.)
694         */
695        public CodeableConcept getCategory() { 
696          if (this.category == null)
697            if (Configuration.errorOnAutoCreate())
698              throw new Error("Attempt to auto-create InventoryReportInventoryListingItemsComponent.category");
699            else if (Configuration.doAutoCreate())
700              this.category = new CodeableConcept(); // cc
701          return this.category;
702        }
703
704        public boolean hasCategory() { 
705          return this.category != null && !this.category.isEmpty();
706        }
707
708        /**
709         * @param value {@link #category} (The category of the item or items.)
710         */
711        public InventoryReportInventoryListingItemsComponent setCategory(CodeableConcept value) { 
712          this.category = value;
713          return this;
714        }
715
716        /**
717         * @return {@link #quantity} (The quantity of the item or items.)
718         */
719        public Quantity getQuantity() { 
720          if (this.quantity == null)
721            if (Configuration.errorOnAutoCreate())
722              throw new Error("Attempt to auto-create InventoryReportInventoryListingItemsComponent.quantity");
723            else if (Configuration.doAutoCreate())
724              this.quantity = new Quantity(); // cc
725          return this.quantity;
726        }
727
728        public boolean hasQuantity() { 
729          return this.quantity != null && !this.quantity.isEmpty();
730        }
731
732        /**
733         * @param value {@link #quantity} (The quantity of the item or items.)
734         */
735        public InventoryReportInventoryListingItemsComponent setQuantity(Quantity value) { 
736          this.quantity = value;
737          return this;
738        }
739
740        /**
741         * @return {@link #item} (The code or reference to the item type.)
742         */
743        public CodeableReference getItem() { 
744          if (this.item == null)
745            if (Configuration.errorOnAutoCreate())
746              throw new Error("Attempt to auto-create InventoryReportInventoryListingItemsComponent.item");
747            else if (Configuration.doAutoCreate())
748              this.item = new CodeableReference(); // cc
749          return this.item;
750        }
751
752        public boolean hasItem() { 
753          return this.item != null && !this.item.isEmpty();
754        }
755
756        /**
757         * @param value {@link #item} (The code or reference to the item type.)
758         */
759        public InventoryReportInventoryListingItemsComponent setItem(CodeableReference value) { 
760          this.item = value;
761          return this;
762        }
763
764        /**
765         * @return {@link #lot} (The lot number of the item or items.). This is the underlying object with id, value and extensions. The accessor "getLot" gives direct access to the value
766         */
767        public StringType getLotElement() { 
768          if (this.lot == null)
769            if (Configuration.errorOnAutoCreate())
770              throw new Error("Attempt to auto-create InventoryReportInventoryListingItemsComponent.lot");
771            else if (Configuration.doAutoCreate())
772              this.lot = new StringType(); // bb
773          return this.lot;
774        }
775
776        public boolean hasLotElement() { 
777          return this.lot != null && !this.lot.isEmpty();
778        }
779
780        public boolean hasLot() { 
781          return this.lot != null && !this.lot.isEmpty();
782        }
783
784        /**
785         * @param value {@link #lot} (The lot number of the item or items.). This is the underlying object with id, value and extensions. The accessor "getLot" gives direct access to the value
786         */
787        public InventoryReportInventoryListingItemsComponent setLotElement(StringType value) { 
788          this.lot = value;
789          return this;
790        }
791
792        /**
793         * @return The lot number of the item or items.
794         */
795        public String getLot() { 
796          return this.lot == null ? null : this.lot.getValue();
797        }
798
799        /**
800         * @param value The lot number of the item or items.
801         */
802        public InventoryReportInventoryListingItemsComponent setLot(String value) { 
803          if (Utilities.noString(value))
804            this.lot = null;
805          else {
806            if (this.lot == null)
807              this.lot = new StringType();
808            this.lot.setValue(value);
809          }
810          return this;
811        }
812
813        /**
814         * @return {@link #serial} (The serial number of the item.). This is the underlying object with id, value and extensions. The accessor "getSerial" gives direct access to the value
815         */
816        public StringType getSerialElement() { 
817          if (this.serial == null)
818            if (Configuration.errorOnAutoCreate())
819              throw new Error("Attempt to auto-create InventoryReportInventoryListingItemsComponent.serial");
820            else if (Configuration.doAutoCreate())
821              this.serial = new StringType(); // bb
822          return this.serial;
823        }
824
825        public boolean hasSerialElement() { 
826          return this.serial != null && !this.serial.isEmpty();
827        }
828
829        public boolean hasSerial() { 
830          return this.serial != null && !this.serial.isEmpty();
831        }
832
833        /**
834         * @param value {@link #serial} (The serial number of the item.). This is the underlying object with id, value and extensions. The accessor "getSerial" gives direct access to the value
835         */
836        public InventoryReportInventoryListingItemsComponent setSerialElement(StringType value) { 
837          this.serial = value;
838          return this;
839        }
840
841        /**
842         * @return The serial number of the item.
843         */
844        public String getSerial() { 
845          return this.serial == null ? null : this.serial.getValue();
846        }
847
848        /**
849         * @param value The serial number of the item.
850         */
851        public InventoryReportInventoryListingItemsComponent setSerial(String value) { 
852          if (Utilities.noString(value))
853            this.serial = null;
854          else {
855            if (this.serial == null)
856              this.serial = new StringType();
857            this.serial.setValue(value);
858          }
859          return this;
860        }
861
862        /**
863         * @return {@link #expiry} (The expiry date of the item or items.). This is the underlying object with id, value and extensions. The accessor "getExpiry" gives direct access to the value
864         */
865        public DateTimeType getExpiryElement() { 
866          if (this.expiry == null)
867            if (Configuration.errorOnAutoCreate())
868              throw new Error("Attempt to auto-create InventoryReportInventoryListingItemsComponent.expiry");
869            else if (Configuration.doAutoCreate())
870              this.expiry = new DateTimeType(); // bb
871          return this.expiry;
872        }
873
874        public boolean hasExpiryElement() { 
875          return this.expiry != null && !this.expiry.isEmpty();
876        }
877
878        public boolean hasExpiry() { 
879          return this.expiry != null && !this.expiry.isEmpty();
880        }
881
882        /**
883         * @param value {@link #expiry} (The expiry date of the item or items.). This is the underlying object with id, value and extensions. The accessor "getExpiry" gives direct access to the value
884         */
885        public InventoryReportInventoryListingItemsComponent setExpiryElement(DateTimeType value) { 
886          this.expiry = value;
887          return this;
888        }
889
890        /**
891         * @return The expiry date of the item or items.
892         */
893        public Date getExpiry() { 
894          return this.expiry == null ? null : this.expiry.getValue();
895        }
896
897        /**
898         * @param value The expiry date of the item or items.
899         */
900        public InventoryReportInventoryListingItemsComponent setExpiry(Date value) { 
901          if (value == null)
902            this.expiry = null;
903          else {
904            if (this.expiry == null)
905              this.expiry = new DateTimeType();
906            this.expiry.setValue(value);
907          }
908          return this;
909        }
910
911        /**
912         * @return {@link #manufacturingDate} (The manufacturingDate of the item or items.). This is the underlying object with id, value and extensions. The accessor "getManufacturingDate" gives direct access to the value
913         */
914        public DateTimeType getManufacturingDateElement() { 
915          if (this.manufacturingDate == null)
916            if (Configuration.errorOnAutoCreate())
917              throw new Error("Attempt to auto-create InventoryReportInventoryListingItemsComponent.manufacturingDate");
918            else if (Configuration.doAutoCreate())
919              this.manufacturingDate = new DateTimeType(); // bb
920          return this.manufacturingDate;
921        }
922
923        public boolean hasManufacturingDateElement() { 
924          return this.manufacturingDate != null && !this.manufacturingDate.isEmpty();
925        }
926
927        public boolean hasManufacturingDate() { 
928          return this.manufacturingDate != null && !this.manufacturingDate.isEmpty();
929        }
930
931        /**
932         * @param value {@link #manufacturingDate} (The manufacturingDate of the item or items.). This is the underlying object with id, value and extensions. The accessor "getManufacturingDate" gives direct access to the value
933         */
934        public InventoryReportInventoryListingItemsComponent setManufacturingDateElement(DateTimeType value) { 
935          this.manufacturingDate = value;
936          return this;
937        }
938
939        /**
940         * @return The manufacturingDate of the item or items.
941         */
942        public Date getManufacturingDate() { 
943          return this.manufacturingDate == null ? null : this.manufacturingDate.getValue();
944        }
945
946        /**
947         * @param value The manufacturingDate of the item or items.
948         */
949        public InventoryReportInventoryListingItemsComponent setManufacturingDate(Date value) { 
950          if (value == null)
951            this.manufacturingDate = null;
952          else {
953            if (this.manufacturingDate == null)
954              this.manufacturingDate = new DateTimeType();
955            this.manufacturingDate.setValue(value);
956          }
957          return this;
958        }
959
960        protected void listChildren(List<Property> children) {
961          super.listChildren(children);
962          children.add(new Property("category", "CodeableConcept", "The category of the item or items.", 0, 1, category));
963          children.add(new Property("quantity", "Quantity", "The quantity of the item or items.", 0, 1, quantity));
964          children.add(new Property("item", "CodeableReference(Device|Medication)", "The code or reference to the item type.", 0, 1, item));
965          children.add(new Property("lot", "string", "The lot number of the item or items.", 0, 1, lot));
966          children.add(new Property("serial", "string", "The serial number of the item.", 0, 1, serial));
967          children.add(new Property("expiry", "dateTime", "The expiry date of the item or items.", 0, 1, expiry));
968          children.add(new Property("manufacturingDate", "dateTime", "The manufacturingDate of the item or items.", 0, 1, manufacturingDate));
969        }
970
971        @Override
972        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
973          switch (_hash) {
974          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The category of the item or items.", 0, 1, category);
975          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The quantity of the item or items.", 0, 1, quantity);
976          case 3242771: /*item*/  return new Property("item", "CodeableReference(Device|Medication)", "The code or reference to the item type.", 0, 1, item);
977          case 107345: /*lot*/  return new Property("lot", "string", "The lot number of the item or items.", 0, 1, lot);
978          case -905839116: /*serial*/  return new Property("serial", "string", "The serial number of the item.", 0, 1, serial);
979          case -1289159373: /*expiry*/  return new Property("expiry", "dateTime", "The expiry date of the item or items.", 0, 1, expiry);
980          case 1492515340: /*manufacturingDate*/  return new Property("manufacturingDate", "dateTime", "The manufacturingDate of the item or items.", 0, 1, manufacturingDate);
981          default: return super.getNamedProperty(_hash, _name, _checkValid);
982          }
983
984        }
985
986      @Override
987      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
988        switch (hash) {
989        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
990        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
991        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // CodeableReference
992        case 107345: /*lot*/ return this.lot == null ? new Base[0] : new Base[] {this.lot}; // StringType
993        case -905839116: /*serial*/ return this.serial == null ? new Base[0] : new Base[] {this.serial}; // StringType
994        case -1289159373: /*expiry*/ return this.expiry == null ? new Base[0] : new Base[] {this.expiry}; // DateTimeType
995        case 1492515340: /*manufacturingDate*/ return this.manufacturingDate == null ? new Base[0] : new Base[] {this.manufacturingDate}; // DateTimeType
996        default: return super.getProperty(hash, name, checkValid);
997        }
998
999      }
1000
1001      @Override
1002      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1003        switch (hash) {
1004        case 50511102: // category
1005          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1006          return value;
1007        case -1285004149: // quantity
1008          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1009          return value;
1010        case 3242771: // item
1011          this.item = TypeConvertor.castToCodeableReference(value); // CodeableReference
1012          return value;
1013        case 107345: // lot
1014          this.lot = TypeConvertor.castToString(value); // StringType
1015          return value;
1016        case -905839116: // serial
1017          this.serial = TypeConvertor.castToString(value); // StringType
1018          return value;
1019        case -1289159373: // expiry
1020          this.expiry = TypeConvertor.castToDateTime(value); // DateTimeType
1021          return value;
1022        case 1492515340: // manufacturingDate
1023          this.manufacturingDate = TypeConvertor.castToDateTime(value); // DateTimeType
1024          return value;
1025        default: return super.setProperty(hash, name, value);
1026        }
1027
1028      }
1029
1030      @Override
1031      public Base setProperty(String name, Base value) throws FHIRException {
1032        if (name.equals("category")) {
1033          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1034        } else if (name.equals("quantity")) {
1035          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1036        } else if (name.equals("item")) {
1037          this.item = TypeConvertor.castToCodeableReference(value); // CodeableReference
1038        } else if (name.equals("lot")) {
1039          this.lot = TypeConvertor.castToString(value); // StringType
1040        } else if (name.equals("serial")) {
1041          this.serial = TypeConvertor.castToString(value); // StringType
1042        } else if (name.equals("expiry")) {
1043          this.expiry = TypeConvertor.castToDateTime(value); // DateTimeType
1044        } else if (name.equals("manufacturingDate")) {
1045          this.manufacturingDate = TypeConvertor.castToDateTime(value); // DateTimeType
1046        } else
1047          return super.setProperty(name, value);
1048        return value;
1049      }
1050
1051      @Override
1052      public Base makeProperty(int hash, String name) throws FHIRException {
1053        switch (hash) {
1054        case 50511102:  return getCategory();
1055        case -1285004149:  return getQuantity();
1056        case 3242771:  return getItem();
1057        case 107345:  return getLotElement();
1058        case -905839116:  return getSerialElement();
1059        case -1289159373:  return getExpiryElement();
1060        case 1492515340:  return getManufacturingDateElement();
1061        default: return super.makeProperty(hash, name);
1062        }
1063
1064      }
1065
1066      @Override
1067      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1068        switch (hash) {
1069        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1070        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1071        case 3242771: /*item*/ return new String[] {"CodeableReference"};
1072        case 107345: /*lot*/ return new String[] {"string"};
1073        case -905839116: /*serial*/ return new String[] {"string"};
1074        case -1289159373: /*expiry*/ return new String[] {"dateTime"};
1075        case 1492515340: /*manufacturingDate*/ return new String[] {"dateTime"};
1076        default: return super.getTypesForProperty(hash, name);
1077        }
1078
1079      }
1080
1081      @Override
1082      public Base addChild(String name) throws FHIRException {
1083        if (name.equals("category")) {
1084          this.category = new CodeableConcept();
1085          return this.category;
1086        }
1087        else if (name.equals("quantity")) {
1088          this.quantity = new Quantity();
1089          return this.quantity;
1090        }
1091        else if (name.equals("item")) {
1092          this.item = new CodeableReference();
1093          return this.item;
1094        }
1095        else if (name.equals("lot")) {
1096          throw new FHIRException("Cannot call addChild on a primitive type InventoryReport.inventoryListing.items.lot");
1097        }
1098        else if (name.equals("serial")) {
1099          throw new FHIRException("Cannot call addChild on a primitive type InventoryReport.inventoryListing.items.serial");
1100        }
1101        else if (name.equals("expiry")) {
1102          throw new FHIRException("Cannot call addChild on a primitive type InventoryReport.inventoryListing.items.expiry");
1103        }
1104        else if (name.equals("manufacturingDate")) {
1105          throw new FHIRException("Cannot call addChild on a primitive type InventoryReport.inventoryListing.items.manufacturingDate");
1106        }
1107        else
1108          return super.addChild(name);
1109      }
1110
1111      public InventoryReportInventoryListingItemsComponent copy() {
1112        InventoryReportInventoryListingItemsComponent dst = new InventoryReportInventoryListingItemsComponent();
1113        copyValues(dst);
1114        return dst;
1115      }
1116
1117      public void copyValues(InventoryReportInventoryListingItemsComponent dst) {
1118        super.copyValues(dst);
1119        dst.category = category == null ? null : category.copy();
1120        dst.quantity = quantity == null ? null : quantity.copy();
1121        dst.item = item == null ? null : item.copy();
1122        dst.lot = lot == null ? null : lot.copy();
1123        dst.serial = serial == null ? null : serial.copy();
1124        dst.expiry = expiry == null ? null : expiry.copy();
1125        dst.manufacturingDate = manufacturingDate == null ? null : manufacturingDate.copy();
1126      }
1127
1128      @Override
1129      public boolean equalsDeep(Base other_) {
1130        if (!super.equalsDeep(other_))
1131          return false;
1132        if (!(other_ instanceof InventoryReportInventoryListingItemsComponent))
1133          return false;
1134        InventoryReportInventoryListingItemsComponent o = (InventoryReportInventoryListingItemsComponent) other_;
1135        return compareDeep(category, o.category, true) && compareDeep(quantity, o.quantity, true) && compareDeep(item, o.item, true)
1136           && compareDeep(lot, o.lot, true) && compareDeep(serial, o.serial, true) && compareDeep(expiry, o.expiry, true)
1137           && compareDeep(manufacturingDate, o.manufacturingDate, true);
1138      }
1139
1140      @Override
1141      public boolean equalsShallow(Base other_) {
1142        if (!super.equalsShallow(other_))
1143          return false;
1144        if (!(other_ instanceof InventoryReportInventoryListingItemsComponent))
1145          return false;
1146        InventoryReportInventoryListingItemsComponent o = (InventoryReportInventoryListingItemsComponent) other_;
1147        return compareValues(lot, o.lot, true) && compareValues(serial, o.serial, true) && compareValues(expiry, o.expiry, true)
1148           && compareValues(manufacturingDate, o.manufacturingDate, true);
1149      }
1150
1151      public boolean isEmpty() {
1152        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, quantity, item
1153          , lot, serial, expiry, manufacturingDate);
1154      }
1155
1156  public String fhirType() {
1157    return "InventoryReport.inventoryListing.items";
1158
1159  }
1160
1161  }
1162
1163    /**
1164     * Identifiers for the InventoryReport.
1165     */
1166    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1167    @Description(shortDefinition="Identifiers for the report", formalDefinition="Identifiers for the InventoryReport." )
1168    protected List<Identifier> identifier;
1169
1170    /**
1171     * The status of the inventory check or notification - whether this is draft (e.g. the report is still pending some updates) or active.
1172     */
1173    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1174    @Description(shortDefinition="draft | requested | active | entered-in-error", formalDefinition="The status of the inventory check or notification - whether this is draft (e.g. the report is still pending some updates) or active." )
1175    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/inventoryreport-status")
1176    protected Enumeration<InventoryReportStatus> status;
1177
1178    /**
1179     * Whether the report is about the current inventory count (snapshot) or a differential change in inventory (change).
1180     */
1181    @Child(name = "countType", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
1182    @Description(shortDefinition="snapshot | difference", formalDefinition="Whether the report is about the current inventory count (snapshot) or a differential change in inventory (change)." )
1183    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/inventoryreport-counttype")
1184    protected Enumeration<InventoryCountType> countType;
1185
1186    /**
1187     * What type of operation is being performed - addition or subtraction.
1188     */
1189    @Child(name = "operationType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1190    @Description(shortDefinition="addition | subtraction", formalDefinition="What type of operation is being performed - addition or subtraction." )
1191    protected CodeableConcept operationType;
1192
1193    /**
1194     * The reason for this count - regular count, ad-hoc count, new arrivals, etc.
1195     */
1196    @Child(name = "operationTypeReason", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
1197    @Description(shortDefinition="The reason for this count - regular count, ad-hoc count, new arrivals, etc.", formalDefinition="The reason for this count - regular count, ad-hoc count, new arrivals, etc." )
1198    protected CodeableConcept operationTypeReason;
1199
1200    /**
1201     * When the report has been submitted.
1202     */
1203    @Child(name = "reportedDateTime", type = {DateTimeType.class}, order=5, min=1, max=1, modifier=false, summary=true)
1204    @Description(shortDefinition="When the report has been submitted", formalDefinition="When the report has been submitted." )
1205    protected DateTimeType reportedDateTime;
1206
1207    /**
1208     * Who submits the report.
1209     */
1210    @Child(name = "reporter", type = {Practitioner.class, Patient.class, RelatedPerson.class, Device.class}, order=6, min=0, max=1, modifier=false, summary=false)
1211    @Description(shortDefinition="Who submits the report", formalDefinition="Who submits the report." )
1212    protected Reference reporter;
1213
1214    /**
1215     * The period the report refers to.
1216     */
1217    @Child(name = "reportingPeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=false)
1218    @Description(shortDefinition="The period the report refers to", formalDefinition="The period the report refers to." )
1219    protected Period reportingPeriod;
1220
1221    /**
1222     * An inventory listing section (grouped by any of the attributes).
1223     */
1224    @Child(name = "inventoryListing", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1225    @Description(shortDefinition="An inventory listing section (grouped by any of the attributes)", formalDefinition="An inventory listing section (grouped by any of the attributes)." )
1226    protected List<InventoryReportInventoryListingComponent> inventoryListing;
1227
1228    /**
1229     * A note associated with the InventoryReport.
1230     */
1231    @Child(name = "note", type = {Annotation.class}, order=9, min=0, max=1, modifier=false, summary=false)
1232    @Description(shortDefinition="A note associated with the InventoryReport", formalDefinition="A note associated with the InventoryReport." )
1233    protected Annotation note;
1234
1235    private static final long serialVersionUID = 1491752269L;
1236
1237  /**
1238   * Constructor
1239   */
1240    public InventoryReport() {
1241      super();
1242    }
1243
1244  /**
1245   * Constructor
1246   */
1247    public InventoryReport(InventoryReportStatus status, InventoryCountType countType, Date reportedDateTime) {
1248      super();
1249      this.setStatus(status);
1250      this.setCountType(countType);
1251      this.setReportedDateTime(reportedDateTime);
1252    }
1253
1254    /**
1255     * @return {@link #identifier} (Identifiers for the InventoryReport.)
1256     */
1257    public List<Identifier> getIdentifier() { 
1258      if (this.identifier == null)
1259        this.identifier = new ArrayList<Identifier>();
1260      return this.identifier;
1261    }
1262
1263    /**
1264     * @return Returns a reference to <code>this</code> for easy method chaining
1265     */
1266    public InventoryReport setIdentifier(List<Identifier> theIdentifier) { 
1267      this.identifier = theIdentifier;
1268      return this;
1269    }
1270
1271    public boolean hasIdentifier() { 
1272      if (this.identifier == null)
1273        return false;
1274      for (Identifier item : this.identifier)
1275        if (!item.isEmpty())
1276          return true;
1277      return false;
1278    }
1279
1280    public Identifier addIdentifier() { //3
1281      Identifier t = new Identifier();
1282      if (this.identifier == null)
1283        this.identifier = new ArrayList<Identifier>();
1284      this.identifier.add(t);
1285      return t;
1286    }
1287
1288    public InventoryReport addIdentifier(Identifier t) { //3
1289      if (t == null)
1290        return this;
1291      if (this.identifier == null)
1292        this.identifier = new ArrayList<Identifier>();
1293      this.identifier.add(t);
1294      return this;
1295    }
1296
1297    /**
1298     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1299     */
1300    public Identifier getIdentifierFirstRep() { 
1301      if (getIdentifier().isEmpty()) {
1302        addIdentifier();
1303      }
1304      return getIdentifier().get(0);
1305    }
1306
1307    /**
1308     * @return {@link #status} (The status of the inventory check or notification - whether this is draft (e.g. the report is still pending some updates) or active.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1309     */
1310    public Enumeration<InventoryReportStatus> getStatusElement() { 
1311      if (this.status == null)
1312        if (Configuration.errorOnAutoCreate())
1313          throw new Error("Attempt to auto-create InventoryReport.status");
1314        else if (Configuration.doAutoCreate())
1315          this.status = new Enumeration<InventoryReportStatus>(new InventoryReportStatusEnumFactory()); // bb
1316      return this.status;
1317    }
1318
1319    public boolean hasStatusElement() { 
1320      return this.status != null && !this.status.isEmpty();
1321    }
1322
1323    public boolean hasStatus() { 
1324      return this.status != null && !this.status.isEmpty();
1325    }
1326
1327    /**
1328     * @param value {@link #status} (The status of the inventory check or notification - whether this is draft (e.g. the report is still pending some updates) or active.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1329     */
1330    public InventoryReport setStatusElement(Enumeration<InventoryReportStatus> value) { 
1331      this.status = value;
1332      return this;
1333    }
1334
1335    /**
1336     * @return The status of the inventory check or notification - whether this is draft (e.g. the report is still pending some updates) or active.
1337     */
1338    public InventoryReportStatus getStatus() { 
1339      return this.status == null ? null : this.status.getValue();
1340    }
1341
1342    /**
1343     * @param value The status of the inventory check or notification - whether this is draft (e.g. the report is still pending some updates) or active.
1344     */
1345    public InventoryReport setStatus(InventoryReportStatus value) { 
1346        if (this.status == null)
1347          this.status = new Enumeration<InventoryReportStatus>(new InventoryReportStatusEnumFactory());
1348        this.status.setValue(value);
1349      return this;
1350    }
1351
1352    /**
1353     * @return {@link #countType} (Whether the report is about the current inventory count (snapshot) or a differential change in inventory (change).). This is the underlying object with id, value and extensions. The accessor "getCountType" gives direct access to the value
1354     */
1355    public Enumeration<InventoryCountType> getCountTypeElement() { 
1356      if (this.countType == null)
1357        if (Configuration.errorOnAutoCreate())
1358          throw new Error("Attempt to auto-create InventoryReport.countType");
1359        else if (Configuration.doAutoCreate())
1360          this.countType = new Enumeration<InventoryCountType>(new InventoryCountTypeEnumFactory()); // bb
1361      return this.countType;
1362    }
1363
1364    public boolean hasCountTypeElement() { 
1365      return this.countType != null && !this.countType.isEmpty();
1366    }
1367
1368    public boolean hasCountType() { 
1369      return this.countType != null && !this.countType.isEmpty();
1370    }
1371
1372    /**
1373     * @param value {@link #countType} (Whether the report is about the current inventory count (snapshot) or a differential change in inventory (change).). This is the underlying object with id, value and extensions. The accessor "getCountType" gives direct access to the value
1374     */
1375    public InventoryReport setCountTypeElement(Enumeration<InventoryCountType> value) { 
1376      this.countType = value;
1377      return this;
1378    }
1379
1380    /**
1381     * @return Whether the report is about the current inventory count (snapshot) or a differential change in inventory (change).
1382     */
1383    public InventoryCountType getCountType() { 
1384      return this.countType == null ? null : this.countType.getValue();
1385    }
1386
1387    /**
1388     * @param value Whether the report is about the current inventory count (snapshot) or a differential change in inventory (change).
1389     */
1390    public InventoryReport setCountType(InventoryCountType value) { 
1391        if (this.countType == null)
1392          this.countType = new Enumeration<InventoryCountType>(new InventoryCountTypeEnumFactory());
1393        this.countType.setValue(value);
1394      return this;
1395    }
1396
1397    /**
1398     * @return {@link #operationType} (What type of operation is being performed - addition or subtraction.)
1399     */
1400    public CodeableConcept getOperationType() { 
1401      if (this.operationType == null)
1402        if (Configuration.errorOnAutoCreate())
1403          throw new Error("Attempt to auto-create InventoryReport.operationType");
1404        else if (Configuration.doAutoCreate())
1405          this.operationType = new CodeableConcept(); // cc
1406      return this.operationType;
1407    }
1408
1409    public boolean hasOperationType() { 
1410      return this.operationType != null && !this.operationType.isEmpty();
1411    }
1412
1413    /**
1414     * @param value {@link #operationType} (What type of operation is being performed - addition or subtraction.)
1415     */
1416    public InventoryReport setOperationType(CodeableConcept value) { 
1417      this.operationType = value;
1418      return this;
1419    }
1420
1421    /**
1422     * @return {@link #operationTypeReason} (The reason for this count - regular count, ad-hoc count, new arrivals, etc.)
1423     */
1424    public CodeableConcept getOperationTypeReason() { 
1425      if (this.operationTypeReason == null)
1426        if (Configuration.errorOnAutoCreate())
1427          throw new Error("Attempt to auto-create InventoryReport.operationTypeReason");
1428        else if (Configuration.doAutoCreate())
1429          this.operationTypeReason = new CodeableConcept(); // cc
1430      return this.operationTypeReason;
1431    }
1432
1433    public boolean hasOperationTypeReason() { 
1434      return this.operationTypeReason != null && !this.operationTypeReason.isEmpty();
1435    }
1436
1437    /**
1438     * @param value {@link #operationTypeReason} (The reason for this count - regular count, ad-hoc count, new arrivals, etc.)
1439     */
1440    public InventoryReport setOperationTypeReason(CodeableConcept value) { 
1441      this.operationTypeReason = value;
1442      return this;
1443    }
1444
1445    /**
1446     * @return {@link #reportedDateTime} (When the report has been submitted.). This is the underlying object with id, value and extensions. The accessor "getReportedDateTime" gives direct access to the value
1447     */
1448    public DateTimeType getReportedDateTimeElement() { 
1449      if (this.reportedDateTime == null)
1450        if (Configuration.errorOnAutoCreate())
1451          throw new Error("Attempt to auto-create InventoryReport.reportedDateTime");
1452        else if (Configuration.doAutoCreate())
1453          this.reportedDateTime = new DateTimeType(); // bb
1454      return this.reportedDateTime;
1455    }
1456
1457    public boolean hasReportedDateTimeElement() { 
1458      return this.reportedDateTime != null && !this.reportedDateTime.isEmpty();
1459    }
1460
1461    public boolean hasReportedDateTime() { 
1462      return this.reportedDateTime != null && !this.reportedDateTime.isEmpty();
1463    }
1464
1465    /**
1466     * @param value {@link #reportedDateTime} (When the report has been submitted.). This is the underlying object with id, value and extensions. The accessor "getReportedDateTime" gives direct access to the value
1467     */
1468    public InventoryReport setReportedDateTimeElement(DateTimeType value) { 
1469      this.reportedDateTime = value;
1470      return this;
1471    }
1472
1473    /**
1474     * @return When the report has been submitted.
1475     */
1476    public Date getReportedDateTime() { 
1477      return this.reportedDateTime == null ? null : this.reportedDateTime.getValue();
1478    }
1479
1480    /**
1481     * @param value When the report has been submitted.
1482     */
1483    public InventoryReport setReportedDateTime(Date value) { 
1484        if (this.reportedDateTime == null)
1485          this.reportedDateTime = new DateTimeType();
1486        this.reportedDateTime.setValue(value);
1487      return this;
1488    }
1489
1490    /**
1491     * @return {@link #reporter} (Who submits the report.)
1492     */
1493    public Reference getReporter() { 
1494      if (this.reporter == null)
1495        if (Configuration.errorOnAutoCreate())
1496          throw new Error("Attempt to auto-create InventoryReport.reporter");
1497        else if (Configuration.doAutoCreate())
1498          this.reporter = new Reference(); // cc
1499      return this.reporter;
1500    }
1501
1502    public boolean hasReporter() { 
1503      return this.reporter != null && !this.reporter.isEmpty();
1504    }
1505
1506    /**
1507     * @param value {@link #reporter} (Who submits the report.)
1508     */
1509    public InventoryReport setReporter(Reference value) { 
1510      this.reporter = value;
1511      return this;
1512    }
1513
1514    /**
1515     * @return {@link #reportingPeriod} (The period the report refers to.)
1516     */
1517    public Period getReportingPeriod() { 
1518      if (this.reportingPeriod == null)
1519        if (Configuration.errorOnAutoCreate())
1520          throw new Error("Attempt to auto-create InventoryReport.reportingPeriod");
1521        else if (Configuration.doAutoCreate())
1522          this.reportingPeriod = new Period(); // cc
1523      return this.reportingPeriod;
1524    }
1525
1526    public boolean hasReportingPeriod() { 
1527      return this.reportingPeriod != null && !this.reportingPeriod.isEmpty();
1528    }
1529
1530    /**
1531     * @param value {@link #reportingPeriod} (The period the report refers to.)
1532     */
1533    public InventoryReport setReportingPeriod(Period value) { 
1534      this.reportingPeriod = value;
1535      return this;
1536    }
1537
1538    /**
1539     * @return {@link #inventoryListing} (An inventory listing section (grouped by any of the attributes).)
1540     */
1541    public List<InventoryReportInventoryListingComponent> getInventoryListing() { 
1542      if (this.inventoryListing == null)
1543        this.inventoryListing = new ArrayList<InventoryReportInventoryListingComponent>();
1544      return this.inventoryListing;
1545    }
1546
1547    /**
1548     * @return Returns a reference to <code>this</code> for easy method chaining
1549     */
1550    public InventoryReport setInventoryListing(List<InventoryReportInventoryListingComponent> theInventoryListing) { 
1551      this.inventoryListing = theInventoryListing;
1552      return this;
1553    }
1554
1555    public boolean hasInventoryListing() { 
1556      if (this.inventoryListing == null)
1557        return false;
1558      for (InventoryReportInventoryListingComponent item : this.inventoryListing)
1559        if (!item.isEmpty())
1560          return true;
1561      return false;
1562    }
1563
1564    public InventoryReportInventoryListingComponent addInventoryListing() { //3
1565      InventoryReportInventoryListingComponent t = new InventoryReportInventoryListingComponent();
1566      if (this.inventoryListing == null)
1567        this.inventoryListing = new ArrayList<InventoryReportInventoryListingComponent>();
1568      this.inventoryListing.add(t);
1569      return t;
1570    }
1571
1572    public InventoryReport addInventoryListing(InventoryReportInventoryListingComponent t) { //3
1573      if (t == null)
1574        return this;
1575      if (this.inventoryListing == null)
1576        this.inventoryListing = new ArrayList<InventoryReportInventoryListingComponent>();
1577      this.inventoryListing.add(t);
1578      return this;
1579    }
1580
1581    /**
1582     * @return The first repetition of repeating field {@link #inventoryListing}, creating it if it does not already exist {3}
1583     */
1584    public InventoryReportInventoryListingComponent getInventoryListingFirstRep() { 
1585      if (getInventoryListing().isEmpty()) {
1586        addInventoryListing();
1587      }
1588      return getInventoryListing().get(0);
1589    }
1590
1591    /**
1592     * @return {@link #note} (A note associated with the InventoryReport.)
1593     */
1594    public Annotation getNote() { 
1595      if (this.note == null)
1596        if (Configuration.errorOnAutoCreate())
1597          throw new Error("Attempt to auto-create InventoryReport.note");
1598        else if (Configuration.doAutoCreate())
1599          this.note = new Annotation(); // cc
1600      return this.note;
1601    }
1602
1603    public boolean hasNote() { 
1604      return this.note != null && !this.note.isEmpty();
1605    }
1606
1607    /**
1608     * @param value {@link #note} (A note associated with the InventoryReport.)
1609     */
1610    public InventoryReport setNote(Annotation value) { 
1611      this.note = value;
1612      return this;
1613    }
1614
1615      protected void listChildren(List<Property> children) {
1616        super.listChildren(children);
1617        children.add(new Property("identifier", "Identifier", "Identifiers for the InventoryReport.", 0, java.lang.Integer.MAX_VALUE, identifier));
1618        children.add(new Property("status", "code", "The status of the inventory check or notification - whether this is draft (e.g. the report is still pending some updates) or active.", 0, 1, status));
1619        children.add(new Property("countType", "code", "Whether the report is about the current inventory count (snapshot) or a differential change in inventory (change).", 0, 1, countType));
1620        children.add(new Property("operationType", "CodeableConcept", "What type of operation is being performed - addition or subtraction.", 0, 1, operationType));
1621        children.add(new Property("operationTypeReason", "CodeableConcept", "The reason for this count - regular count, ad-hoc count, new arrivals, etc.", 0, 1, operationTypeReason));
1622        children.add(new Property("reportedDateTime", "dateTime", "When the report has been submitted.", 0, 1, reportedDateTime));
1623        children.add(new Property("reporter", "Reference(Practitioner|Patient|RelatedPerson|Device)", "Who submits the report.", 0, 1, reporter));
1624        children.add(new Property("reportingPeriod", "Period", "The period the report refers to.", 0, 1, reportingPeriod));
1625        children.add(new Property("inventoryListing", "", "An inventory listing section (grouped by any of the attributes).", 0, java.lang.Integer.MAX_VALUE, inventoryListing));
1626        children.add(new Property("note", "Annotation", "A note associated with the InventoryReport.", 0, 1, note));
1627      }
1628
1629      @Override
1630      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1631        switch (_hash) {
1632        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers for the InventoryReport.", 0, java.lang.Integer.MAX_VALUE, identifier);
1633        case -892481550: /*status*/  return new Property("status", "code", "The status of the inventory check or notification - whether this is draft (e.g. the report is still pending some updates) or active.", 0, 1, status);
1634        case 1351759081: /*countType*/  return new Property("countType", "code", "Whether the report is about the current inventory count (snapshot) or a differential change in inventory (change).", 0, 1, countType);
1635        case 91999553: /*operationType*/  return new Property("operationType", "CodeableConcept", "What type of operation is being performed - addition or subtraction.", 0, 1, operationType);
1636        case 449681125: /*operationTypeReason*/  return new Property("operationTypeReason", "CodeableConcept", "The reason for this count - regular count, ad-hoc count, new arrivals, etc.", 0, 1, operationTypeReason);
1637        case -1048250994: /*reportedDateTime*/  return new Property("reportedDateTime", "dateTime", "When the report has been submitted.", 0, 1, reportedDateTime);
1638        case -427039519: /*reporter*/  return new Property("reporter", "Reference(Practitioner|Patient|RelatedPerson|Device)", "Who submits the report.", 0, 1, reporter);
1639        case 409685391: /*reportingPeriod*/  return new Property("reportingPeriod", "Period", "The period the report refers to.", 0, 1, reportingPeriod);
1640        case -1764804216: /*inventoryListing*/  return new Property("inventoryListing", "", "An inventory listing section (grouped by any of the attributes).", 0, java.lang.Integer.MAX_VALUE, inventoryListing);
1641        case 3387378: /*note*/  return new Property("note", "Annotation", "A note associated with the InventoryReport.", 0, 1, note);
1642        default: return super.getNamedProperty(_hash, _name, _checkValid);
1643        }
1644
1645      }
1646
1647      @Override
1648      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1649        switch (hash) {
1650        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1651        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<InventoryReportStatus>
1652        case 1351759081: /*countType*/ return this.countType == null ? new Base[0] : new Base[] {this.countType}; // Enumeration<InventoryCountType>
1653        case 91999553: /*operationType*/ return this.operationType == null ? new Base[0] : new Base[] {this.operationType}; // CodeableConcept
1654        case 449681125: /*operationTypeReason*/ return this.operationTypeReason == null ? new Base[0] : new Base[] {this.operationTypeReason}; // CodeableConcept
1655        case -1048250994: /*reportedDateTime*/ return this.reportedDateTime == null ? new Base[0] : new Base[] {this.reportedDateTime}; // DateTimeType
1656        case -427039519: /*reporter*/ return this.reporter == null ? new Base[0] : new Base[] {this.reporter}; // Reference
1657        case 409685391: /*reportingPeriod*/ return this.reportingPeriod == null ? new Base[0] : new Base[] {this.reportingPeriod}; // Period
1658        case -1764804216: /*inventoryListing*/ return this.inventoryListing == null ? new Base[0] : this.inventoryListing.toArray(new Base[this.inventoryListing.size()]); // InventoryReportInventoryListingComponent
1659        case 3387378: /*note*/ return this.note == null ? new Base[0] : new Base[] {this.note}; // Annotation
1660        default: return super.getProperty(hash, name, checkValid);
1661        }
1662
1663      }
1664
1665      @Override
1666      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1667        switch (hash) {
1668        case -1618432855: // identifier
1669          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1670          return value;
1671        case -892481550: // status
1672          value = new InventoryReportStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1673          this.status = (Enumeration) value; // Enumeration<InventoryReportStatus>
1674          return value;
1675        case 1351759081: // countType
1676          value = new InventoryCountTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1677          this.countType = (Enumeration) value; // Enumeration<InventoryCountType>
1678          return value;
1679        case 91999553: // operationType
1680          this.operationType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1681          return value;
1682        case 449681125: // operationTypeReason
1683          this.operationTypeReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1684          return value;
1685        case -1048250994: // reportedDateTime
1686          this.reportedDateTime = TypeConvertor.castToDateTime(value); // DateTimeType
1687          return value;
1688        case -427039519: // reporter
1689          this.reporter = TypeConvertor.castToReference(value); // Reference
1690          return value;
1691        case 409685391: // reportingPeriod
1692          this.reportingPeriod = TypeConvertor.castToPeriod(value); // Period
1693          return value;
1694        case -1764804216: // inventoryListing
1695          this.getInventoryListing().add((InventoryReportInventoryListingComponent) value); // InventoryReportInventoryListingComponent
1696          return value;
1697        case 3387378: // note
1698          this.note = TypeConvertor.castToAnnotation(value); // Annotation
1699          return value;
1700        default: return super.setProperty(hash, name, value);
1701        }
1702
1703      }
1704
1705      @Override
1706      public Base setProperty(String name, Base value) throws FHIRException {
1707        if (name.equals("identifier")) {
1708          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1709        } else if (name.equals("status")) {
1710          value = new InventoryReportStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1711          this.status = (Enumeration) value; // Enumeration<InventoryReportStatus>
1712        } else if (name.equals("countType")) {
1713          value = new InventoryCountTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1714          this.countType = (Enumeration) value; // Enumeration<InventoryCountType>
1715        } else if (name.equals("operationType")) {
1716          this.operationType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1717        } else if (name.equals("operationTypeReason")) {
1718          this.operationTypeReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1719        } else if (name.equals("reportedDateTime")) {
1720          this.reportedDateTime = TypeConvertor.castToDateTime(value); // DateTimeType
1721        } else if (name.equals("reporter")) {
1722          this.reporter = TypeConvertor.castToReference(value); // Reference
1723        } else if (name.equals("reportingPeriod")) {
1724          this.reportingPeriod = TypeConvertor.castToPeriod(value); // Period
1725        } else if (name.equals("inventoryListing")) {
1726          this.getInventoryListing().add((InventoryReportInventoryListingComponent) value);
1727        } else if (name.equals("note")) {
1728          this.note = TypeConvertor.castToAnnotation(value); // Annotation
1729        } else
1730          return super.setProperty(name, value);
1731        return value;
1732      }
1733
1734      @Override
1735      public Base makeProperty(int hash, String name) throws FHIRException {
1736        switch (hash) {
1737        case -1618432855:  return addIdentifier(); 
1738        case -892481550:  return getStatusElement();
1739        case 1351759081:  return getCountTypeElement();
1740        case 91999553:  return getOperationType();
1741        case 449681125:  return getOperationTypeReason();
1742        case -1048250994:  return getReportedDateTimeElement();
1743        case -427039519:  return getReporter();
1744        case 409685391:  return getReportingPeriod();
1745        case -1764804216:  return addInventoryListing(); 
1746        case 3387378:  return getNote();
1747        default: return super.makeProperty(hash, name);
1748        }
1749
1750      }
1751
1752      @Override
1753      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1754        switch (hash) {
1755        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1756        case -892481550: /*status*/ return new String[] {"code"};
1757        case 1351759081: /*countType*/ return new String[] {"code"};
1758        case 91999553: /*operationType*/ return new String[] {"CodeableConcept"};
1759        case 449681125: /*operationTypeReason*/ return new String[] {"CodeableConcept"};
1760        case -1048250994: /*reportedDateTime*/ return new String[] {"dateTime"};
1761        case -427039519: /*reporter*/ return new String[] {"Reference"};
1762        case 409685391: /*reportingPeriod*/ return new String[] {"Period"};
1763        case -1764804216: /*inventoryListing*/ return new String[] {};
1764        case 3387378: /*note*/ return new String[] {"Annotation"};
1765        default: return super.getTypesForProperty(hash, name);
1766        }
1767
1768      }
1769
1770      @Override
1771      public Base addChild(String name) throws FHIRException {
1772        if (name.equals("identifier")) {
1773          return addIdentifier();
1774        }
1775        else if (name.equals("status")) {
1776          throw new FHIRException("Cannot call addChild on a primitive type InventoryReport.status");
1777        }
1778        else if (name.equals("countType")) {
1779          throw new FHIRException("Cannot call addChild on a primitive type InventoryReport.countType");
1780        }
1781        else if (name.equals("operationType")) {
1782          this.operationType = new CodeableConcept();
1783          return this.operationType;
1784        }
1785        else if (name.equals("operationTypeReason")) {
1786          this.operationTypeReason = new CodeableConcept();
1787          return this.operationTypeReason;
1788        }
1789        else if (name.equals("reportedDateTime")) {
1790          throw new FHIRException("Cannot call addChild on a primitive type InventoryReport.reportedDateTime");
1791        }
1792        else if (name.equals("reporter")) {
1793          this.reporter = new Reference();
1794          return this.reporter;
1795        }
1796        else if (name.equals("reportingPeriod")) {
1797          this.reportingPeriod = new Period();
1798          return this.reportingPeriod;
1799        }
1800        else if (name.equals("inventoryListing")) {
1801          return addInventoryListing();
1802        }
1803        else if (name.equals("note")) {
1804          this.note = new Annotation();
1805          return this.note;
1806        }
1807        else
1808          return super.addChild(name);
1809      }
1810
1811  public String fhirType() {
1812    return "InventoryReport";
1813
1814  }
1815
1816      public InventoryReport copy() {
1817        InventoryReport dst = new InventoryReport();
1818        copyValues(dst);
1819        return dst;
1820      }
1821
1822      public void copyValues(InventoryReport dst) {
1823        super.copyValues(dst);
1824        if (identifier != null) {
1825          dst.identifier = new ArrayList<Identifier>();
1826          for (Identifier i : identifier)
1827            dst.identifier.add(i.copy());
1828        };
1829        dst.status = status == null ? null : status.copy();
1830        dst.countType = countType == null ? null : countType.copy();
1831        dst.operationType = operationType == null ? null : operationType.copy();
1832        dst.operationTypeReason = operationTypeReason == null ? null : operationTypeReason.copy();
1833        dst.reportedDateTime = reportedDateTime == null ? null : reportedDateTime.copy();
1834        dst.reporter = reporter == null ? null : reporter.copy();
1835        dst.reportingPeriod = reportingPeriod == null ? null : reportingPeriod.copy();
1836        if (inventoryListing != null) {
1837          dst.inventoryListing = new ArrayList<InventoryReportInventoryListingComponent>();
1838          for (InventoryReportInventoryListingComponent i : inventoryListing)
1839            dst.inventoryListing.add(i.copy());
1840        };
1841        dst.note = note == null ? null : note.copy();
1842      }
1843
1844      protected InventoryReport typedCopy() {
1845        return copy();
1846      }
1847
1848      @Override
1849      public boolean equalsDeep(Base other_) {
1850        if (!super.equalsDeep(other_))
1851          return false;
1852        if (!(other_ instanceof InventoryReport))
1853          return false;
1854        InventoryReport o = (InventoryReport) other_;
1855        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(countType, o.countType, true)
1856           && compareDeep(operationType, o.operationType, true) && compareDeep(operationTypeReason, o.operationTypeReason, true)
1857           && compareDeep(reportedDateTime, o.reportedDateTime, true) && compareDeep(reporter, o.reporter, true)
1858           && compareDeep(reportingPeriod, o.reportingPeriod, true) && compareDeep(inventoryListing, o.inventoryListing, true)
1859           && compareDeep(note, o.note, true);
1860      }
1861
1862      @Override
1863      public boolean equalsShallow(Base other_) {
1864        if (!super.equalsShallow(other_))
1865          return false;
1866        if (!(other_ instanceof InventoryReport))
1867          return false;
1868        InventoryReport o = (InventoryReport) other_;
1869        return compareValues(status, o.status, true) && compareValues(countType, o.countType, true) && compareValues(reportedDateTime, o.reportedDateTime, true)
1870          ;
1871      }
1872
1873      public boolean isEmpty() {
1874        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, countType
1875          , operationType, operationTypeReason, reportedDateTime, reporter, reportingPeriod
1876          , inventoryListing, note);
1877      }
1878
1879  @Override
1880  public ResourceType getResourceType() {
1881    return ResourceType.InventoryReport;
1882   }
1883
1884
1885}
1886