// File generated from our OpenAPI spec by Stainless.

package com.openai.models.realtime

import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import com.openai.core.jsonMapper
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

internal class AudioTranscriptionTest {

    @Test
    fun create() {
        val audioTranscription =
            AudioTranscription.builder()
                .delay(AudioTranscription.Delay.MINIMAL)
                .language("language")
                .model(AudioTranscription.Model.WHISPER_1)
                .prompt("prompt")
                .build()

        assertThat(audioTranscription.delay()).contains(AudioTranscription.Delay.MINIMAL)
        assertThat(audioTranscription.language()).contains("language")
        assertThat(audioTranscription.model()).contains(AudioTranscription.Model.WHISPER_1)
        assertThat(audioTranscription.prompt()).contains("prompt")
    }

    @Test
    fun roundtrip() {
        val jsonMapper = jsonMapper()
        val audioTranscription =
            AudioTranscription.builder()
                .delay(AudioTranscription.Delay.MINIMAL)
                .language("language")
                .model(AudioTranscription.Model.WHISPER_1)
                .prompt("prompt")
                .build()

        val roundtrippedAudioTranscription =
            jsonMapper.readValue(
                jsonMapper.writeValueAsString(audioTranscription),
                jacksonTypeRef<AudioTranscription>(),
            )

        assertThat(roundtrippedAudioTranscription).isEqualTo(audioTranscription)
    }
}
