<?php
/**
 * This code was generated by
 * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
 *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
 *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
 *
 * Twilio Knowledge API
 * APIs for managing knowledge bases and knowledge content for AI-powered applications.
 *
 * NOTE: This class is auto generated by OpenAPI Generator.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Twilio\Rest\Knowledge\V2;

use Twilio\Values;
abstract class SearchModels
{
    /**
     * @property string $query The query to search the knowledge source.
     * @property int $top The top K results to return.
     * @property string[] $knowledgeIds The list of knowledge IDs to search.
    */
    public static function createKnowledgeSearch(array $payload = []): KnowledgeSearch
    {
        return new KnowledgeSearch($payload);
    }

}

class KnowledgeSearch implements \JsonSerializable
{
    /**
     * @property string $query The query to search the knowledge source.
     * @property int $top The top K results to return.
     * @property string[] $knowledgeIds The list of knowledge IDs to search.
    */
        protected $query;
        protected $top;
        protected $knowledgeIds;
    public function __construct(array $payload = []) {
        $this->query = Values::array_get($payload, 'query');
        $this->top = Values::array_get($payload, 'top');
        $this->knowledgeIds = Values::array_get($payload, 'knowledgeIds');
    }

    public function toArray(): array
    {
        return $this->jsonSerialize();
    }

    public function jsonSerialize(): array
    {
        $jsonString = [
            'query' => $this->query,
            'top' => $this->top
        ];
        if (isset($this->knowledgeIds)) {
            $jsonString['knowledgeIds'] = $this->knowledgeIds;
        }
        return $jsonString;
    }
}

