/* 
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

package dev.plexapi.sdk;

import dev.plexapi.sdk.hooks.SDKHooks;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.Hook.SdkInitData;
import dev.plexapi.sdk.utils.Hooks;
import dev.plexapi.sdk.utils.RetryConfig;
import java.lang.Object;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

class SDKConfiguration {
    public SecuritySource securitySource;
    
    public Optional<SecuritySource> securitySource() {
        return Optional.ofNullable(securitySource);
    }
    public HTTPClient defaultClient;
    public String serverUrl;
    public int serverIdx = 0;
    List<Map<String, String>> serverDefaults = new ArrayList<>(){ {
        add(new HashMap<>(){ {
            put("protocol", "https");
            put("ip", "10.10.10.47");
            put("port", "32400");
        } });
    } };
    private static final String LANGUAGE = "java";
    public static final String OPENAPI_DOC_VERSION = "0.0.3";
    public static final String SDK_VERSION = "0.9.0";
    public static final String GEN_VERSION = "2.429.0";
    private static final String BASE_PACKAGE = "dev.plexapi.sdk";
    public static final String USER_AGENT = 
            String.format("speakeasy-sdk/%s %s %s %s %s", 
                LANGUAGE, SDK_VERSION, GEN_VERSION, OPENAPI_DOC_VERSION, BASE_PACKAGE);

    private Hooks _hooks = createHooks();

    private static Hooks createHooks() {
        Hooks hooks = new Hooks();
        return hooks;
    }
    
    public Hooks hooks() {
        return _hooks;
    }

    public void setHooks(Hooks hooks) {
        this._hooks = hooks;
    }

    /** 
     * Initializes state (for example hooks).
     **/
    public void initialize() {
        SDKHooks.initialize(_hooks);
        // apply the sdk init hook immediately
        SdkInitData data = _hooks.sdkInit(new SdkInitData(serverUrl, defaultClient));
        this.serverUrl = data.baseUrl();
        this.defaultClient = data.client();
    }

    @SuppressWarnings("serial")
    public Map<String, Map<String, Map<String,Object>>> globals = new HashMap<>(){ {
        put("parameters", new HashMap<>());
    } };
    
    public Map<String, String> getServerVariableDefaults() {
        return serverDefaults.get(this.serverIdx);
    }
    public Optional<RetryConfig> retryConfig = Optional.empty();
}
