<?php
/**
 * This code was generated by
 * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
 *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
 *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
 *
 * Twilio Conversational Intelligence API
 * The Conversational Intelligence API includes resources to create and manage intelligence configurations, define and run language operators, and retrieve processed conversations and operator results.  * Use the Configurations resource to create and manage intelligence configurations and define rules that control how and when language operators analyze and transform conversations.  * Use the Operators resource to create custom language operators or retrieve Twilio-author and custom operators. * Use the Conversations resource to retrieve conversations processed with an intelligence configuration, and the OperatorResults resource to retrieve language operator results for those conversations.
 *
 * NOTE: This class is auto generated by OpenAPI Generator.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Twilio\Rest\Intelligence\V3;

use Twilio\Http\Response;
use Twilio\TokenPaginationPage;
use Twilio\ApiV1Version;
use Twilio\Version;

class ConversationPage extends TokenPaginationPage
    {
    /**
     * @param Version $version Version that contains the resource
     * @param Response $response Response from the API
     * @param array $solution The context solution
     */
    public function __construct(Version $version, Response $response, array $solution)
    {
        $apiV1Version = new ApiV1Version($version->getDomain(), $version->version);
        parent::__construct($apiV1Version, $response);

        // Path Solution
        $this->solution = $solution;
    }

    /**
     * @param array $payload Payload response from the API
     * @return ConversationListItemInstance \Twilio\Rest\Intelligence\V3\ConversationListItemInstance
     */
    public function buildInstance(array $payload): ConversationListItemInstance
    {
        return new ConversationListItemInstance($this->version, $payload);
    }


    /**
     * Override current() to return primitive values directly instead of wrapping in Instance objects
     * This is used when the list contains primitives (strings, integers, etc.) rather than complex objects
     *
     * @return mixed The current primitive value from the list
     */
    #[\ReturnTypeWillChange]
    public function current()
    {
        return $this->records->current();
    }


    /**
     * Provide a friendly representation
     *
     * @return string Machine friendly representation
     */
    public function __toString(): string
    {
        return '[Twilio.Intelligence.V3.ConversationPage]';
    }
}
