# frozen_string_literal: true

module OpenAI
  module Models
    module Chat
      class ChatCompletionStoreMessage < OpenAI::Models::Chat::ChatCompletionMessage
        # @!attribute id
        #   The identifier of the chat message.
        #
        #   @return [String]
        required :id, String

        # @!attribute content_parts
        #   If a content parts array was provided, this is an array of `text` and
        #   `image_url` parts. Otherwise, null.
        #
        #   @return [Array<OpenAI::Models::Chat::ChatCompletionContentPartText, OpenAI::Models::Chat::ChatCompletionContentPartImage>, nil]
        optional :content_parts,
                 -> {
                   OpenAI::Internal::Type::ArrayOf[union: OpenAI::Chat::ChatCompletionStoreMessage::ContentPart]
                 },
                 nil?: true

        # @!method initialize(id:, content_parts: nil)
        #   Some parameter documentations has been truncated, see
        #   {OpenAI::Models::Chat::ChatCompletionStoreMessage} for more details.
        #
        #   A chat completion message generated by the model.
        #
        #   @param id [String] The identifier of the chat message.
        #
        #   @param content_parts [Array<OpenAI::Models::Chat::ChatCompletionContentPartText, OpenAI::Models::Chat::ChatCompletionContentPartImage>, nil] If a content parts array was provided, this is an array of `text` and `image_url

        # Learn about
        # [text inputs](https://platform.openai.com/docs/guides/text-generation).
        module ContentPart
          extend OpenAI::Internal::Type::Union

          # Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation).
          variant -> { OpenAI::Chat::ChatCompletionContentPartText }

          # Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
          variant -> { OpenAI::Chat::ChatCompletionContentPartImage }

          # @!method self.variants
          #   @return [Array(OpenAI::Models::Chat::ChatCompletionContentPartText, OpenAI::Models::Chat::ChatCompletionContentPartImage)]
        end
      end
    end

    ChatCompletionStoreMessage = Chat::ChatCompletionStoreMessage
  end
end
