<?php

namespace wpsolr\core\classes\hosting_api;

use wpsolr\core\classes\engines\WPSOLR_AbstractEngineClient;

class WPSOLR_Hosting_Api_Weaviate_Wpsolr extends WPSOLR_Hosting_Api_Wpsolr_Abstract {

	const HOSTING_API_ID = 'wpsolr_weaviate';
	const WEAVIATE_URL = 'Copy your Weaviate url like http://localhost:8080';

	static public function get_is_disabled(): bool {
		return true;
	}

	public function get_is_endpoint_only() {
		return true;
	}

	/**
	 * @inheritdoc
	 */
	public function get_search_engine() {
		return WPSOLR_AbstractEngineClient::ENGINE_WEAVIATE;
	}

	public function get_is_host_contains_user_password() {
		return false; // Weaviate does not require it
	}

	public function get_documentation_url() {
		return 'https://www.wpsolr.com/guide/configuration-step-by-step-schematic/configure-your-indexes/create-weaviate-index/';
	}

	/**
	 * @inheritdoc
	 */
	public function get_ui_fields_child() {

		return array_merge( parent::get_ui_fields_child(), [
			[
				self::FIELD_NAME_FIELDS_INDEX_ENDPOINT => [
					self::FIELD_NAME_LABEL                 => 'Cluster URL',
					self::FIELD_NAME_PLACEHOLDER           => static::WEAVIATE_URL,
					self::FIELD_NAME_FORMAT_IS_CREATE_ONLY => true,
					self::FIELD_NAME_FORMAT                => [
						self::FIELD_NAME_FORMAT_TYPE        => self::FIELD_NAME_FORMAT_TYPE_MANDATORY,
						self::FIELD_NAME_FORMAT_ERROR_LABEL => self::PLEASE_COPY . 'your Server URL here',
					],
				],
			],


			static::FIELD_NAME_FIELDS_CERT_1_DEFAULT,
		] );
	}

}