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.fhir.tokenization;
011
012import ca.uhn.fhir.rest.api.server.RequestDetails;
013import org.hl7.fhir.instance.model.api.IBase;
014
015/**
016 * This class represents a single request to "de-tokenize" a previously tokenized string.
017 * The request will be processed by the same {@link ITokenizationProvider} that originally
018 * provided the tokenized string.
019 */
020public class DetokenizationRequest {
021
022        private final String myToken;
023        private final IBase myTarget;
024
025        /**
026         * Constructor
027         */
028        public DetokenizationRequest(IBase theTarget, String theToken) {
029                myTarget = theTarget;
030                myToken = theToken;
031        }
032
033        /**
034         * This is the object which will receive the detokenized value. For example, if an Identifier instance was
035         * originally passed to the {@link ITokenizationProvider#tokenize(RequestDetails, TokenizationRequests)} method,
036         * then this will contain an empty Identifier instance. The provider does not need to modify or otherwise
037         * touch this object, but it is provided in case it will be helpful to the de-tokenization algorithm.
038         */
039        public IBase getTarget() {
040                return myTarget;
041        }
042
043        /**
044         * This is the token string which needs to be reversed. In other words, this is the string that was
045         * previously supplied to {@link TokenizationResults#addResult(TokenizationRequest, String)} by the
046         * provider.
047         */
048        public String getToken() {
049                return myToken;
050        }
051}