// File generated from our OpenAPI spec by Stainless.

package com.increase.api.services.async

import com.increase.api.TestServerExtension
import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync
import com.increase.api.models.entityonboardingsessions.EntityOnboardingSessionCreateParams
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith

@ExtendWith(TestServerExtension::class)
internal class EntityOnboardingSessionServiceAsyncTest {

    @Test
    fun create() {
        val client =
            IncreaseOkHttpClientAsync.builder()
                .baseUrl(TestServerExtension.BASE_URL)
                .apiKey("My API Key")
                .build()
        val entityOnboardingSessionServiceAsync = client.entityOnboardingSessions()

        val entityOnboardingSessionFuture =
            entityOnboardingSessionServiceAsync.create(
                EntityOnboardingSessionCreateParams.builder()
                    .programId("program_i2v2os4mwza1oetokh9i")
                    .redirectUrl("https://example.com/onboarding/session")
                    .entityId("entity_id")
                    .build()
            )

        val entityOnboardingSession = entityOnboardingSessionFuture.get()
        entityOnboardingSession.validate()
    }

    @Test
    fun retrieve() {
        val client =
            IncreaseOkHttpClientAsync.builder()
                .baseUrl(TestServerExtension.BASE_URL)
                .apiKey("My API Key")
                .build()
        val entityOnboardingSessionServiceAsync = client.entityOnboardingSessions()

        val entityOnboardingSessionFuture =
            entityOnboardingSessionServiceAsync.retrieve(
                "entity_onboarding_session_wid2ug11fsmvh3k9hymd"
            )

        val entityOnboardingSession = entityOnboardingSessionFuture.get()
        entityOnboardingSession.validate()
    }

    @Test
    fun list() {
        val client =
            IncreaseOkHttpClientAsync.builder()
                .baseUrl(TestServerExtension.BASE_URL)
                .apiKey("My API Key")
                .build()
        val entityOnboardingSessionServiceAsync = client.entityOnboardingSessions()

        val pageFuture = entityOnboardingSessionServiceAsync.list()

        val page = pageFuture.get()
        page.response().validate()
    }

    @Test
    fun expire() {
        val client =
            IncreaseOkHttpClientAsync.builder()
                .baseUrl(TestServerExtension.BASE_URL)
                .apiKey("My API Key")
                .build()
        val entityOnboardingSessionServiceAsync = client.entityOnboardingSessions()

        val entityOnboardingSessionFuture =
            entityOnboardingSessionServiceAsync.expire(
                "entity_onboarding_session_wid2ug11fsmvh3k9hymd"
            )

        val entityOnboardingSession = entityOnboardingSessionFuture.get()
        entityOnboardingSession.validate()
    }
}
