// File generated from our OpenAPI spec by Stainless.

package com.increase.api.services.blocking

import com.increase.api.TestServerExtension
import com.increase.api.client.okhttp.IncreaseOkHttpClient
import com.increase.api.models.inboundmailitems.InboundMailItemActionParams
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith

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

    @Test
    fun retrieve() {
        val client =
            IncreaseOkHttpClient.builder()
                .baseUrl(TestServerExtension.BASE_URL)
                .apiKey("My API Key")
                .build()
        val inboundMailItemService = client.inboundMailItems()

        val inboundMailItem =
            inboundMailItemService.retrieve("inbound_mail_item_q6rrg7mmqpplx80zceev")

        inboundMailItem.validate()
    }

    @Test
    fun list() {
        val client =
            IncreaseOkHttpClient.builder()
                .baseUrl(TestServerExtension.BASE_URL)
                .apiKey("My API Key")
                .build()
        val inboundMailItemService = client.inboundMailItems()

        val page = inboundMailItemService.list()

        page.response().validate()
    }

    @Test
    fun action() {
        val client =
            IncreaseOkHttpClient.builder()
                .baseUrl(TestServerExtension.BASE_URL)
                .apiKey("My API Key")
                .build()
        val inboundMailItemService = client.inboundMailItems()

        val inboundMailItem =
            inboundMailItemService.action(
                InboundMailItemActionParams.builder()
                    .inboundMailItemId("inbound_mail_item_q6rrg7mmqpplx80zceev")
                    .addCheck(
                        InboundMailItemActionParams.Check.builder()
                            .action(InboundMailItemActionParams.Check.Action.DEPOSIT)
                            .accountId("account_in71c4amph0vgo2qllky")
                            .build()
                    )
                    .addCheck(
                        InboundMailItemActionParams.Check.builder()
                            .action(InboundMailItemActionParams.Check.Action.IGNORE)
                            .accountId("account_in71c4amph0vgo2qllky")
                            .build()
                    )
                    .build()
            )

        inboundMailItem.validate()
    }
}
