@echo off
SET MYSQL_PATH="C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe"

echo ========================================
echo MySQL Database Setup for Branch System
echo ========================================
echo.
echo Using password: password
echo.

%MYSQL_PATH% -u root -ppassword -e "CREATE DATABASE IF NOT EXISTS acbptxvs_branch_system CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER IF NOT EXISTS 'acbptxvs_phin'@'localhost' IDENTIFIED BY '5;)8.H8aTG8%%p_]'; GRANT ALL PRIVILEGES ON acbptxvs_branch_system.* TO 'acbptxvs_phin'@'localhost'; FLUSH PRIVILEGES;"

if %ERRORLEVEL% EQU 0 (
    echo.
    echo ========================================
    echo SUCCESS! Database setup complete.
    echo ========================================
    echo.
    echo Database: acbptxvs_branch_system
    echo User: acbptxvs_phin
    echo.
    echo You can now run: python manage.py migrate
    echo Then: python manage.py runserver
    echo.
) else (
    echo.
    echo ========================================
    echo FAILED
    echo ========================================
    echo.
    echo The password 'password' didn't work.
    echo Please check your MySQL root password.
    echo.
)

pause
