import mysql.connector
import os

class DBConfig:
    # Database credentials (can also be read from environment variables)
    MYSQL_HOST = os.getenv("MYSQL_HOST", "127.0.0.1")
    MYSQL_USER = os.getenv("MYSQL_USER", "root")
    MYSQL_PASSWORD = os.getenv("MYSQL_PASSWORD", "root")
    MYSQL_DB = os.getenv("MYSQL_DB", "income_tax")

    @staticmethod
    def get_db_connection():
        """
        Returns a MySQL connection object.
        """
        return mysql.connector.connect(
            host=DBConfig.MYSQL_HOST,
            user=DBConfig.MYSQL_USER,
            password=DBConfig.MYSQL_PASSWORD,
            database=DBConfig.MYSQL_DB
        )
