CREATE DATABASE db_spbu;
USE db_spbu;

CREATE TABLE spbu (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama_spbu VARCHAR(100),
    no_spbu VARCHAR(50),
    status ENUM('Buka 24 Jam', 'Tidak 24 Jam'),
    latitude DOUBLE,
    longitude DOUBLE,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE jalan (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama_jalan VARCHAR(100),
    status ENUM('Nasional','Provinsi','Kabupaten'),
    panjang DOUBLE,
    geojson TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE parsil (
    id INT AUTO_INCREMENT PRIMARY KEY,
    pemilik VARCHAR(100),
    status ENUM('SHM','HGB','HGU','HP'),
    luas DOUBLE,
    geojson TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS `jalan_rusak` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `deskripsi` TEXT NOT NULL,
    `foto` VARCHAR(255) NOT NULL,
    `latitude` DOUBLE NOT NULL,
    `longitude` DOUBLE NOT NULL,
    `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;