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.test.app.harness.api;
011
012import ca.cdr.test.app.clients.AdminJsonRestClient;
013import ca.cdr.test.app.clients.HL7V2RestClient;
014import ca.cdr.test.app.clients.OutboundSmartClient;
015import ca.uhn.fhir.context.FhirContext;
016import ca.uhn.fhir.rest.client.api.IGenericClient;
017
018/**
019 * Interface for interacting with a Smile CDR instance during testing.
020 * Provides methods to obtain various clients for communicating with the CDR,
021 * including administrative JSON clients and FHIR clients with different
022 * authentication levels.
023 */
024public interface SmileHarness {
025        /**
026         * Gets an administrative JSON client for interacting with the CDR's admin API.
027         * This will create an {@link AdminJsonRestClient} with the first available ADMIN_JSON module
028         * u
029         *
030         * @return An autodiscovered AdminJsonRestClient.
031         */
032        AdminJsonRestClient getAdminJsonClient();
033
034        /**
035         * Gets an {@link AdminJsonRestClient} for interacting with the CDR's admin API on a specific port.
036         *
037         * @param thePort The port to connect to
038         * @return The admin JSON client configured with the specified port
039         */
040        AdminJsonRestClient getAdminJsonClient(int thePort);
041
042        /**
043         * Gets a FHIR client with superuser privileges.
044         * This will create an {@link IGenericClient} with the first available FHIR_ENDPOINT module
045         *
046         * @return The FHIR client with superuser authentication
047         */
048        IGenericClient getSuperuserFhirClient();
049
050        /**
051         * Gets a FHIR client with superuser privileges on a specific port.
052         *
053         * @param thePort The port to connect to
054         * @return The FHIR client with superuser authentication on the specified port
055         */
056        IGenericClient getSuperuserFhirClient(int thePort);
057
058        /**
059         * Gets a FHIR client with superuser privileges for a specific module.
060         *
061         * @param theModuleId The ID of the module to connect to
062         * @return The FHIR client with superuser authentication for the specified module
063         */
064        IGenericClient getSuperuserFhirClient(String theModuleId);
065
066        /**
067         * Gets a standard FHIR client.
068         *
069         * @return The FHIR client with default authentication
070         */
071        IGenericClient getFhirClient();
072
073        /**
074         * Gets a standard FHIR client on a specific port.
075         *
076         * @param thePort The port to connect to
077         * @return The FHIR client with default authentication on the specified port
078         */
079        IGenericClient getFhirClient(int thePort);
080
081        /**
082         * Gets a standard FHIR client for a specific module.
083         *
084         * @param theModuleId The ID of the module to connect to
085         * @return The FHIR client with default authentication for the specified module
086         */
087        IGenericClient getFhirClient(String theModuleId);
088
089        /**
090         * Gets the FHIR context used by this harness.
091         *
092         * @return The FHIR context
093         */
094        FhirContext getFhirContext();
095
096        /**
097         * Gets the FHIR context for a specific module.
098         *
099         * @param moduleId The ID of the module
100         * @return The FHIR context for the specified module
101         */
102        FhirContext getFhirContext(String moduleId);
103
104        /**
105         * Gets an HL7V2 REST client for interacting with the CDR's HL7V2 endpoint.
106         *
107         * @return The HL7V2 REST client configured with default port
108         */
109        HL7V2RestClient getHL7V2RestClient();
110
111        /**
112         * Gets an HL7V2 REST client for interacting with the CDR's HL7V2 endpoint on a specific port.
113         *
114         * @param thePort The port to connect to
115         * @return The HL7V2 REST client configured with the specified port
116         */
117        HL7V2RestClient getHL7V2RestClient(int thePort);
118
119        /**
120         * Gets an HL7V2 REST client for a specific module.
121         *
122         * @param theModuleId The ID of the module to connect to
123         * @return The HL7V2 REST client for the specified module
124         */
125        HL7V2RestClient getHL7V2RestClient(String theModuleId);
126
127        /**
128         * Gets an outbound SMART client for OAuth 2.0 authorization flows.
129         * This will create an OutboundSmartClient targeting the first available SMART endpoint module.
130         *
131         * @return The outbound SMART client configured with default endpoint
132         */
133        OutboundSmartClient getOutboundSmartClient();
134
135        /**
136         * Gets an outbound SMART client for OAuth 2.0 authorization flows on a specific port.
137         *
138         * @param thePort The port to connect to
139         * @return The outbound SMART client configured with the specified port
140         */
141        OutboundSmartClient getOutboundSmartClient(int thePort);
142
143        /**
144         * Gets an outbound SMART client for OAuth 2.0 authorization flows for a specific module.
145         *
146         * @param theModuleId The ID of the module to connect to
147         * @return The outbound SMART client for the specified module
148         */
149        OutboundSmartClient getOutboundSmartClient(String theModuleId);
150
151}