001package org.hl7.fhir.r4b.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, Dec 31, 2021 05:58+1100 for FHIR v4.3.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.r4b.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 * The subscription resource is used to define a push-based subscription from a server to another system. Once a subscription is registered with the server, the server checks every resource that is created or updated, and if the resource matches the given criteria, it sends a message on the defined "channel" so that another system can take an appropriate action.
052 */
053@ResourceDef(name="Subscription", profile="http://hl7.org/fhir/StructureDefinition/Subscription")
054public class Subscription extends DomainResource {
055
056    public enum SubscriptionChannelType {
057        /**
058         * The channel is executed by making a post to the URI. If a payload is included, the URL is interpreted as the service base, and an update (PUT) is made.
059         */
060        RESTHOOK, 
061        /**
062         * The channel is executed by sending a packet across a web socket connection maintained by the client. The URL identifies the websocket, and the client binds to this URL.
063         */
064        WEBSOCKET, 
065        /**
066         * The channel is executed by sending an email to the email addressed in the URI (which must be a mailto:).
067         */
068        EMAIL, 
069        /**
070         * The channel is executed by sending an SMS message to the phone number identified in the URL (tel:).
071         */
072        SMS, 
073        /**
074         * The channel is executed by sending a message (e.g. a Bundle with a MessageHeader resource etc.) to the application identified in the URI.
075         */
076        MESSAGE, 
077        /**
078         * added to help the parsers with the generic types
079         */
080        NULL;
081        public static SubscriptionChannelType fromCode(String codeString) throws FHIRException {
082            if (codeString == null || "".equals(codeString))
083                return null;
084        if ("rest-hook".equals(codeString))
085          return RESTHOOK;
086        if ("websocket".equals(codeString))
087          return WEBSOCKET;
088        if ("email".equals(codeString))
089          return EMAIL;
090        if ("sms".equals(codeString))
091          return SMS;
092        if ("message".equals(codeString))
093          return MESSAGE;
094        if (Configuration.isAcceptInvalidEnums())
095          return null;
096        else
097          throw new FHIRException("Unknown SubscriptionChannelType code '"+codeString+"'");
098        }
099        public String toCode() {
100          switch (this) {
101            case RESTHOOK: return "rest-hook";
102            case WEBSOCKET: return "websocket";
103            case EMAIL: return "email";
104            case SMS: return "sms";
105            case MESSAGE: return "message";
106            case NULL: return null;
107            default: return "?";
108          }
109        }
110        public String getSystem() {
111          switch (this) {
112            case RESTHOOK: return "http://hl7.org/fhir/subscription-channel-type";
113            case WEBSOCKET: return "http://hl7.org/fhir/subscription-channel-type";
114            case EMAIL: return "http://hl7.org/fhir/subscription-channel-type";
115            case SMS: return "http://hl7.org/fhir/subscription-channel-type";
116            case MESSAGE: return "http://hl7.org/fhir/subscription-channel-type";
117            case NULL: return null;
118            default: return "?";
119          }
120        }
121        public String getDefinition() {
122          switch (this) {
123            case RESTHOOK: return "The channel is executed by making a post to the URI. If a payload is included, the URL is interpreted as the service base, and an update (PUT) is made.";
124            case WEBSOCKET: return "The channel is executed by sending a packet across a web socket connection maintained by the client. The URL identifies the websocket, and the client binds to this URL.";
125            case EMAIL: return "The channel is executed by sending an email to the email addressed in the URI (which must be a mailto:).";
126            case SMS: return "The channel is executed by sending an SMS message to the phone number identified in the URL (tel:).";
127            case MESSAGE: return "The channel is executed by sending a message (e.g. a Bundle with a MessageHeader resource etc.) to the application identified in the URI.";
128            case NULL: return null;
129            default: return "?";
130          }
131        }
132        public String getDisplay() {
133          switch (this) {
134            case RESTHOOK: return "Rest Hook";
135            case WEBSOCKET: return "Websocket";
136            case EMAIL: return "Email";
137            case SMS: return "SMS";
138            case MESSAGE: return "Message";
139            case NULL: return null;
140            default: return "?";
141          }
142        }
143    }
144
145  public static class SubscriptionChannelTypeEnumFactory implements EnumFactory<SubscriptionChannelType> {
146    public SubscriptionChannelType fromCode(String codeString) throws IllegalArgumentException {
147      if (codeString == null || "".equals(codeString))
148            if (codeString == null || "".equals(codeString))
149                return null;
150        if ("rest-hook".equals(codeString))
151          return SubscriptionChannelType.RESTHOOK;
152        if ("websocket".equals(codeString))
153          return SubscriptionChannelType.WEBSOCKET;
154        if ("email".equals(codeString))
155          return SubscriptionChannelType.EMAIL;
156        if ("sms".equals(codeString))
157          return SubscriptionChannelType.SMS;
158        if ("message".equals(codeString))
159          return SubscriptionChannelType.MESSAGE;
160        throw new IllegalArgumentException("Unknown SubscriptionChannelType code '"+codeString+"'");
161        }
162        public Enumeration<SubscriptionChannelType> fromType(Base code) throws FHIRException {
163          if (code == null)
164            return null;
165          if (code.isEmpty())
166            return new Enumeration<SubscriptionChannelType>(this);
167          String codeString = ((PrimitiveType) code).asStringValue();
168          if (codeString == null || "".equals(codeString))
169            return null;
170        if ("rest-hook".equals(codeString))
171          return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.RESTHOOK);
172        if ("websocket".equals(codeString))
173          return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.WEBSOCKET);
174        if ("email".equals(codeString))
175          return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.EMAIL);
176        if ("sms".equals(codeString))
177          return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.SMS);
178        if ("message".equals(codeString))
179          return new Enumeration<SubscriptionChannelType>(this, SubscriptionChannelType.MESSAGE);
180        throw new FHIRException("Unknown SubscriptionChannelType code '"+codeString+"'");
181        }
182    public String toCode(SubscriptionChannelType code) {
183      if (code == SubscriptionChannelType.RESTHOOK)
184        return "rest-hook";
185      if (code == SubscriptionChannelType.WEBSOCKET)
186        return "websocket";
187      if (code == SubscriptionChannelType.EMAIL)
188        return "email";
189      if (code == SubscriptionChannelType.SMS)
190        return "sms";
191      if (code == SubscriptionChannelType.MESSAGE)
192        return "message";
193      return "?";
194      }
195    public String toSystem(SubscriptionChannelType code) {
196      return code.getSystem();
197      }
198    }
199
200    @Block()
201    public static class SubscriptionChannelComponent extends BackboneElement implements IBaseBackboneElement {
202        /**
203         * The type of channel to send notifications on.
204         */
205        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
206        @Description(shortDefinition="rest-hook | websocket | email | sms | message", formalDefinition="The type of channel to send notifications on." )
207        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-channel-type")
208        protected Enumeration<SubscriptionChannelType> type;
209
210        /**
211         * The url that describes the actual end-point to send messages to.
212         */
213        @Child(name = "endpoint", type = {UrlType.class}, order=2, min=0, max=1, modifier=false, summary=true)
214        @Description(shortDefinition="Where the channel points to", formalDefinition="The url that describes the actual end-point to send messages to." )
215        protected UrlType endpoint;
216
217        /**
218         * The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type "text/plain" may also be used for Email and SMS subscriptions.
219         */
220        @Child(name = "payload", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
221        @Description(shortDefinition="MIME type to send, or omit for no payload", formalDefinition="The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type \"text/plain\" may also be used for Email and SMS subscriptions." )
222        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
223        protected CodeType payload;
224
225        /**
226         * Additional headers / information to send as part of the notification.
227         */
228        @Child(name = "header", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
229        @Description(shortDefinition="Usage depends on the channel type", formalDefinition="Additional headers / information to send as part of the notification." )
230        protected List<StringType> header;
231
232        private static final long serialVersionUID = -771044852L;
233
234    /**
235     * Constructor
236     */
237      public SubscriptionChannelComponent() {
238        super();
239      }
240
241    /**
242     * Constructor
243     */
244      public SubscriptionChannelComponent(SubscriptionChannelType type) {
245        super();
246        this.setType(type);
247      }
248
249        /**
250         * @return {@link #type} (The type of channel to send notifications on.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
251         */
252        public Enumeration<SubscriptionChannelType> getTypeElement() { 
253          if (this.type == null)
254            if (Configuration.errorOnAutoCreate())
255              throw new Error("Attempt to auto-create SubscriptionChannelComponent.type");
256            else if (Configuration.doAutoCreate())
257              this.type = new Enumeration<SubscriptionChannelType>(new SubscriptionChannelTypeEnumFactory()); // bb
258          return this.type;
259        }
260
261        public boolean hasTypeElement() { 
262          return this.type != null && !this.type.isEmpty();
263        }
264
265        public boolean hasType() { 
266          return this.type != null && !this.type.isEmpty();
267        }
268
269        /**
270         * @param value {@link #type} (The type of channel to send notifications on.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
271         */
272        public SubscriptionChannelComponent setTypeElement(Enumeration<SubscriptionChannelType> value) { 
273          this.type = value;
274          return this;
275        }
276
277        /**
278         * @return The type of channel to send notifications on.
279         */
280        public SubscriptionChannelType getType() { 
281          return this.type == null ? null : this.type.getValue();
282        }
283
284        /**
285         * @param value The type of channel to send notifications on.
286         */
287        public SubscriptionChannelComponent setType(SubscriptionChannelType value) { 
288            if (this.type == null)
289              this.type = new Enumeration<SubscriptionChannelType>(new SubscriptionChannelTypeEnumFactory());
290            this.type.setValue(value);
291          return this;
292        }
293
294        /**
295         * @return {@link #endpoint} (The url that describes the actual end-point to send messages to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value
296         */
297        public UrlType getEndpointElement() { 
298          if (this.endpoint == null)
299            if (Configuration.errorOnAutoCreate())
300              throw new Error("Attempt to auto-create SubscriptionChannelComponent.endpoint");
301            else if (Configuration.doAutoCreate())
302              this.endpoint = new UrlType(); // bb
303          return this.endpoint;
304        }
305
306        public boolean hasEndpointElement() { 
307          return this.endpoint != null && !this.endpoint.isEmpty();
308        }
309
310        public boolean hasEndpoint() { 
311          return this.endpoint != null && !this.endpoint.isEmpty();
312        }
313
314        /**
315         * @param value {@link #endpoint} (The url that describes the actual end-point to send messages to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value
316         */
317        public SubscriptionChannelComponent setEndpointElement(UrlType value) { 
318          this.endpoint = value;
319          return this;
320        }
321
322        /**
323         * @return The url that describes the actual end-point to send messages to.
324         */
325        public String getEndpoint() { 
326          return this.endpoint == null ? null : this.endpoint.getValue();
327        }
328
329        /**
330         * @param value The url that describes the actual end-point to send messages to.
331         */
332        public SubscriptionChannelComponent setEndpoint(String value) { 
333          if (Utilities.noString(value))
334            this.endpoint = null;
335          else {
336            if (this.endpoint == null)
337              this.endpoint = new UrlType();
338            this.endpoint.setValue(value);
339          }
340          return this;
341        }
342
343        /**
344         * @return {@link #payload} (The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type "text/plain" may also be used for Email and SMS subscriptions.). This is the underlying object with id, value and extensions. The accessor "getPayload" gives direct access to the value
345         */
346        public CodeType getPayloadElement() { 
347          if (this.payload == null)
348            if (Configuration.errorOnAutoCreate())
349              throw new Error("Attempt to auto-create SubscriptionChannelComponent.payload");
350            else if (Configuration.doAutoCreate())
351              this.payload = new CodeType(); // bb
352          return this.payload;
353        }
354
355        public boolean hasPayloadElement() { 
356          return this.payload != null && !this.payload.isEmpty();
357        }
358
359        public boolean hasPayload() { 
360          return this.payload != null && !this.payload.isEmpty();
361        }
362
363        /**
364         * @param value {@link #payload} (The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type "text/plain" may also be used for Email and SMS subscriptions.). This is the underlying object with id, value and extensions. The accessor "getPayload" gives direct access to the value
365         */
366        public SubscriptionChannelComponent setPayloadElement(CodeType value) { 
367          this.payload = value;
368          return this;
369        }
370
371        /**
372         * @return The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type "text/plain" may also be used for Email and SMS subscriptions.
373         */
374        public String getPayload() { 
375          return this.payload == null ? null : this.payload.getValue();
376        }
377
378        /**
379         * @param value The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type "text/plain" may also be used for Email and SMS subscriptions.
380         */
381        public SubscriptionChannelComponent setPayload(String value) { 
382          if (Utilities.noString(value))
383            this.payload = null;
384          else {
385            if (this.payload == null)
386              this.payload = new CodeType();
387            this.payload.setValue(value);
388          }
389          return this;
390        }
391
392        /**
393         * @return {@link #header} (Additional headers / information to send as part of the notification.)
394         */
395        public List<StringType> getHeader() { 
396          if (this.header == null)
397            this.header = new ArrayList<StringType>();
398          return this.header;
399        }
400
401        /**
402         * @return Returns a reference to <code>this</code> for easy method chaining
403         */
404        public SubscriptionChannelComponent setHeader(List<StringType> theHeader) { 
405          this.header = theHeader;
406          return this;
407        }
408
409        public boolean hasHeader() { 
410          if (this.header == null)
411            return false;
412          for (StringType item : this.header)
413            if (!item.isEmpty())
414              return true;
415          return false;
416        }
417
418        /**
419         * @return {@link #header} (Additional headers / information to send as part of the notification.)
420         */
421        public StringType addHeaderElement() {//2 
422          StringType t = new StringType();
423          if (this.header == null)
424            this.header = new ArrayList<StringType>();
425          this.header.add(t);
426          return t;
427        }
428
429        /**
430         * @param value {@link #header} (Additional headers / information to send as part of the notification.)
431         */
432        public SubscriptionChannelComponent addHeader(String value) { //1
433          StringType t = new StringType();
434          t.setValue(value);
435          if (this.header == null)
436            this.header = new ArrayList<StringType>();
437          this.header.add(t);
438          return this;
439        }
440
441        /**
442         * @param value {@link #header} (Additional headers / information to send as part of the notification.)
443         */
444        public boolean hasHeader(String value) { 
445          if (this.header == null)
446            return false;
447          for (StringType v : this.header)
448            if (v.getValue().equals(value)) // string
449              return true;
450          return false;
451        }
452
453        protected void listChildren(List<Property> children) {
454          super.listChildren(children);
455          children.add(new Property("type", "code", "The type of channel to send notifications on.", 0, 1, type));
456          children.add(new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint));
457          children.add(new Property("payload", "code", "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type \"text/plain\" may also be used for Email and SMS subscriptions.", 0, 1, payload));
458          children.add(new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header));
459        }
460
461        @Override
462        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
463          switch (_hash) {
464          case 3575610: /*type*/  return new Property("type", "code", "The type of channel to send notifications on.", 0, 1, type);
465          case 1741102485: /*endpoint*/  return new Property("endpoint", "url", "The url that describes the actual end-point to send messages to.", 0, 1, endpoint);
466          case -786701938: /*payload*/  return new Property("payload", "code", "The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification. The mime type \"text/plain\" may also be used for Email and SMS subscriptions.", 0, 1, payload);
467          case -1221270899: /*header*/  return new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header);
468          default: return super.getNamedProperty(_hash, _name, _checkValid);
469          }
470
471        }
472
473      @Override
474      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
475        switch (hash) {
476        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<SubscriptionChannelType>
477        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : new Base[] {this.endpoint}; // UrlType
478        case -786701938: /*payload*/ return this.payload == null ? new Base[0] : new Base[] {this.payload}; // CodeType
479        case -1221270899: /*header*/ return this.header == null ? new Base[0] : this.header.toArray(new Base[this.header.size()]); // StringType
480        default: return super.getProperty(hash, name, checkValid);
481        }
482
483      }
484
485      @Override
486      public Base setProperty(int hash, String name, Base value) throws FHIRException {
487        switch (hash) {
488        case 3575610: // type
489          value = new SubscriptionChannelTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
490          this.type = (Enumeration) value; // Enumeration<SubscriptionChannelType>
491          return value;
492        case 1741102485: // endpoint
493          this.endpoint = TypeConvertor.castToUrl(value); // UrlType
494          return value;
495        case -786701938: // payload
496          this.payload = TypeConvertor.castToCode(value); // CodeType
497          return value;
498        case -1221270899: // header
499          this.getHeader().add(TypeConvertor.castToString(value)); // StringType
500          return value;
501        default: return super.setProperty(hash, name, value);
502        }
503
504      }
505
506      @Override
507      public Base setProperty(String name, Base value) throws FHIRException {
508        if (name.equals("type")) {
509          value = new SubscriptionChannelTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
510          this.type = (Enumeration) value; // Enumeration<SubscriptionChannelType>
511        } else if (name.equals("endpoint")) {
512          this.endpoint = TypeConvertor.castToUrl(value); // UrlType
513        } else if (name.equals("payload")) {
514          this.payload = TypeConvertor.castToCode(value); // CodeType
515        } else if (name.equals("header")) {
516          this.getHeader().add(TypeConvertor.castToString(value));
517        } else
518          return super.setProperty(name, value);
519        return value;
520      }
521
522      @Override
523      public Base makeProperty(int hash, String name) throws FHIRException {
524        switch (hash) {
525        case 3575610:  return getTypeElement();
526        case 1741102485:  return getEndpointElement();
527        case -786701938:  return getPayloadElement();
528        case -1221270899:  return addHeaderElement();
529        default: return super.makeProperty(hash, name);
530        }
531
532      }
533
534      @Override
535      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
536        switch (hash) {
537        case 3575610: /*type*/ return new String[] {"code"};
538        case 1741102485: /*endpoint*/ return new String[] {"url"};
539        case -786701938: /*payload*/ return new String[] {"code"};
540        case -1221270899: /*header*/ return new String[] {"string"};
541        default: return super.getTypesForProperty(hash, name);
542        }
543
544      }
545
546      @Override
547      public Base addChild(String name) throws FHIRException {
548        if (name.equals("type")) {
549          throw new FHIRException("Cannot call addChild on a primitive type Subscription.channel.type");
550        }
551        else if (name.equals("endpoint")) {
552          throw new FHIRException("Cannot call addChild on a primitive type Subscription.channel.endpoint");
553        }
554        else if (name.equals("payload")) {
555          throw new FHIRException("Cannot call addChild on a primitive type Subscription.channel.payload");
556        }
557        else if (name.equals("header")) {
558          throw new FHIRException("Cannot call addChild on a primitive type Subscription.channel.header");
559        }
560        else
561          return super.addChild(name);
562      }
563
564      public SubscriptionChannelComponent copy() {
565        SubscriptionChannelComponent dst = new SubscriptionChannelComponent();
566        copyValues(dst);
567        return dst;
568      }
569
570      public void copyValues(SubscriptionChannelComponent dst) {
571        super.copyValues(dst);
572        dst.type = type == null ? null : type.copy();
573        dst.endpoint = endpoint == null ? null : endpoint.copy();
574        dst.payload = payload == null ? null : payload.copy();
575        if (header != null) {
576          dst.header = new ArrayList<StringType>();
577          for (StringType i : header)
578            dst.header.add(i.copy());
579        };
580      }
581
582      @Override
583      public boolean equalsDeep(Base other_) {
584        if (!super.equalsDeep(other_))
585          return false;
586        if (!(other_ instanceof SubscriptionChannelComponent))
587          return false;
588        SubscriptionChannelComponent o = (SubscriptionChannelComponent) other_;
589        return compareDeep(type, o.type, true) && compareDeep(endpoint, o.endpoint, true) && compareDeep(payload, o.payload, true)
590           && compareDeep(header, o.header, true);
591      }
592
593      @Override
594      public boolean equalsShallow(Base other_) {
595        if (!super.equalsShallow(other_))
596          return false;
597        if (!(other_ instanceof SubscriptionChannelComponent))
598          return false;
599        SubscriptionChannelComponent o = (SubscriptionChannelComponent) other_;
600        return compareValues(type, o.type, true) && compareValues(endpoint, o.endpoint, true) && compareValues(payload, o.payload, true)
601           && compareValues(header, o.header, true);
602      }
603
604      public boolean isEmpty() {
605        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, endpoint, payload
606          , header);
607      }
608
609  public String fhirType() {
610    return "Subscription.channel";
611
612  }
613
614  }
615
616    /**
617     * The status of the subscription, which marks the server state for managing the subscription.
618     */
619    @Child(name = "status", type = {CodeType.class}, order=0, min=1, max=1, modifier=true, summary=true)
620    @Description(shortDefinition="requested | active | error | off", formalDefinition="The status of the subscription, which marks the server state for managing the subscription." )
621    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subscription-status")
622    protected Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus> status;
623
624    /**
625     * Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.
626     */
627    @Child(name = "contact", type = {ContactPoint.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
628    @Description(shortDefinition="Contact details for source (e.g. troubleshooting)", formalDefinition="Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting." )
629    protected List<ContactPoint> contact;
630
631    /**
632     * The time for the server to turn the subscription off.
633     */
634    @Child(name = "end", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=true)
635    @Description(shortDefinition="When to automatically delete the subscription", formalDefinition="The time for the server to turn the subscription off." )
636    protected InstantType end;
637
638    /**
639     * A description of why this subscription is defined.
640     */
641    @Child(name = "reason", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
642    @Description(shortDefinition="Description of why this subscription was created", formalDefinition="A description of why this subscription is defined." )
643    protected StringType reason;
644
645    /**
646     * The rules that the server should use to determine when to generate notifications for this subscription.
647     */
648    @Child(name = "criteria", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true)
649    @Description(shortDefinition="Rule for server push", formalDefinition="The rules that the server should use to determine when to generate notifications for this subscription." )
650    protected StringType criteria;
651
652    /**
653     * A record of the last error that occurred when the server processed a notification.
654     */
655    @Child(name = "error", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
656    @Description(shortDefinition="Latest error note", formalDefinition="A record of the last error that occurred when the server processed a notification." )
657    protected StringType error;
658
659    /**
660     * Details where to send notifications when resources are received that meet the criteria.
661     */
662    @Child(name = "channel", type = {}, order=6, min=1, max=1, modifier=false, summary=true)
663    @Description(shortDefinition="The channel on which to report matches to the criteria", formalDefinition="Details where to send notifications when resources are received that meet the criteria." )
664    protected SubscriptionChannelComponent channel;
665
666    private static final long serialVersionUID = -1570157715L;
667
668  /**
669   * Constructor
670   */
671    public Subscription() {
672      super();
673    }
674
675  /**
676   * Constructor
677   */
678    public Subscription(org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus status, String reason, String criteria, SubscriptionChannelComponent channel) {
679      super();
680      this.setStatus(status);
681      this.setReason(reason);
682      this.setCriteria(criteria);
683      this.setChannel(channel);
684    }
685
686    /**
687     * @return {@link #status} (The status of the subscription, which marks the server state for managing the subscription.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
688     */
689    public Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus> getStatusElement() { 
690      if (this.status == null)
691        if (Configuration.errorOnAutoCreate())
692          throw new Error("Attempt to auto-create Subscription.status");
693        else if (Configuration.doAutoCreate())
694          this.status = new Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus>(new org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatusEnumFactory()); // bb
695      return this.status;
696    }
697
698    public boolean hasStatusElement() { 
699      return this.status != null && !this.status.isEmpty();
700    }
701
702    public boolean hasStatus() { 
703      return this.status != null && !this.status.isEmpty();
704    }
705
706    /**
707     * @param value {@link #status} (The status of the subscription, which marks the server state for managing the subscription.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
708     */
709    public Subscription setStatusElement(Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus> value) { 
710      this.status = value;
711      return this;
712    }
713
714    /**
715     * @return The status of the subscription, which marks the server state for managing the subscription.
716     */
717    public org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus getStatus() { 
718      return this.status == null ? null : this.status.getValue();
719    }
720
721    /**
722     * @param value The status of the subscription, which marks the server state for managing the subscription.
723     */
724    public Subscription setStatus(org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus value) { 
725        if (this.status == null)
726          this.status = new Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus>(new org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatusEnumFactory());
727        this.status.setValue(value);
728      return this;
729    }
730
731    /**
732     * @return {@link #contact} (Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.)
733     */
734    public List<ContactPoint> getContact() { 
735      if (this.contact == null)
736        this.contact = new ArrayList<ContactPoint>();
737      return this.contact;
738    }
739
740    /**
741     * @return Returns a reference to <code>this</code> for easy method chaining
742     */
743    public Subscription setContact(List<ContactPoint> theContact) { 
744      this.contact = theContact;
745      return this;
746    }
747
748    public boolean hasContact() { 
749      if (this.contact == null)
750        return false;
751      for (ContactPoint item : this.contact)
752        if (!item.isEmpty())
753          return true;
754      return false;
755    }
756
757    public ContactPoint addContact() { //3
758      ContactPoint t = new ContactPoint();
759      if (this.contact == null)
760        this.contact = new ArrayList<ContactPoint>();
761      this.contact.add(t);
762      return t;
763    }
764
765    public Subscription addContact(ContactPoint t) { //3
766      if (t == null)
767        return this;
768      if (this.contact == null)
769        this.contact = new ArrayList<ContactPoint>();
770      this.contact.add(t);
771      return this;
772    }
773
774    /**
775     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
776     */
777    public ContactPoint getContactFirstRep() { 
778      if (getContact().isEmpty()) {
779        addContact();
780      }
781      return getContact().get(0);
782    }
783
784    /**
785     * @return {@link #end} (The time for the server to turn the subscription off.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
786     */
787    public InstantType getEndElement() { 
788      if (this.end == null)
789        if (Configuration.errorOnAutoCreate())
790          throw new Error("Attempt to auto-create Subscription.end");
791        else if (Configuration.doAutoCreate())
792          this.end = new InstantType(); // bb
793      return this.end;
794    }
795
796    public boolean hasEndElement() { 
797      return this.end != null && !this.end.isEmpty();
798    }
799
800    public boolean hasEnd() { 
801      return this.end != null && !this.end.isEmpty();
802    }
803
804    /**
805     * @param value {@link #end} (The time for the server to turn the subscription off.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
806     */
807    public Subscription setEndElement(InstantType value) { 
808      this.end = value;
809      return this;
810    }
811
812    /**
813     * @return The time for the server to turn the subscription off.
814     */
815    public Date getEnd() { 
816      return this.end == null ? null : this.end.getValue();
817    }
818
819    /**
820     * @param value The time for the server to turn the subscription off.
821     */
822    public Subscription setEnd(Date value) { 
823      if (value == null)
824        this.end = null;
825      else {
826        if (this.end == null)
827          this.end = new InstantType();
828        this.end.setValue(value);
829      }
830      return this;
831    }
832
833    /**
834     * @return {@link #reason} (A description of why this subscription is defined.). This is the underlying object with id, value and extensions. The accessor "getReason" gives direct access to the value
835     */
836    public StringType getReasonElement() { 
837      if (this.reason == null)
838        if (Configuration.errorOnAutoCreate())
839          throw new Error("Attempt to auto-create Subscription.reason");
840        else if (Configuration.doAutoCreate())
841          this.reason = new StringType(); // bb
842      return this.reason;
843    }
844
845    public boolean hasReasonElement() { 
846      return this.reason != null && !this.reason.isEmpty();
847    }
848
849    public boolean hasReason() { 
850      return this.reason != null && !this.reason.isEmpty();
851    }
852
853    /**
854     * @param value {@link #reason} (A description of why this subscription is defined.). This is the underlying object with id, value and extensions. The accessor "getReason" gives direct access to the value
855     */
856    public Subscription setReasonElement(StringType value) { 
857      this.reason = value;
858      return this;
859    }
860
861    /**
862     * @return A description of why this subscription is defined.
863     */
864    public String getReason() { 
865      return this.reason == null ? null : this.reason.getValue();
866    }
867
868    /**
869     * @param value A description of why this subscription is defined.
870     */
871    public Subscription setReason(String value) { 
872        if (this.reason == null)
873          this.reason = new StringType();
874        this.reason.setValue(value);
875      return this;
876    }
877
878    /**
879     * @return {@link #criteria} (The rules that the server should use to determine when to generate notifications for this subscription.). This is the underlying object with id, value and extensions. The accessor "getCriteria" gives direct access to the value
880     */
881    public StringType getCriteriaElement() { 
882      if (this.criteria == null)
883        if (Configuration.errorOnAutoCreate())
884          throw new Error("Attempt to auto-create Subscription.criteria");
885        else if (Configuration.doAutoCreate())
886          this.criteria = new StringType(); // bb
887      return this.criteria;
888    }
889
890    public boolean hasCriteriaElement() { 
891      return this.criteria != null && !this.criteria.isEmpty();
892    }
893
894    public boolean hasCriteria() { 
895      return this.criteria != null && !this.criteria.isEmpty();
896    }
897
898    /**
899     * @param value {@link #criteria} (The rules that the server should use to determine when to generate notifications for this subscription.). This is the underlying object with id, value and extensions. The accessor "getCriteria" gives direct access to the value
900     */
901    public Subscription setCriteriaElement(StringType value) { 
902      this.criteria = value;
903      return this;
904    }
905
906    /**
907     * @return The rules that the server should use to determine when to generate notifications for this subscription.
908     */
909    public String getCriteria() { 
910      return this.criteria == null ? null : this.criteria.getValue();
911    }
912
913    /**
914     * @param value The rules that the server should use to determine when to generate notifications for this subscription.
915     */
916    public Subscription setCriteria(String value) { 
917        if (this.criteria == null)
918          this.criteria = new StringType();
919        this.criteria.setValue(value);
920      return this;
921    }
922
923    /**
924     * @return {@link #error} (A record of the last error that occurred when the server processed a notification.). This is the underlying object with id, value and extensions. The accessor "getError" gives direct access to the value
925     */
926    public StringType getErrorElement() { 
927      if (this.error == null)
928        if (Configuration.errorOnAutoCreate())
929          throw new Error("Attempt to auto-create Subscription.error");
930        else if (Configuration.doAutoCreate())
931          this.error = new StringType(); // bb
932      return this.error;
933    }
934
935    public boolean hasErrorElement() { 
936      return this.error != null && !this.error.isEmpty();
937    }
938
939    public boolean hasError() { 
940      return this.error != null && !this.error.isEmpty();
941    }
942
943    /**
944     * @param value {@link #error} (A record of the last error that occurred when the server processed a notification.). This is the underlying object with id, value and extensions. The accessor "getError" gives direct access to the value
945     */
946    public Subscription setErrorElement(StringType value) { 
947      this.error = value;
948      return this;
949    }
950
951    /**
952     * @return A record of the last error that occurred when the server processed a notification.
953     */
954    public String getError() { 
955      return this.error == null ? null : this.error.getValue();
956    }
957
958    /**
959     * @param value A record of the last error that occurred when the server processed a notification.
960     */
961    public Subscription setError(String value) { 
962      if (Utilities.noString(value))
963        this.error = null;
964      else {
965        if (this.error == null)
966          this.error = new StringType();
967        this.error.setValue(value);
968      }
969      return this;
970    }
971
972    /**
973     * @return {@link #channel} (Details where to send notifications when resources are received that meet the criteria.)
974     */
975    public SubscriptionChannelComponent getChannel() { 
976      if (this.channel == null)
977        if (Configuration.errorOnAutoCreate())
978          throw new Error("Attempt to auto-create Subscription.channel");
979        else if (Configuration.doAutoCreate())
980          this.channel = new SubscriptionChannelComponent(); // cc
981      return this.channel;
982    }
983
984    public boolean hasChannel() { 
985      return this.channel != null && !this.channel.isEmpty();
986    }
987
988    /**
989     * @param value {@link #channel} (Details where to send notifications when resources are received that meet the criteria.)
990     */
991    public Subscription setChannel(SubscriptionChannelComponent value) { 
992      this.channel = value;
993      return this;
994    }
995
996      protected void listChildren(List<Property> children) {
997        super.listChildren(children);
998        children.add(new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status));
999        children.add(new Property("contact", "ContactPoint", "Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.", 0, java.lang.Integer.MAX_VALUE, contact));
1000        children.add(new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end));
1001        children.add(new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason));
1002        children.add(new Property("criteria", "string", "The rules that the server should use to determine when to generate notifications for this subscription.", 0, 1, criteria));
1003        children.add(new Property("error", "string", "A record of the last error that occurred when the server processed a notification.", 0, 1, error));
1004        children.add(new Property("channel", "", "Details where to send notifications when resources are received that meet the criteria.", 0, 1, channel));
1005      }
1006
1007      @Override
1008      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1009        switch (_hash) {
1010        case -892481550: /*status*/  return new Property("status", "code", "The status of the subscription, which marks the server state for managing the subscription.", 0, 1, status);
1011        case 951526432: /*contact*/  return new Property("contact", "ContactPoint", "Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.", 0, java.lang.Integer.MAX_VALUE, contact);
1012        case 100571: /*end*/  return new Property("end", "instant", "The time for the server to turn the subscription off.", 0, 1, end);
1013        case -934964668: /*reason*/  return new Property("reason", "string", "A description of why this subscription is defined.", 0, 1, reason);
1014        case 1952046943: /*criteria*/  return new Property("criteria", "string", "The rules that the server should use to determine when to generate notifications for this subscription.", 0, 1, criteria);
1015        case 96784904: /*error*/  return new Property("error", "string", "A record of the last error that occurred when the server processed a notification.", 0, 1, error);
1016        case 738950403: /*channel*/  return new Property("channel", "", "Details where to send notifications when resources are received that meet the criteria.", 0, 1, channel);
1017        default: return super.getNamedProperty(_hash, _name, _checkValid);
1018        }
1019
1020      }
1021
1022      @Override
1023      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1024        switch (hash) {
1025        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus>
1026        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
1027        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
1028        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // StringType
1029        case 1952046943: /*criteria*/ return this.criteria == null ? new Base[0] : new Base[] {this.criteria}; // StringType
1030        case 96784904: /*error*/ return this.error == null ? new Base[0] : new Base[] {this.error}; // StringType
1031        case 738950403: /*channel*/ return this.channel == null ? new Base[0] : new Base[] {this.channel}; // SubscriptionChannelComponent
1032        default: return super.getProperty(hash, name, checkValid);
1033        }
1034
1035      }
1036
1037      @Override
1038      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1039        switch (hash) {
1040        case -892481550: // status
1041          value = new org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1042          this.status = (Enumeration) value; // Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus>
1043          return value;
1044        case 951526432: // contact
1045          this.getContact().add(TypeConvertor.castToContactPoint(value)); // ContactPoint
1046          return value;
1047        case 100571: // end
1048          this.end = TypeConvertor.castToInstant(value); // InstantType
1049          return value;
1050        case -934964668: // reason
1051          this.reason = TypeConvertor.castToString(value); // StringType
1052          return value;
1053        case 1952046943: // criteria
1054          this.criteria = TypeConvertor.castToString(value); // StringType
1055          return value;
1056        case 96784904: // error
1057          this.error = TypeConvertor.castToString(value); // StringType
1058          return value;
1059        case 738950403: // channel
1060          this.channel = (SubscriptionChannelComponent) value; // SubscriptionChannelComponent
1061          return value;
1062        default: return super.setProperty(hash, name, value);
1063        }
1064
1065      }
1066
1067      @Override
1068      public Base setProperty(String name, Base value) throws FHIRException {
1069        if (name.equals("status")) {
1070          value = new org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1071          this.status = (Enumeration) value; // Enumeration<org.hl7.fhir.r4b.model.Enumerations.SubscriptionStatus>
1072        } else if (name.equals("contact")) {
1073          this.getContact().add(TypeConvertor.castToContactPoint(value));
1074        } else if (name.equals("end")) {
1075          this.end = TypeConvertor.castToInstant(value); // InstantType
1076        } else if (name.equals("reason")) {
1077          this.reason = TypeConvertor.castToString(value); // StringType
1078        } else if (name.equals("criteria")) {
1079          this.criteria = TypeConvertor.castToString(value); // StringType
1080        } else if (name.equals("error")) {
1081          this.error = TypeConvertor.castToString(value); // StringType
1082        } else if (name.equals("channel")) {
1083          this.channel = (SubscriptionChannelComponent) value; // SubscriptionChannelComponent
1084        } else
1085          return super.setProperty(name, value);
1086        return value;
1087      }
1088
1089      @Override
1090      public Base makeProperty(int hash, String name) throws FHIRException {
1091        switch (hash) {
1092        case -892481550:  return getStatusElement();
1093        case 951526432:  return addContact(); 
1094        case 100571:  return getEndElement();
1095        case -934964668:  return getReasonElement();
1096        case 1952046943:  return getCriteriaElement();
1097        case 96784904:  return getErrorElement();
1098        case 738950403:  return getChannel();
1099        default: return super.makeProperty(hash, name);
1100        }
1101
1102      }
1103
1104      @Override
1105      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1106        switch (hash) {
1107        case -892481550: /*status*/ return new String[] {"code"};
1108        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
1109        case 100571: /*end*/ return new String[] {"instant"};
1110        case -934964668: /*reason*/ return new String[] {"string"};
1111        case 1952046943: /*criteria*/ return new String[] {"string"};
1112        case 96784904: /*error*/ return new String[] {"string"};
1113        case 738950403: /*channel*/ return new String[] {};
1114        default: return super.getTypesForProperty(hash, name);
1115        }
1116
1117      }
1118
1119      @Override
1120      public Base addChild(String name) throws FHIRException {
1121        if (name.equals("status")) {
1122          throw new FHIRException("Cannot call addChild on a primitive type Subscription.status");
1123        }
1124        else if (name.equals("contact")) {
1125          return addContact();
1126        }
1127        else if (name.equals("end")) {
1128          throw new FHIRException("Cannot call addChild on a primitive type Subscription.end");
1129        }
1130        else if (name.equals("reason")) {
1131          throw new FHIRException("Cannot call addChild on a primitive type Subscription.reason");
1132        }
1133        else if (name.equals("criteria")) {
1134          throw new FHIRException("Cannot call addChild on a primitive type Subscription.criteria");
1135        }
1136        else if (name.equals("error")) {
1137          throw new FHIRException("Cannot call addChild on a primitive type Subscription.error");
1138        }
1139        else if (name.equals("channel")) {
1140          this.channel = new SubscriptionChannelComponent();
1141          return this.channel;
1142        }
1143        else
1144          return super.addChild(name);
1145      }
1146
1147  public String fhirType() {
1148    return "Subscription";
1149
1150  }
1151
1152      public Subscription copy() {
1153        Subscription dst = new Subscription();
1154        copyValues(dst);
1155        return dst;
1156      }
1157
1158      public void copyValues(Subscription dst) {
1159        super.copyValues(dst);
1160        dst.status = status == null ? null : status.copy();
1161        if (contact != null) {
1162          dst.contact = new ArrayList<ContactPoint>();
1163          for (ContactPoint i : contact)
1164            dst.contact.add(i.copy());
1165        };
1166        dst.end = end == null ? null : end.copy();
1167        dst.reason = reason == null ? null : reason.copy();
1168        dst.criteria = criteria == null ? null : criteria.copy();
1169        dst.error = error == null ? null : error.copy();
1170        dst.channel = channel == null ? null : channel.copy();
1171      }
1172
1173      protected Subscription typedCopy() {
1174        return copy();
1175      }
1176
1177      @Override
1178      public boolean equalsDeep(Base other_) {
1179        if (!super.equalsDeep(other_))
1180          return false;
1181        if (!(other_ instanceof Subscription))
1182          return false;
1183        Subscription o = (Subscription) other_;
1184        return compareDeep(status, o.status, true) && compareDeep(contact, o.contact, true) && compareDeep(end, o.end, true)
1185           && compareDeep(reason, o.reason, true) && compareDeep(criteria, o.criteria, true) && compareDeep(error, o.error, true)
1186           && compareDeep(channel, o.channel, true);
1187      }
1188
1189      @Override
1190      public boolean equalsShallow(Base other_) {
1191        if (!super.equalsShallow(other_))
1192          return false;
1193        if (!(other_ instanceof Subscription))
1194          return false;
1195        Subscription o = (Subscription) other_;
1196        return compareValues(status, o.status, true) && compareValues(end, o.end, true) && compareValues(reason, o.reason, true)
1197           && compareValues(criteria, o.criteria, true) && compareValues(error, o.error, true);
1198      }
1199
1200      public boolean isEmpty() {
1201        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, contact, end, reason
1202          , criteria, error, channel);
1203      }
1204
1205  @Override
1206  public ResourceType getResourceType() {
1207    return ResourceType.Subscription;
1208   }
1209
1210 /**
1211   * Search parameter: <b>contact</b>
1212   * <p>
1213   * Description: <b>Contact details for the subscription</b><br>
1214   * Type: <b>token</b><br>
1215   * Path: <b>Subscription.contact</b><br>
1216   * </p>
1217   */
1218  @SearchParamDefinition(name="contact", path="Subscription.contact", description="Contact details for the subscription", type="token" )
1219  public static final String SP_CONTACT = "contact";
1220 /**
1221   * <b>Fluent Client</b> search parameter constant for <b>contact</b>
1222   * <p>
1223   * Description: <b>Contact details for the subscription</b><br>
1224   * Type: <b>token</b><br>
1225   * Path: <b>Subscription.contact</b><br>
1226   * </p>
1227   */
1228  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTACT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTACT);
1229
1230 /**
1231   * Search parameter: <b>criteria</b>
1232   * <p>
1233   * Description: <b>The search rules used to determine when to send a notification</b><br>
1234   * Type: <b>string</b><br>
1235   * Path: <b>Subscription.criteria</b><br>
1236   * </p>
1237   */
1238  @SearchParamDefinition(name="criteria", path="Subscription.criteria", description="The search rules used to determine when to send a notification", type="string" )
1239  public static final String SP_CRITERIA = "criteria";
1240 /**
1241   * <b>Fluent Client</b> search parameter constant for <b>criteria</b>
1242   * <p>
1243   * Description: <b>The search rules used to determine when to send a notification</b><br>
1244   * Type: <b>string</b><br>
1245   * Path: <b>Subscription.criteria</b><br>
1246   * </p>
1247   */
1248  public static final ca.uhn.fhir.rest.gclient.StringClientParam CRITERIA = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_CRITERIA);
1249
1250 /**
1251   * Search parameter: <b>payload</b>
1252   * <p>
1253   * Description: <b>The mime-type of the notification payload</b><br>
1254   * Type: <b>token</b><br>
1255   * Path: <b>Subscription.channel.payload</b><br>
1256   * </p>
1257   */
1258  @SearchParamDefinition(name="payload", path="Subscription.channel.payload", description="The mime-type of the notification payload", type="token" )
1259  public static final String SP_PAYLOAD = "payload";
1260 /**
1261   * <b>Fluent Client</b> search parameter constant for <b>payload</b>
1262   * <p>
1263   * Description: <b>The mime-type of the notification payload</b><br>
1264   * Type: <b>token</b><br>
1265   * Path: <b>Subscription.channel.payload</b><br>
1266   * </p>
1267   */
1268  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PAYLOAD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PAYLOAD);
1269
1270 /**
1271   * Search parameter: <b>status</b>
1272   * <p>
1273   * Description: <b>The current state of the subscription</b><br>
1274   * Type: <b>token</b><br>
1275   * Path: <b>Subscription.status</b><br>
1276   * </p>
1277   */
1278  @SearchParamDefinition(name="status", path="Subscription.status", description="The current state of the subscription", type="token" )
1279  public static final String SP_STATUS = "status";
1280 /**
1281   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1282   * <p>
1283   * Description: <b>The current state of the subscription</b><br>
1284   * Type: <b>token</b><br>
1285   * Path: <b>Subscription.status</b><br>
1286   * </p>
1287   */
1288  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1289
1290 /**
1291   * Search parameter: <b>type</b>
1292   * <p>
1293   * Description: <b>The type of channel for the sent notifications</b><br>
1294   * Type: <b>token</b><br>
1295   * Path: <b>Subscription.channel.type</b><br>
1296   * </p>
1297   */
1298  @SearchParamDefinition(name="type", path="Subscription.channel.type", description="The type of channel for the sent notifications", type="token" )
1299  public static final String SP_TYPE = "type";
1300 /**
1301   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1302   * <p>
1303   * Description: <b>The type of channel for the sent notifications</b><br>
1304   * Type: <b>token</b><br>
1305   * Path: <b>Subscription.channel.type</b><br>
1306   * </p>
1307   */
1308  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1309
1310 /**
1311   * Search parameter: <b>url</b>
1312   * <p>
1313   * Description: <b>The uri that will receive the notifications</b><br>
1314   * Type: <b>uri</b><br>
1315   * Path: <b>Subscription.channel.endpoint</b><br>
1316   * </p>
1317   */
1318  @SearchParamDefinition(name="url", path="Subscription.channel.endpoint", description="The uri that will receive the notifications", type="uri" )
1319  public static final String SP_URL = "url";
1320 /**
1321   * <b>Fluent Client</b> search parameter constant for <b>url</b>
1322   * <p>
1323   * Description: <b>The uri that will receive the notifications</b><br>
1324   * Type: <b>uri</b><br>
1325   * Path: <b>Subscription.channel.endpoint</b><br>
1326   * </p>
1327   */
1328  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
1329
1330
1331}
1332