import React, { useState, useEffect } from ‘react’;
import { AlertTriangle, FileText, Calculator, Shield, ArrowRight, CheckCircle, Lock, Activity, DollarSign, Search, Copy, RefreshCw } from ‘lucide-react’;

// — Gemini API Helper —
const generateContent = async (prompt, systemInstruction) => {
const apiKey = “”; // Provided by environment
const url = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-09-2025:generateContent?key=${apiKey}`;

const payload = {
contents: [{ parts: [{ text: prompt }] }],
systemInstruction: { parts: [{ text: systemInstruction }] }
};

try {
const response = await fetch(url, {
method: ‘POST’,
headers: { ‘Content-Type’: ‘application/json’ },
body: JSON.stringify(payload)
});
const data = await response.json();
if (data.error) throw new Error(data.error.message);
return data.candidates?.[0]?.content?.parts?.[0]?.text || “No response generated.”;
} catch (error) {
console.error(“API Error:”, error);
return `Error: ${error.message}. Please try again.`;
}
};

// — Components —

const Header = ({ setView, currentView }) => (

setView(‘home’)}>

PATIENT’S PLAYBOOK

2026 EDITION

);

const Hero = ({ setView }) => (

System Status: Hostile

BE THE CEO OF
YOUR HEALTH

The system relies on your fatigue. Use these AI-powered tools to fight denials, audit your policy, and calculate your true costs.


);

const AppealGenerator = () => {
const [formData, setFormData] = useState({
patientName: ”,
claimNumber: ”,
denialReason: ‘not_medically_necessary’,
treatment: ”,
doctorName: ”,
details: ”
});
const [generatedAppeal, setGeneratedAppeal] = useState(”);
const [loading, setLoading] = useState(false);

const handleGenerate = async () => {
setLoading(true);
const systemPrompt = `You are an expert medical billing advocate specializing in ERISA appeals and overturning insurance denials.
Write a formal, aggressive, legalistic appeal letter.
Do not use emotional language. Use regulatory citations (ERISA, ACA, No Surprises Act) where applicable.
The tone should be: “I am auditing your failure to comply with the plan documents.”
Structure:
1. Header with claim details.
2. Procedural challenge (automated denial violation).
3. Request for the full claim file (ERISA citation).
4. Clinical argument (Standard of Care vs Internal Guidelines).
5. Demand for reviewer credentials.
6. Closing threat of state complaint.`;

const userPrompt = `Write an appeal for:
Patient: ${formData.patientName}
Claim #: ${formData.claimNumber}
Treatment Denied: ${formData.treatment}
Doctor: ${formData.doctorName}
Reason Given: ${formData.denialReason}
Additional Context: ${formData.details}`;

const result = await generateContent(userPrompt, systemPrompt);
setGeneratedAppeal(result);
setLoading(false);
};

return (

AI Appeal Generator

Generate a regulatory-grade appeal letter to challenge automated denials.



setFormData({…formData, claimNumber: e.target.value})}
/>

setFormData({…formData, treatment: e.target.value})}
/>