# frozen_string_literal: true

module OpenAI
  module Models
    module Responses
      class ResponseCustomToolCallOutput < OpenAI::Internal::Type::BaseModel
        # @!attribute call_id
        #   The call ID, used to map this custom tool call output to a custom tool call.
        #
        #   @return [String]
        required :call_id, String

        # @!attribute output
        #   The output from the custom tool call generated by your code. Can be a string or
        #   an list of output content.
        #
        #   @return [String, Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile>]
        required :output, union: -> { OpenAI::Responses::ResponseCustomToolCallOutput::Output }

        # @!attribute type
        #   The type of the custom tool call output. Always `custom_tool_call_output`.
        #
        #   @return [Symbol, :custom_tool_call_output]
        required :type, const: :custom_tool_call_output

        # @!attribute id
        #   The unique ID of the custom tool call output in the OpenAI platform.
        #
        #   @return [String, nil]
        optional :id, String

        # @!method initialize(call_id:, output:, id: nil, type: :custom_tool_call_output)
        #   Some parameter documentations has been truncated, see
        #   {OpenAI::Models::Responses::ResponseCustomToolCallOutput} for more details.
        #
        #   The output of a custom tool call from your code, being sent back to the model.
        #
        #   @param call_id [String] The call ID, used to map this custom tool call output to a custom tool call.
        #
        #   @param output [String, Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile>] The output from the custom tool call generated by your code.
        #
        #   @param id [String] The unique ID of the custom tool call output in the OpenAI platform.
        #
        #   @param type [Symbol, :custom_tool_call_output] The type of the custom tool call output. Always `custom_tool_call_output`.

        # The output from the custom tool call generated by your code. Can be a string or
        # an list of output content.
        #
        # @see OpenAI::Models::Responses::ResponseCustomToolCallOutput#output
        module Output
          extend OpenAI::Internal::Type::Union

          # A string of the output of the custom tool call.
          variant String

          # Text, image, or file output of the custom tool call.
          variant -> { OpenAI::Models::Responses::ResponseCustomToolCallOutput::Output::OutputContentListArray }

          # A text input to the model.
          module OutputContentList
            extend OpenAI::Internal::Type::Union

            discriminator :type

            # A text input to the model.
            variant :input_text, -> { OpenAI::Responses::ResponseInputText }

            # An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
            variant :input_image, -> { OpenAI::Responses::ResponseInputImage }

            # A file input to the model.
            variant :input_file, -> { OpenAI::Responses::ResponseInputFile }

            # @!method self.variants
            #   @return [Array(OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile)]
          end

          # @!method self.variants
          #   @return [Array(String, Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile>)]

          # @type [OpenAI::Internal::Type::Converter]
          OutputContentListArray =
            OpenAI::Internal::Type::ArrayOf[union: -> {
              OpenAI::Responses::ResponseCustomToolCallOutput::Output::OutputContentList
            }]
        end
      end
    end
  end
end
