<commit_before><?php
namespace DreamFactory\Core\Rackspace\Models;

use DreamFactory\Core\Models\BaseServiceConfigModel;
use DreamFactory\Core\Exceptions\BadRequestException;

/**
 * Class RackspaceConfig
 *
 * @package DreamFactory\Core\Rackspace\Models
 */
class RackspaceConfig extends BaseServiceConfigModel
{
    protected $table = 'rackspace_config';

    protected $encrypted = ['password', 'api_key'];

    protected $fillable = [
        'service_id',
        'username',
        'password',
        'tenant_name',
        'api_key',
        'url',
        'region',
        'storage_type'
    ];

    /**
     * {@inheritdoc}
     */
    public static function validateConfig($config, $create = true)
    {
        $validator = static::makeValidator($config, [
            'username'     => '<PASSWORD>',
            'password'     => '<PASSWORD>',
            'tenant_name'  => 'required',
            'api_key'      => 'required',
            'url'          => 'required',
            'region'       => 'required',
            'storage_type' => 'required'
        ], $create);

        if ($validator->fails()) {
            $messages = $validator->messages()->getMessages();
            throw new BadRequestException('Validation failed.', null, null, $messages);
        }

        return true;
    }

    /**
     * @param array $schema
     */
    protected static function prepareConfigSchemaField(array &$schema)
    {
        parent::prepareConfigSchemaField($schema);

        switch ($schema['name']) {
            case 'region':
                $schema['type'] = 'picklist';
                $schema['values'] = [
                    ['label' => 'Chicago', 'name' => 'ORD', 'url' => 'https://identity.api.rackspacecloud.com'],
                    ['label' => 'Dallas', 'name' => 'DFW', 'url' => 'https://identity.api.rackspacecloud.com'],
                    ['label' => 'London', 'name' => 'LON', 'url' => 'https://lon.identity.api.rackspacecloud.com'],
                ];
                $schema['description'] = 'Select the region to be accessed by this service connection.';
                break;
            case 'key':
                $schema['label'] = 'Access Key ID';
                $schema['description'] = 'An AWS account root or IAM access key.';
                break;
            case 'secret':
                $schema['label'] = 'Secret Access Key';
                $schema['description'] = 'An AWS account root or IAM secret key.';
                break;
        }
    }

}<commit_msg>Tooltip changes.<commit_after><?php
namespace DreamFactory\Core\Rackspace\Models;

use DreamFactory\Core\Models\BaseServiceConfigModel;
use DreamFactory\Core\Exceptions\BadRequestException;

/**
 * Class RackspaceConfig
 *
 * @package DreamFactory\Core\Rackspace\Models
 */
class RackspaceConfig extends BaseServiceConfigModel
{
    protected $table = 'rackspace_config';

    protected $encrypted = ['password', 'api_key'];

    protected $fillable = [
        'service_id',
        'username',
        'password',
        'tenant_name',
        'api_key',
        'url',
        'region',
        'storage_type'
    ];

    /**
     * {@inheritdoc}
     */
    public static function validateConfig($config, $create = true)
    {
        $validator = static::makeValidator($config, [
            'username'     => 'required',
            'password'     => '<PASSWORD>',
            'tenant_name'  => 'required',
            'api_key'      => 'required',
            'url'          => 'required',
            'region'       => 'required',
            'storage_type' => 'required'
        ], $create);

        if ($validator->fails()) {
            $messages = $validator->messages()->getMessages();
            throw new BadRequestException('Validation failed.', null, null, $messages);
        }

        return true;
    }

    /**
     * @param array $schema
     */
    protected static function prepareConfigSchemaField(array &$schema)
    {
        parent::prepareConfigSchemaField($schema);

        switch ($schema['name']) {
            case 'username':
                $schema['description'] = 'The user name for the service connection.';
                break;
            case 'password':
                $schema['description'] = 'The password for the service connection. For OpenStack only. Leave blank for Rackspace.';
                break;
            case 'tenant_name':
                $schema['description'] = 'Normally your account number.';
                break;
            case 'api_key':
                $schema['label'] = 'API Key';
                $schema['description'] = 'The API key for the service connection. For Rackspace only. Leave blank for OpenStack.';
                break;
            case 'url':
                $schema['label'] = 'URL';
                $schema['description'] = 'The URL/endpoint for the service connection.';
                break;
            case 'region':
                $schema['type'] = 'picklist';
                $schema['values'] = [
                    ['label' => 'Chicago', 'name' => 'ORD', 'url' => 'https://identity.api.rackspacecloud.com'],
                    ['label' => 'Dallas', 'name' => 'DFW', 'url' => 'https://identity.api.rackspacecloud.com'],
                    ['label' => 'London', 'name' => 'LON', 'url' => 'https://lon.identity.api.rackspacecloud.com'],
                ];
                $schema['description'] = 'Select the region to be accessed by this service connection.';
                break;
        }
    }

}
{'fraction_non_alphanumeric': 0.14675582866437736, 'fraction_numerical': 0.0, 'mean_word_length': 1.9019402202412166, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 44, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5875824', 'n_tokens_mistral': 1488, 'n_tokens_neox': 1447, 'n_words': 332}