<?php
// src/Core/Database.php
namespace HatiApp\Core;

use PDO;
use PDOException;

class Database {
    private $host = 'localhost';
    private $dbname = 'sarelsgf_erp';
    private $username = 'sarelsgf_erp'; 
    private $password = 'Qwer1907.'; 
    private $conn;

    public function __construct() {
        try {
            $this->conn = new PDO("mysql:host=$this->host;dbname=$this->dbname", $this->username, $this->password);
            $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        } catch (PDOException $e) {
            die("Veritabanı bağlantısı kurulamadı: " . $e->getMessage());
        }
    }

    public function getConnection() {
        return $this->conn;
    }
}