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