function SqlSetupHelp() {
    const sql = `-- 1. Aktifkan ekstensi UUID
create extension if not exists "uuid-ossp";

-- 2. Buat tabel employees (jika belum ada)
create table if not exists employees (
  id uuid default uuid_generate_v4() primary key,
  created_at timestamp with time zone default timezone('utc'::text, now())
);

-- Gunakan ALTER untuk memastikan kolom ada (Aman untuk update tabel lama)
alter table employees add column if not exists nik text;
alter table employees add column if not exists nama text;
alter table employees add column if not exists jenis_kelamin text;
alter table employees add column if not exists jabatan text;
alter table employees add column if not exists tmt date;
alter table employees add column if not exists satminkal text;
-- alter table employees add column if not exists status text; -- Dipindah ke script update
alter table employees add column if not exists lembaga text;
alter table employees add column if not exists tahun numeric default 2025; 
alter table employees add column if not exists is_active boolean default true;
alter table employees add column if not exists tanggal_keluar date;
alter table employees add column if not exists alasan_keluar text;
alter table employees add column if not exists is_verified_unique boolean default false;
alter table employees add column if not exists is_parcel_collected boolean default false;
alter table employees add column if not exists collected_at timestamp with time zone;

-- Update Constraint: NIK Unik hanya per Tahun (bukan global)
-- Hapus constraint lama jika ada
alter table employees drop constraint if exists employees_nik_key;

-- Buat constraint baru (NIK + Tahun)
alter table employees drop constraint if exists employees_nik_tahun_key;
alter table employees add constraint employees_nik_tahun_key unique (nik, tahun);

-- 3. Buat tabel institutions (Lembaga)
create table if not exists institutions (
  id uuid default uuid_generate_v4() primary key,
  nama text unique not null,
  created_at timestamp with time zone default timezone('utc'::text, now())
);

-- 4. Setup Relasi (Foreign Key) dengan ALTER
alter table employees 
drop constraint if exists fk_employees_satminkal;

alter table employees 
add constraint fk_employees_satminkal 
foreign key (satminkal) 
references institutions (nama) 
on update cascade 
on delete set null;

-- 5. Setup Keamanan (RLS)
alter table employees enable row level security;
alter table institutions enable row level security;

drop policy if exists "Public Access" on employees;
drop policy if exists "Public Access" on institutions;

create policy "Public Access" on employees for all using (true) with check (true);
create policy "Public Access" on institutions for all using (true) with check (true);

-- 6. Update Data Lama (Opsional)
update employees set tahun = 2025 where tahun is null;`;

    const copyToClipboard = () => {
        navigator.clipboard.writeText(sql);
        Swal.fire({
            icon: 'success',
            title: 'Tersalin!',
            text: 'Script SQL Instalasi Awal telah disalin.',
            timer: 1500,
            showConfirmButton: false
        });
    };

    return (
        <div className="mt-4 bg-gray-900 rounded-lg overflow-hidden border border-gray-700 shadow-lg" data-name="sql-setup-help" data-file="components/SqlSetupHelp.js">
            <div className="flex justify-between items-center px-4 py-2 bg-gray-800 border-b border-gray-700">
                <span className="text-gray-300 text-xs font-mono font-bold uppercase">SQL Editor Script (Instalasi Awal)</span>
                <button 
                    onClick={copyToClipboard}
                    className="flex items-center gap-1 text-xs bg-teal-600 hover:bg-teal-700 text-white px-3 py-1.5 rounded transition-colors font-medium"
                >
                    <div className="icon-copy text-sm"></div>
                    Salin SQL
                </button>
            </div>
            <div className="p-4 overflow-x-auto bg-[#0d1117]">
                <pre className="text-xs sm:text-sm font-mono text-gray-300 whitespace-pre leading-relaxed">
                    {sql}
                </pre>
            </div>
            <div className="px-4 py-3 bg-gray-800 text-xs text-gray-400 border-t border-gray-700">
                <p className="font-bold mb-1 text-gray-300">Catatan:</p>
                <p>Ini adalah struktur dasar. Untuk fitur tambahan (seperti Kategori), silakan jalankan Script Update terpisah.</p>
            </div>
        </div>
    );
}