USE webgis_spbu;

INSERT INTO points (nama, kode_point, latitude, longitude)
SELECT *
FROM (
    SELECT 'Titik Survei Alun Kapuas' AS nama, 'P-001' AS kode_point, -0.023700 AS latitude, 109.342900 AS longitude
    UNION ALL SELECT 'Titik Survei Akcaya', 'P-002', -0.051200, 109.339000
    UNION ALL SELECT 'Titik Survei Siantan', 'P-003', -0.009500, 109.339500
) AS seed
WHERE NOT EXISTS (SELECT 1 FROM points LIMIT 1);

INSERT INTO spbu (nama, no_spbu, status, latitude, longitude)
SELECT *
FROM (
    SELECT 'SPBU Ahmad Yani Pontianak' AS nama, '64.781.01' AS no_spbu, '24 Jam' AS status, -0.045050 AS latitude, 109.345900 AS longitude
    UNION ALL SELECT 'SPBU Imam Bonjol', '64.781.02', '24 Jam', -0.036500, 109.333100
    UNION ALL SELECT 'SPBU Tanjungpura', '64.781.03', '24 Jam', -0.028950, 109.337800
    UNION ALL SELECT 'SPBU Sungai Jawi', '64.781.04', '24 Jam', -0.040100, 109.305400
    UNION ALL SELECT 'SPBU Siantan', '64.781.05', '24 Jam', -0.006700, 109.340800
    UNION ALL SELECT 'SPBU Paris II', '64.781.06', 'Tidak', -0.061800, 109.351500
    UNION ALL SELECT 'SPBU Tanjung Hulu', '64.781.07', 'Tidak', -0.023800, 109.364400
) AS seed
WHERE NOT EXISTS (SELECT 1 FROM spbu LIMIT 1);

INSERT INTO jalan (nama, status, panjang, geom)
SELECT *
FROM (
    SELECT 'Koridor Jalan Ahmad Yani' AS nama, 'Nasional' AS status, 1430.50 AS panjang, '[{"lat":-0.0565,"lng":109.3418},{"lat":-0.0493,"lng":109.3443},{"lat":-0.0402,"lng":109.3475}]' AS geom
    UNION ALL SELECT 'Koridor Jalan Tanjungpura', 'Provinsi', 1210.25, '[{"lat":-0.0339,"lng":109.3323},{"lat":-0.0304,"lng":109.3372},{"lat":-0.0275,"lng":109.3420}]'
    UNION ALL SELECT 'Koridor Jalan Kom Yos Sudarso', 'Kabupaten', 1655.75, '[{"lat":-0.0128,"lng":109.3142},{"lat":-0.0187,"lng":109.3237},{"lat":-0.0239,"lng":109.3338}]'
) AS seed
WHERE NOT EXISTS (SELECT 1 FROM jalan LIMIT 1);

INSERT INTO parsil (nama, status, luas, geom)
SELECT *
FROM (
    SELECT 'Parsil Kawasan GOR Pangsuma' AS nama, 'SHM' AS status, 24500.75 AS luas, '[[{"lat":-0.0493,"lng":109.3419},{"lat":-0.0470,"lng":109.3470},{"lat":-0.0514,"lng":109.3490},{"lat":-0.0535,"lng":109.3440}]]' AS geom
    UNION ALL SELECT 'Parsil Area Sungai Bangkong', 'HGB', 18250.40, '[[{"lat":-0.0340,"lng":109.3090},{"lat":-0.0308,"lng":109.3134},{"lat":-0.0346,"lng":109.3168},{"lat":-0.0381,"lng":109.3120}]]'
    UNION ALL SELECT 'Parsil Area Tanjung Hulu', 'HP', 21780.10, '[[{"lat":-0.0211,"lng":109.3634},{"lat":-0.0176,"lng":109.3673},{"lat":-0.0219,"lng":109.3712},{"lat":-0.0251,"lng":109.3669}]]'
) AS seed
WHERE NOT EXISTS (SELECT 1 FROM parsil LIMIT 1);

INSERT INTO masjid (nama, pic, radius, latitude, longitude, radius_layanan)
SELECT *
FROM (
    SELECT 'Masjid Raya Mujahidin' AS nama, 'H. Sulaiman Arif' AS pic, 900 AS radius, -0.032500 AS latitude, 109.338200 AS longitude, 900 AS radius_layanan
    UNION ALL SELECT 'Masjid Jami Sultan Syarif Abdurrahman', 'Ust. Rahman Hakim', 700, -0.020600, 109.338900, 700
    UNION ALL SELECT 'Masjid Al-Falah Sungai Jawi', 'H. Darmawan Yusuf', 820, -0.041900, 109.310500, 820
) AS seed
WHERE NOT EXISTS (SELECT 1 FROM masjid LIMIT 1);

INSERT INTO penduduk_miskin (
    nama_kk, jumlah_anggota, alamat, latitude, longitude,
    penghasilan, kondisi_rumah, sumber_air, skor_kerentanan, jenis_bantuan
)
SELECT *
FROM (
    SELECT 'Rahmat Hidayat' AS nama_kk, 5 AS jumlah_anggota, 'Gang Karya Baru, Sungai Bangkong' AS alamat, -0.037800 AS latitude, 109.314100 AS longitude, '< 500rb' AS penghasilan, 'Kayu' AS kondisi_rumah, 'Sumur' AS sumber_air, 75.00 AS skor_kerentanan, 'BLT / Modal Usaha' AS jenis_bantuan
    UNION ALL SELECT 'Siti Aminah', 4, 'Jl. Tanjungpura Dalam', -0.030500, 109.337600, '500rb - 1jt', 'Kayu', 'PDAM', 42.00, 'BLT / Modal Usaha'
    UNION ALL SELECT 'Mulyadi Saputra', 6, 'Gang Sepakat, Benua Melayu Darat', -0.034300, 109.343600, '< 500rb', 'Bambu/Tepas', 'Sumur', 90.00, 'Bedah Rumah'
    UNION ALL SELECT 'Nuraini Hasanah', 3, 'Jl. Gajah Mada Gang Kecil', -0.026900, 109.335900, '500rb - 1jt', 'Tembok', 'PDAM', 30.00, 'Sembako'
    UNION ALL SELECT 'Agus Salim', 5, 'Kelurahan Tambelan Sampit', -0.019900, 109.340100, '< 500rb', 'Kayu', 'Sungai', 85.00, 'Air Bersih / PDAM'
    UNION ALL SELECT 'Yuliana Putri', 4, 'Sungai Jawi Dalam', -0.041200, 109.309900, '500rb - 1jt', 'Kayu', 'Sumur', 50.00, 'Sembako'
    UNION ALL SELECT 'Bambang Irawan', 7, 'Gang Bersama, Mariana', -0.028000, 109.326800, '< 500rb', 'Bambu/Tepas', 'Sungai', 100.00, 'Bedah Rumah'
    UNION ALL SELECT 'Kartini Rahma', 2, 'Jl. Dr. Sutomo Dalam', -0.033800, 109.331800, '> 1jt', 'Kayu', 'PDAM', 28.00, 'Beasiswa Pendidikan'
    UNION ALL SELECT 'Firdaus Ahmad', 5, 'Siantan Hilir Gang Masjid', -0.018400, 109.337600, '500rb - 1jt', 'Kayu', 'Sungai', 60.00, 'Air Bersih / PDAM'
    UNION ALL SELECT 'Mariam Abdullah', 4, 'Tanjung Hulu Gang Keluarga', -0.022300, 109.362800, '< 500rb', 'Kayu', 'Sumur', 75.00, 'BLT / Modal Usaha'
    UNION ALL SELECT 'Rudi Hartono', 6, 'Parit Mayor Dalam', -0.043800, 109.372900, '< 500rb', 'Bambu/Tepas', 'Sungai', 100.00, 'Bedah Rumah'
    UNION ALL SELECT 'Desi Wulandari', 3, 'Akcaya Gang Damai', -0.052200, 109.339600, '500rb - 1jt', 'Tembok', 'PDAM', 30.00, 'Beasiswa Pendidikan'
    UNION ALL SELECT 'Hendra Gunawan', 5, 'Sungai Raya Dalam, ujung permukiman', -0.079500, 109.395200, '< 500rb', 'Bambu/Tepas', 'Sungai', 100.00, 'Air Bersih / PDAM'
    UNION ALL SELECT 'Rosnawati Idris', 4, 'Pal Lima Gang Mandiri', -0.048800, 109.300500, '500rb - 1jt', 'Kayu', 'Sumur', 50.00, 'Sembako'
) AS seed
WHERE NOT EXISTS (SELECT 1 FROM penduduk_miskin LIMIT 1);
