import os
import zipfile

zip_path = os.path.join('storage', 'servidor_teste_v1.zip')

app_code = """import os
from flask import Flask

app = Flask(__name__)

@app.route('/')
def home():
    return '''
    <div style="font-family: sans-serif; text-align: center; padding: 50px; background: #0b0f19; color: #fff;">
        <h1 style="color: #4ade80;">Servidor Teste Ativo no VPS!</h1>
        <p style="font-size: 18px;">Esta aplicação foi implantada com sucesso via <strong>DeployHub</strong>.</p>
        <div style="background: rgba(255,255,255,0.1); padding: 15px; border-radius: 10px; display: inline-block; margin-top: 20px;">
            <strong>Endereço:</strong> http://31.97.147.114:5004<br>
            <strong>Status:</strong> Systemd Service e Flask Ativos na Porta 5004
        </div>
    </div>
    '''

if __name__ == '__main__':
    port = int(os.environ.get('PORT', 5004))
    app.run(host='0.0.0.0', port=port)
"""

req_code = "flask>=2.0.0\n"

with zipfile.ZipFile(zip_path, 'w') as zf:
    zf.writestr('app.py', app_code)
    zf.writestr('requirements.txt', req_code)

print("Created ZIP at:", zip_path)
