DROP DATABASE IF EXISTS gis_tugas;
CREATE DATABASE gis_tugas;
USE gis_tugas;

-- From gis_point
CREATE TABLE data_spbu (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama_spbu VARCHAR(255) NOT NULL,
    alamat TEXT NOT NULL,
    latitude DOUBLE NOT NULL,
    longitude DOUBLE NOT NULL,
    jenis_layanan ENUM('24 Jam', 'Reguler') NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- From gis_polyline (and gis_polygon)
CREATE TABLE data_jalan (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama_jalan VARCHAR(255) NOT NULL,
    status_jalan ENUM('Nasional', 'Provinsi', 'Kabupaten') NOT NULL,
    geojson_data TEXT NOT NULL,
    panjang_jalan FLOAT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- From gis_polygon
CREATE TABLE data_parsil (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nomor_parsil VARCHAR(100),
    status_sertifikat ENUM('SHM', 'HGB', 'HGU', 'HP'),
    geojson_data TEXT,
    luas_m2 FLOAT
);
