@echo off
chcp 65001 >nul
echo ========================================
echo    爱设计 Docker 环境启动
echo ========================================
echo.
echo [*] 使用端口:
echo     - MySQL: 3307
echo     - API:   8001
echo.
echo [1] 停止并清理旧容器...
docker-compose down

echo.
echo [2] 构建并启动服务...
docker-compose up -d --build

echo.
echo [3] 等待MySQL启动...
timeout /t 15 /nobreak >nul

echo.
echo [4] 初始化数据库（创建表）...
docker exec aishej_api_dev python -c "from app.core.database import Base, engine; Base.metadata.create_all(bind=engine); print('Tables created!')"

echo.
echo [5] 添加测试数据...
docker exec aishej_api_dev python seed_data.py

echo.
echo [6] 下载测试图片...
docker exec aishej_api_dev python download_test_images.py

echo.
echo ========================================
echo    启动完成！
echo ========================================
echo.
echo 服务地址:
echo   - API:          http://localhost:8001
echo   - API文档:      http://localhost:8001/docs
echo   - MySQL:        localhost:3307
echo.
echo 查看日志: docker-compose logs -f api
echo 停止服务: docker-compose down
echo.
pause
