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