001/*-
002 * #%L
003 * Smile CDR - CDR
004 * %%
005 * Copyright (C) 2016 - 2024 Smile CDR, Inc.
006 * %%
007 * All rights reserved.
008 * #L%
009 */
010package ca.cdr.api.pub.hl7v2.common.abstraction;
011
012import ca.uhn.hl7v2.model.v25.segment.OBR;
013import ca.uhn.hl7v2.model.v25.segment.ORC;
014
015import java.util.function.Function;
016
017public class OrderMessageOrder<T> implements IOrderMessage.IOrder {
018
019        private final T myWrappingMessage;
020        private final Function<T, ORC> myOrcFunction;
021        private final Function<T, OBR> myObrFunction;
022
023        public OrderMessageOrder(T theWrappingMessage, Function<T, ORC> theOrcFunction, Function<T, OBR> theObrFunction) {
024                myWrappingMessage = theWrappingMessage;
025                myOrcFunction = theOrcFunction;
026                myObrFunction = theObrFunction;
027        }
028
029        @Override
030        public ORC getOrc() {
031                return myOrcFunction.apply(myWrappingMessage);
032        }
033
034        @Override
035        public OBR getObr() {
036                return myObrFunction.apply(myWrappingMessage);
037        }
038}