<?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 KnowledgeModels
{
    /**
     * @property string $type Raw text knowledge sources
     * @property string $content The raw text content to be processed
     * @property string $url The URL to crawl for web content
     * @property int $crawlDepth The maximum depth to crawl from the source URL
     * @property string $crawlPeriod Frequency of re-crawling the website for updated content
     * @property string $fileName Name of the file to be uploaded
     * @property int $fileSize Expected size of the file in bytes
     * @property string $mimeType
     * @property string $importUrl Presigned S3 URL for file upload (when status is SCHEDULED) or the permanent S3 location after upload completes. Use PUT method to upload the file to this URL when status is SCHEDULED.
     * @property \DateTime $uploadExpiration Expiration time of the presigned upload URL in ISO 8601 format (only present when status is SCHEDULED)
    */
    public static function createKnowledgeSourceTypes(array $payload = []): KnowledgeSourceTypes
    {
        return new KnowledgeSourceTypes($payload);
    }

    /**
     * @property string $name The name of the knowledge source.
     * @property string $description A detailed description of the knowledge source and when to use it.  This helps provide context about the content and its intended purpose.
     * @property KnowledgeSourceTypes $source
    */
    public static function createKnowledgeCore(array $payload = []): KnowledgeCore
    {
        return new KnowledgeCore($payload);
    }

}

class KnowledgeSourceTypes implements \JsonSerializable
{
    /**
     * @property string $type Raw text knowledge sources
     * @property string $content The raw text content to be processed
     * @property string $url The URL to crawl for web content
     * @property int $crawlDepth The maximum depth to crawl from the source URL
     * @property string $crawlPeriod Frequency of re-crawling the website for updated content
     * @property string $fileName Name of the file to be uploaded
     * @property int $fileSize Expected size of the file in bytes
     * @property string $mimeType
     * @property string $importUrl Presigned S3 URL for file upload (when status is SCHEDULED) or the permanent S3 location after upload completes. Use PUT method to upload the file to this URL when status is SCHEDULED.
     * @property \DateTime $uploadExpiration Expiration time of the presigned upload URL in ISO 8601 format (only present when status is SCHEDULED)
    */
        protected $type;
        protected $content;
        protected $url;
        protected $crawlDepth;
        protected $crawlPeriod;
        protected $fileName;
        protected $fileSize;
        protected $mimeType;
        protected $importUrl;
        protected $uploadExpiration;
    public function __construct(array $payload = []) {
        $this->type = Values::array_get($payload, 'type');
        $this->content = Values::array_get($payload, 'content');
        $this->url = Values::array_get($payload, 'url');
        $this->crawlDepth = Values::array_get($payload, 'crawlDepth');
        $this->crawlPeriod = Values::array_get($payload, 'crawlPeriod');
        $this->fileName = Values::array_get($payload, 'fileName');
        $this->fileSize = Values::array_get($payload, 'fileSize');
        $this->mimeType = Values::array_get($payload, 'mimeType');
        $this->importUrl = Values::array_get($payload, 'importUrl');
        $this->uploadExpiration = Values::array_get($payload, 'uploadExpiration');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
            'type' => $this->type,
            'content' => $this->content,
            'url' => $this->url,
            'fileName' => $this->fileName,
            'fileSize' => $this->fileSize,
            'mimeType' => $this->mimeType
        ];
        if (isset($this->crawlDepth)) {
            $jsonString['crawlDepth'] = $this->crawlDepth;
        }
        if (isset($this->crawlPeriod)) {
            $jsonString['crawlPeriod'] = $this->crawlPeriod;
        }
        if (isset($this->importUrl)) {
            $jsonString['importUrl'] = $this->importUrl;
        }
        if (isset($this->uploadExpiration)) {
            $jsonString['uploadExpiration'] = $this->uploadExpiration;
        }
        return $jsonString;
    }
}

class KnowledgeCore implements \JsonSerializable
{
    /**
     * @property string $name The name of the knowledge source.
     * @property string $description A detailed description of the knowledge source and when to use it.  This helps provide context about the content and its intended purpose.
     * @property KnowledgeSourceTypes $source
    */
        protected $name;
        protected $description;
        protected $source;
    public function __construct(array $payload = []) {
        $this->name = Values::array_get($payload, 'name');
        $this->description = Values::array_get($payload, 'description');
        $this->source = Values::array_get($payload, 'source');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
            'name' => $this->name
        ];
        if (isset($this->description)) {
            $jsonString['description'] = $this->description;
        }
        if (isset($this->source)) {
            $jsonString['source'] = $this->source;
        }
        return $jsonString;
    }
}

