<?php

namespace Config;

use CodeIgniter\Database\Config;

/**
 * Database Configuration
 */
class Database extends Config
{
    /**
     * The directory that holds the Migrations
     * and Seeds directories.
     *
     * @var string
     */
    public $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;

    /**
     * Lets you choose which connection group to
     * use if no other is specified.
     *
     * @var string
     */
    public $defaultGroup = 'default';

    /**
     * The default database connection.
     *
     * @var array
     */
    public $default = [
        'DSN'      => '',
        'hostname' => '10.10.33.60',
        'username' => 'postgres',
        'password' => 'may12002',
        'database' => 'chiefsoft_blog',
        'DBDriver' => 'Postgre',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 3306,
    ];

    public $float_coredb = [
        'DSN'      => '',
        'hostname' => '10.10.33.21',
        'username' => 'savvy',
        'password' => 'savvy001!',
        'database' => 'savvy',
        'DBDriver' => 'Postgre',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 5432,
    ];

    public $mermsemr = [
        'DSN'      => '',
        'hostname' => '10.20.30.60',
        'username' => 'mermsemr',
        'password' => 'mermsemr',
        'database' => 'mermsemr_dev',
        'DBDriver' => 'Postgre',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 5432,
    ];

    public $myfit = [
        'DSN'      => '',
        'hostname' => '10.20.30.60',
        'username' => 'myfit',
        'password' => 'myfit',
        'database' => 'myfit_dev',
        'DBDriver' => 'Postgre',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 5432,
    ];

    public $float_blog = [
        'DSN'      => '',
        'hostname' => '10.10.33.60',
        'username' => 'float',
        'password' => 'float.user',
        'database' => 'float_blog',
        'DBDriver' => 'MySQLi',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 3306,
    ];

    public $float_site = [
        'DSN'      => '',
        'hostname' => '10.10.33.60',
        'username' => 'float',
        'password' => 'float.user',
        'database' => 'float_site',
        'DBDriver' => 'MySQLi',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 3306,
    ];


    /**
     * This database connection is used when
     * running PHPUnit database tests.
     *
     * @var array
     */
    public $tests = [
        'DSN'      => '',
        'hostname' => '127.0.0.1',
        'username' => '',
        'password' => '',
        'database' => ':memory:',
        'DBDriver' => 'SQLite3',
        'DBPrefix' => 'db_',  // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
        'pConnect' => false,
        'DBDebug'  => (ENVIRONMENT !== 'production'),
        'charset'  => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre'  => '',
        'encrypt'  => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port'     => 3306,
    ];

    public function __construct()
    {
        parent::__construct();

        // Ensure that we always set the database group to 'tests' if
        // we are currently running an automated test suite, so that
        // we don't overwrite live data on accident.
        if (ENVIRONMENT === 'testing') {
            $this->defaultGroup = 'tests';
        }
        $this->myfit['hostname'] = MYFIT_DATABASE_HOSTNAME; //getenv('MYFIT_DATABASE_HOSTNAME');
        $this->myfit['username'] = MYFIT_DATABASE_USERNAME; // getenv('MYFIT_DATABASE_USERNAME');
        $this->myfit['password'] = MYFIT_DATABASE_PASSWORD; // getenv('MYFIT_DATABASE_PASSWORD');
        $this->myfit['database'] = MYFIT_DATABASE; // getenv('MYFIT_DATABASE');

        $this->mermsemr['hostname'] = MYFIT_DATABASE_HOSTNAME; //getenv('MYFIT_DATABASE_HOSTNAME');
        $this->mermsemr['username'] = MYFIT_DATABASE_USERNAME; // getenv('MYFIT_DATABASE_USERNAME');
        $this->mermsemr['password'] = MYFIT_DATABASE_PASSWORD; // getenv('MYFIT_DATABASE_PASSWORD');
        $this->mermsemr['database'] = MYFIT_DATABASE; // getenv('MYFIT_DATABASE');

    }
}
