<?php

// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

namespace Algolia\AlgoliaSearch\Configuration;

use Algolia\AlgoliaSearch\Exceptions\AlgoliaException;

class InsightsConfig extends ConfigWithRegion
{
    protected $clientName = 'Insights';

    public static function create($appId, $apiKey, $region = null)
    {
        $allowedRegions = ['de', 'us'];

        if (
            null !== $region && !in_array($region, $allowedRegions, true)
        ) {
            throw new AlgoliaException(
                '`region` must be one of the following: '.
                    implode(', ', $allowedRegions)
            );
        }

        return parent::create($appId, $apiKey, $region);
    }

    public function getDefaultConfiguration()
    {
        return [
            'appId' => '',
            'apiKey' => '',
            'hosts' => null,
            'hasFullHosts' => false,
            'readTimeout' => 5,
            'writeTimeout' => 30,
            'connectTimeout' => 2,
            'defaultHeaders' => [],
        ];
    }
}
