-- =====================================================
-- DUMMY DATA: USERS UNTUK TESTING EXPORT
-- =====================================================
-- Password semua user: "password123" (bcrypt)
-- =====================================================

-- 1. ADMIN & PETUGAS
INSERT INTO `users` (`id_user`, `username`, `password`, `nama`, `tipe_anggota`, `kelas`, `status_keanggotaan`, `role`, `foto_profil`) VALUES
(100, 'ADMIN_TEST', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Admin Testing', 'Staf', NULL, 'Aktif', 'admin', NULL),
(101, 'PETUGAS_TEST', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Petugas Testing', 'Staf', NULL, 'Aktif', 'petugas', NULL);

-- 2. SISWA
INSERT INTO `users` (`id_user`, `username`, `password`, `nama`, `tipe_anggota`, `kelas`, `status_keanggotaan`, `role`, `foto_profil`) VALUES
(201, 'SISWA001', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Ahmad Rizky', 'Siswa', 'XII IPA 1', 'Aktif', 'pengunjung', NULL),
(202, 'SISWA002', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Siti Nurhaliza', 'Siswa', 'XII IPA 2', 'Aktif', 'pengunjung', NULL),
(203, 'SISWA003', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Budi Santoso', 'Siswa', 'XI IPS 1', 'Aktif', 'pengunjung', NULL),
(204, 'SISWA004', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Dewi Lestari', 'Siswa', 'XI IPS 2', 'Aktif', 'pengunjung', NULL),
(205, 'SISWA005', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Eko Prasetyo', 'Siswa', 'X MIPA 1', 'Aktif', 'pengunjung', NULL),
(206, 'SISWA006', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Fitri Handayani', 'Siswa', 'X MIPA 2', 'Dibekukan', 'pengunjung', NULL);

-- 3. GURU
INSERT INTO `users` (`id_user`, `username`, `password`, `nama`, `tipe_anggota`, `kelas`, `status_keanggotaan`, `role`, `foto_profil`) VALUES
(301, 'GURU001', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Dr. Agus Salim', 'Guru', NULL, 'Aktif', 'pengunjung', NULL),
(302, 'GURU002', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Dra. Sri Rahayu', 'Guru', NULL, 'Aktif', 'pengunjung', NULL),
(303, 'GURU003', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'M. Yusuf, S.Pd', 'Guru', NULL, 'Aktif', 'pengunjung', NULL);

-- 4. KEPALA SEKOLAH & STAF
INSERT INTO `users` (`id_user`, `username`, `password`, `nama`, `tipe_anggota`, `kelas`, `status_keanggotaan`, `role`, `foto_profil`) VALUES
(401, 'KEPSEK', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Dr. H. Suparman, M.Pd', 'Kepala Sekolah', NULL, 'Aktif', 'pengunjung', NULL),
(402, 'STAF001', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Linda Wijaya', 'Staf', NULL, 'Aktif', 'pengunjung', NULL);

-- 5. UMUM
INSERT INTO `users` (`id_user`, `username`, `password`, `nama`, `tipe_anggota`, `kelas`, `status_keanggotaan`, `role`, `foto_profil`) VALUES
(501, 'UMUM001', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Andi Wijaya (Alumni)', 'Umum', NULL, 'Aktif', 'pengunjung', NULL),
(502, 'UMUM002', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Maya Sari (Orang Tua)', 'Umum', NULL, 'Aktif', 'pengunjung', NULL);

-- =====================================================
-- DUMMY DATA: PEMINJAMAN DENGAN DENDA
-- =====================================================

-- Peminjaman dengan denda (untuk testing export denda)
INSERT INTO `peminjaman` (`id_peminjaman`, `id_user`, `id_aset_buku`, `tanggal_pinjam`, `tanggal_kembali`, `tanggal_jatuh_tempo`, `denda`, `status_peminjaman`) VALUES
(1001, 201, 1, '2025-12-10', '2025-12-20', '2025-12-17', 1500, 'Terlambat'),
(1002, 202, 2, '2025-12-12', NULL, '2025-12-19', 0, 'Dipinjam'),
(1003, 203, 3, '2025-12-08', '2025-12-25', '2025-12-15', 5000, 'Terlambat'),
(1004, 204, 4, '2025-12-15', NULL, '2025-12-22', 0, 'Dipinjam'),
(1005, 205, 5, '2025-12-01', '2025-12-18', '2025-12-08', 5000, 'Terlambat');

-- =====================================================
-- DUMMY DATA: PEMBAYARAN DENDA (untuk testing cicilan)
-- =====================================================

INSERT INTO `pembayaran_denda` (`id_pembayaran`, `id_peminjaman`, `nominal_bayar`, `tanggal_bayar`, `nomor_kwitansi`, `metode_bayar`, `diterima_oleh`, `keterangan`) VALUES
(1, 1001, 1000, '2025-12-21 10:00:00', 'KWT-20251221-001', 'Cash', 101, 'Cicilan 1'),
(2, 1003, 2000, '2025-12-26 14:30:00', 'KWT-20251226-001', 'Cash', 101, 'Cicilan 1'),
(3, 1003, 2000, '2025-12-27 09:00:00', 'KWT-20251227-001', 'Cash', 101, 'Cicilan 2');

-- =====================================================
-- STATISTIK SETELAH INSERT
-- =====================================================
-- Total Users: 15 (2 admin/petugas, 6 siswa, 3 guru, 2 staf, 2 umum)
-- Total Peminjaman: 5
-- Total Denda: Rp 11.500
-- Status:
--   - Peminjaman #1001: Denda Rp 1.500, Dibayar Rp 1.000, Sisa Rp 500 (Cicilan)
--   - Peminjaman #1003: Denda Rp 5.000, Dibayar Rp 4.000, Sisa Rp 1.000 (Cicilan)
--   - Peminjaman #1005: Denda Rp 5.000, Belum bayar (Belum Lunas)
-- =====================================================

-- QUERY UNTUK CEK HASIL
-- SELECT * FROM users WHERE id_user >= 100;
-- SELECT * FROM peminjaman WHERE id_peminjaman >= 1000;
-- SELECT * FROM v_summary_pembayaran_denda WHERE id_peminjaman >= 1000;
