# Script para calcular ROI de investimentos em IA
# Autor: Assistente de Geração de Código
# Uso: Execute o script e insira os valores quando solicitado.

def calcular_roi(custo_total, ganho_total):
    """
    Calcula o ROI com base na fórmula:
    ROI = (Ganho - Custo) / Custo * 100%
    """
    if custo_total <= 0:
        raise ValueError("O custo do investimento deve ser maior que zero.")
    if ganho_total < 0:
        raise ValueError("O ganho não pode ser negativo.")
    
    roi = ((ganho_total - custo_total) / custo_total) * 100
    return roi

def main():
    # Taxa de câmbio aproximada (US$ para BRL). Ajuste conforme necessário.
    taxa_cambio_usd_brl = 5.50  # Exemplo: 1 USD = 5.50 BRL
    
    # Investimentos fornecidos (em BRL e USD)
    investimento_brl = 550.0  # Plano max Claude
    investimento_usd = 25.0   # Créditos API Claude
    
    # Converter USD para BRL
    investimento_usd_em_brl = investimento_usd * taxa_cambio_usd_brl
    
    # Custo total em BRL
    custo_total = investimento_brl + investimento_usd_em_brl
    print(f"Custo total do investimento (em BRL): R$ {custo_total:.2f}")
    
    # Solicitar ganho esperado do usuário
    try:
        ganho_total = float(input("Digite o ganho total esperado (em BRL): "))
    except ValueError:
        print("Entrada inválida. Por favor, insira um número válido.")
        return
    
    # Calcular ROI
    try:
        roi = calcular_roi(custo_total, ganho_total)
        print(f"ROI calculado: {roi:.2f}%")
        
        if roi > 0:
            print("Seu investimento está gerando lucro!")
        elif roi < 0:
            print("Seu investimento está gerando prejuízo.")
        else:
            print("Seu investimento está no ponto de equilíbrio.")
    except ValueError as e:
        print(f"Erro: {e}")

if __name__ == "__main__":
    main()