001/*-
002 * #%L
003 * Smile CDR - CDR
004 * %%
005 * Copyright (C) 2016 - 2025 Smile CDR, Inc.
006 * %%
007 * All rights reserved.
008 * #L%
009 */
010package ca.cdr.api.consent;
011
012import ca.cdr.api.model.json.UserSessionDetailsJson;
013import org.hl7.fhir.instance.model.api.IBaseResource;
014
015import java.util.HashMap;
016import java.util.Map;
017
018/**
019 * A consent resource policy request containing:
020 * <ol>
021 *     <li>The policy name which should be mapped to a new instance of an {@link ca.uhn.fhir.rest.server.interceptor.consent.IConsentService}</li>
022 *     <li>The Consent resource for the request ({@link IBaseResource})</li>
023 *     <li>The {@link UserSessionDetailsJson} of the user making the request.</li>
024 *     <li>A list of parameters that can be used to specify additional information used to build the
025 *     {@link ca.uhn.fhir.rest.server.interceptor.consent.IConsentService}.</li>
026 * </ol>
027 */
028public class ConsentResourcePolicyRequest {
029        private final String myPolicyName;
030        private final IBaseResource myConsent;
031        private final UserSessionDetailsJson myUserSessionDetailsJson;
032        private final Map<String, String> myParameters;
033
034        public ConsentResourcePolicyRequest(
035                        String thePolicyName, IBaseResource theConsent, UserSessionDetailsJson theUserSessionDetails) {
036                myPolicyName = thePolicyName;
037                myConsent = theConsent;
038                myUserSessionDetailsJson = theUserSessionDetails;
039                myParameters = new HashMap<>();
040        }
041
042        public String getPolicyName() {
043                return myPolicyName;
044        }
045
046        public IBaseResource getConsent() {
047                return myConsent;
048        }
049
050        public UserSessionDetailsJson getUserSessionDetailsJson() {
051                return myUserSessionDetailsJson;
052        }
053
054        public void addParameters(String theKey, String theValue) {
055                myParameters.put(theKey, theValue);
056        }
057
058        public Map<String, String> getParameters() {
059                return myParameters;
060        }
061}