DROP TABLE IF EXISTS tugas01_spbu;
CREATE TABLE tugas01_spbu (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama_spbu VARCHAR(150) NOT NULL,
    alamat TEXT NULL,
    status_24_jam ENUM('Ya', 'Tidak') NOT NULL DEFAULT 'Tidak',
    kontak VARCHAR(50) NULL,
    geojson LONGTEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

INSERT INTO tugas01_spbu (nama_spbu, alamat, status_24_jam, kontak, geojson) VALUES
('SPBU Ahmad Yani', 'Jl. Ahmad Yani, Pontianak', 'Ya', '081234567890', '{"type":"Point","coordinates":[109.3425,-0.0442]}'),
('SPBU Gajah Mada', 'Jl. Gajah Mada, Pontianak', 'Tidak', '081234567891', '{"type":"Point","coordinates":[109.3338,-0.0271]}');

DROP TABLE IF EXISTS tugas02_data_spasial;
CREATE TABLE tugas02_data_spasial (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama VARCHAR(150) NOT NULL,
    jenis_objek ENUM('Jalan', 'Tanah') NOT NULL,
    status VARCHAR(100) NOT NULL,
    ukuran DOUBLE NOT NULL DEFAULT 0,
    geojson LONGTEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

INSERT INTO tugas02_data_spasial (nama, jenis_objek, status, ukuran, geojson) VALUES
('Contoh Jalan Ahmad Yani', 'Jalan', 'Jalan Nasional', 1250.00, '{"type":"LineString","coordinates":[[109.334,-0.055],[109.342,-0.047],[109.351,-0.043]]}'),
('Contoh Tanah Kavling A', 'Tanah', 'SHM', 8500.00, '{"type":"Polygon","coordinates":[[[109.337,-0.032],[109.342,-0.032],[109.342,-0.028],[109.337,-0.028],[109.337,-0.032]]]}');

DROP TABLE IF EXISTS tugas03_spbu;
CREATE TABLE tugas03_spbu (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama_spbu VARCHAR(150) NOT NULL,
    alamat TEXT NULL,
    status_24_jam ENUM('Ya', 'Tidak') NOT NULL DEFAULT 'Tidak',
    kontak VARCHAR(50) NULL,
    geojson LONGTEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

INSERT INTO tugas03_spbu (nama_spbu, alamat, status_24_jam, kontak, geojson) VALUES
('SPBU Ahmad Yani', 'Jl. Ahmad Yani, Pontianak', 'Ya', '081234567890', '{"type":"Point","coordinates":[109.3425,-0.0442]}'),
('SPBU Gajah Mada', 'Jl. Gajah Mada, Pontianak', 'Tidak', '081234567891', '{"type":"Point","coordinates":[109.3338,-0.0271]}'),
('SPBU Imam Bonjol', 'Jl. Imam Bonjol, Pontianak', 'Ya', '081234567892', '{"type":"Point","coordinates":[109.3448,-0.0316]}'),
('SPBU Tanjung Raya', 'Jl. Tanjung Raya II, Pontianak', 'Tidak', '081234567893', '{"type":"Point","coordinates":[109.3741,-0.0292]}');
