1 <?php
namespace OpenEMR\FHIR\R4\FHIRResource\FHIRConsent
;
4 * This class was generated with the PHPFHIR library (https://github.com/dcarbone/php-fhir) using
5 * class definitions from HL7 FHIR (https://www.hl7.org/fhir/)
7 * Class creation date: June 14th, 2019
11 * Copyright 2016-2017 Daniel Carbone (daniel.p.carbone@gmail.com)
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
17 * http://www.apache.org/licenses/LICENSE-2.0
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
26 * FHIR Copyright Notice:
28 * Copyright (c) 2011+, HL7, Inc.
29 * All rights reserved.
31 * Redistribution and use in source and binary forms, with or without modification,
32 * are permitted provided that the following conditions are met:
34 * * Redistributions of source code must retain the above copyright notice, this
35 * list of conditions and the following disclaimer.
36 * * Redistributions in binary form must reproduce the above copyright notice,
37 * this list of conditions and the following disclaimer in the documentation
38 * and/or other materials provided with the distribution.
39 * * Neither the name of HL7 nor the names of its contributors may be used to
40 * endorse or promote products derived from this software without specific
41 * prior written permission.
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
45 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
46 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
47 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
49 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
50 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
52 * POSSIBILITY OF SUCH DAMAGE.
55 * Generated on Thu, Dec 27, 2018 22:37+1100 for FHIR v4.0.0
57 * Note: the schemas & schematrons do not contain all of the rules about what makes resources
58 * valid. Implementers will still need to be familiar with the content of the specification and with
59 * any profiles that apply to the resources in order to make a conformant implementation.
63 use OpenEMR\FHIR\R4\FHIRElement\FHIRBackboneElement
;
66 * A record of a healthcare consumer’s choices, which permits or denies identified recipient(s) or recipient role(s) to perform one or more actions within a given policy context, for specific purposes and periods of time.
68 class FHIRConsentProvision
extends FHIRBackboneElement
implements \JsonSerializable
71 * Action to take - permit or deny - when the rule conditions are met. Not permitted in root rule, required in all nested rules.
72 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRConsentProvisionType
77 * The timeframe in this rule is valid.
78 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod
80 public $period = null;
83 * Who or what is controlled by this rule. Use group to identify a set of actors by some property they share (e.g. 'admitting officers').
84 * @var \OpenEMR\FHIR\R4\FHIRResource\FHIRConsent\FHIRConsentActor[]
89 * Actions controlled by this Rule.
90 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept[]
95 * A security label, comprised of 0..* security label fields (Privacy tags), which define which resources are controlled by this exception.
96 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding[]
98 public $securityLabel = [];
101 * The context of the activities a user is taking - why the user is accessing the data - that are controlled by this rule.
102 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding[]
104 public $purpose = [];
107 * The class of information covered by this rule. The type can be a FHIR resource type, a profile on a type, or a CDA document, or some other type that indicates what sort of information the consent relates to.
108 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding[]
113 * If this code is found in an instance, then the rule applies.
114 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept[]
119 * Clinical or Operational Relevant period of time that bounds the data controlled by this rule.
120 * @var \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod
122 public $dataPeriod = null;
125 * The resources controlled by this rule if specific resources are referenced.
126 * @var \OpenEMR\FHIR\R4\FHIRResource\FHIRConsent\FHIRConsentData[]
131 * Rules which provide exceptions to the base rule or subrules.
132 * @var \OpenEMR\FHIR\R4\FHIRResource\FHIRConsent\FHIRConsentProvision[]
134 public $provision = [];
139 private $_fhirElementName = 'Consent.Provision';
142 * Action to take - permit or deny - when the rule conditions are met. Not permitted in root rule, required in all nested rules.
143 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRConsentProvisionType
145 public function getType()
151 * Action to take - permit or deny - when the rule conditions are met. Not permitted in root rule, required in all nested rules.
152 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRConsentProvisionType $type
155 public function setType($type)
162 * The timeframe in this rule is valid.
163 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod
165 public function getPeriod()
167 return $this->period
;
171 * The timeframe in this rule is valid.
172 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod $period
175 public function setPeriod($period)
177 $this->period
= $period;
182 * Who or what is controlled by this rule. Use group to identify a set of actors by some property they share (e.g. 'admitting officers').
183 * @return \OpenEMR\FHIR\R4\FHIRResource\FHIRConsent\FHIRConsentActor[]
185 public function getActor()
191 * Who or what is controlled by this rule. Use group to identify a set of actors by some property they share (e.g. 'admitting officers').
192 * @param \OpenEMR\FHIR\R4\FHIRResource\FHIRConsent\FHIRConsentActor $actor
195 public function addActor($actor)
197 $this->actor
[] = $actor;
202 * Actions controlled by this Rule.
203 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept[]
205 public function getAction()
207 return $this->action
;
211 * Actions controlled by this Rule.
212 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept $action
215 public function addAction($action)
217 $this->action
[] = $action;
222 * A security label, comprised of 0..* security label fields (Privacy tags), which define which resources are controlled by this exception.
223 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding[]
225 public function getSecurityLabel()
227 return $this->securityLabel
;
231 * A security label, comprised of 0..* security label fields (Privacy tags), which define which resources are controlled by this exception.
232 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding $securityLabel
235 public function addSecurityLabel($securityLabel)
237 $this->securityLabel
[] = $securityLabel;
242 * The context of the activities a user is taking - why the user is accessing the data - that are controlled by this rule.
243 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding[]
245 public function getPurpose()
247 return $this->purpose
;
251 * The context of the activities a user is taking - why the user is accessing the data - that are controlled by this rule.
252 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding $purpose
255 public function addPurpose($purpose)
257 $this->purpose
[] = $purpose;
262 * The class of information covered by this rule. The type can be a FHIR resource type, a profile on a type, or a CDA document, or some other type that indicates what sort of information the consent relates to.
263 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding[]
265 public function getClass()
271 * The class of information covered by this rule. The type can be a FHIR resource type, a profile on a type, or a CDA document, or some other type that indicates what sort of information the consent relates to.
272 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCoding $class
275 public function addClass($class)
277 $this->class[] = $class;
282 * If this code is found in an instance, then the rule applies.
283 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept[]
285 public function getCode()
291 * If this code is found in an instance, then the rule applies.
292 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRCodeableConcept $code
295 public function addCode($code)
297 $this->code
[] = $code;
302 * Clinical or Operational Relevant period of time that bounds the data controlled by this rule.
303 * @return \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod
305 public function getDataPeriod()
307 return $this->dataPeriod
;
311 * Clinical or Operational Relevant period of time that bounds the data controlled by this rule.
312 * @param \OpenEMR\FHIR\R4\FHIRElement\FHIRPeriod $dataPeriod
315 public function setDataPeriod($dataPeriod)
317 $this->dataPeriod
= $dataPeriod;
322 * The resources controlled by this rule if specific resources are referenced.
323 * @return \OpenEMR\FHIR\R4\FHIRResource\FHIRConsent\FHIRConsentData[]
325 public function getData()
331 * The resources controlled by this rule if specific resources are referenced.
332 * @param \OpenEMR\FHIR\R4\FHIRResource\FHIRConsent\FHIRConsentData $data
335 public function addData($data)
337 $this->data
[] = $data;
342 * Rules which provide exceptions to the base rule or subrules.
343 * @return \OpenEMR\FHIR\R4\FHIRResource\FHIRConsent\FHIRConsentProvision[]
345 public function getProvision()
347 return $this->provision
;
351 * Rules which provide exceptions to the base rule or subrules.
352 * @param \OpenEMR\FHIR\R4\FHIRResource\FHIRConsent\FHIRConsentProvision $provision
355 public function addProvision($provision)
357 $this->provision
[] = $provision;
364 public function get_fhirElementName()
366 return $this->_fhirElementName
;
372 public function __construct($data = [])
374 if (is_array($data)) {
375 if (isset($data['type'])) {
376 $this->setType($data['type']);
378 if (isset($data['period'])) {
379 $this->setPeriod($data['period']);
381 if (isset($data['actor'])) {
382 if (is_array($data['actor'])) {
383 foreach ($data['actor'] as $d) {
387 throw new \
InvalidArgumentException('"actor" must be array of objects or null, '.gettype($data['actor']).' seen.');
390 if (isset($data['action'])) {
391 if (is_array($data['action'])) {
392 foreach ($data['action'] as $d) {
393 $this->addAction($d);
396 throw new \
InvalidArgumentException('"action" must be array of objects or null, '.gettype($data['action']).' seen.');
399 if (isset($data['securityLabel'])) {
400 if (is_array($data['securityLabel'])) {
401 foreach ($data['securityLabel'] as $d) {
402 $this->addSecurityLabel($d);
405 throw new \
InvalidArgumentException('"securityLabel" must be array of objects or null, '.gettype($data['securityLabel']).' seen.');
408 if (isset($data['purpose'])) {
409 if (is_array($data['purpose'])) {
410 foreach ($data['purpose'] as $d) {
411 $this->addPurpose($d);
414 throw new \
InvalidArgumentException('"purpose" must be array of objects or null, '.gettype($data['purpose']).' seen.');
417 if (isset($data['class'])) {
418 if (is_array($data['class'])) {
419 foreach ($data['class'] as $d) {
423 throw new \
InvalidArgumentException('"class" must be array of objects or null, '.gettype($data['class']).' seen.');
426 if (isset($data['code'])) {
427 if (is_array($data['code'])) {
428 foreach ($data['code'] as $d) {
432 throw new \
InvalidArgumentException('"code" must be array of objects or null, '.gettype($data['code']).' seen.');
435 if (isset($data['dataPeriod'])) {
436 $this->setDataPeriod($data['dataPeriod']);
438 if (isset($data['data'])) {
439 if (is_array($data['data'])) {
440 foreach ($data['data'] as $d) {
444 throw new \
InvalidArgumentException('"data" must be array of objects or null, '.gettype($data['data']).' seen.');
447 if (isset($data['provision'])) {
448 if (is_array($data['provision'])) {
449 foreach ($data['provision'] as $d) {
450 $this->addProvision($d);
453 throw new \
InvalidArgumentException('"provision" must be array of objects or null, '.gettype($data['provision']).' seen.');
456 } else if (null !== $data) {
457 throw new \
InvalidArgumentException('$data expected to be array of values, saw "'.gettype($data).'"');
459 parent
::__construct($data);
465 public function __toString()
467 return $this->get_fhirElementName();
473 public function jsonSerialize()
475 $json = parent
::jsonSerialize();
476 if (isset($this->type
)) {
477 $json['type'] = $this->type
;
479 if (isset($this->period
)) {
480 $json['period'] = $this->period
;
482 if (0 < count($this->actor
)) {
484 foreach ($this->actor
as $actor) {
485 $json['actor'][] = $actor;
488 if (0 < count($this->action
)) {
489 $json['action'] = [];
490 foreach ($this->action
as $action) {
491 $json['action'][] = $action;
494 if (0 < count($this->securityLabel
)) {
495 $json['securityLabel'] = [];
496 foreach ($this->securityLabel
as $securityLabel) {
497 $json['securityLabel'][] = $securityLabel;
500 if (0 < count($this->purpose
)) {
501 $json['purpose'] = [];
502 foreach ($this->purpose
as $purpose) {
503 $json['purpose'][] = $purpose;
506 if (0 < count($this->class)) {
508 foreach ($this->class as $class) {
509 $json['class'][] = $class;
512 if (0 < count($this->code
)) {
514 foreach ($this->code
as $code) {
515 $json['code'][] = $code;
518 if (isset($this->dataPeriod
)) {
519 $json['dataPeriod'] = $this->dataPeriod
;
521 if (0 < count($this->data
)) {
523 foreach ($this->data
as $data) {
524 $json['data'][] = $data;
527 if (0 < count($this->provision
)) {
528 $json['provision'] = [];
529 foreach ($this->provision
as $provision) {
530 $json['provision'][] = $provision;
537 * @param boolean $returnSXE
538 * @param \SimpleXMLElement $sxe
539 * @return string|\SimpleXMLElement
541 public function xmlSerialize($returnSXE = false, $sxe = null)
544 $sxe = new \
SimpleXMLElement('<ConsentProvision xmlns="http://hl7.org/fhir"></ConsentProvision>');
546 parent
::xmlSerialize(true, $sxe);
547 if (isset($this->type
)) {
548 $this->type
->xmlSerialize(true, $sxe->addChild('type'));
550 if (isset($this->period
)) {
551 $this->period
->xmlSerialize(true, $sxe->addChild('period'));
553 if (0 < count($this->actor
)) {
554 foreach ($this->actor
as $actor) {
555 $actor->xmlSerialize(true, $sxe->addChild('actor'));
558 if (0 < count($this->action
)) {
559 foreach ($this->action
as $action) {
560 $action->xmlSerialize(true, $sxe->addChild('action'));
563 if (0 < count($this->securityLabel
)) {
564 foreach ($this->securityLabel
as $securityLabel) {
565 $securityLabel->xmlSerialize(true, $sxe->addChild('securityLabel'));
568 if (0 < count($this->purpose
)) {
569 foreach ($this->purpose
as $purpose) {
570 $purpose->xmlSerialize(true, $sxe->addChild('purpose'));
573 if (0 < count($this->class)) {
574 foreach ($this->class as $class) {
575 $class->xmlSerialize(true, $sxe->addChild('class'));
578 if (0 < count($this->code
)) {
579 foreach ($this->code
as $code) {
580 $code->xmlSerialize(true, $sxe->addChild('code'));
583 if (isset($this->dataPeriod
)) {
584 $this->dataPeriod
->xmlSerialize(true, $sxe->addChild('dataPeriod'));
586 if (0 < count($this->data
)) {
587 foreach ($this->data
as $data) {
588 $data->xmlSerialize(true, $sxe->addChild('data'));
591 if (0 < count($this->provision
)) {
592 foreach ($this->provision
as $provision) {
593 $provision->xmlSerialize(true, $sxe->addChild('provision'));
599 return $sxe->saveXML();