-- V15: Geofence configs - area aman yang dipantau Guardian
CREATE TABLE IF NOT EXISTS geofence_configs (
    id             BIGSERIAL        PRIMARY KEY,
    guardian_id    BIGINT           REFERENCES users(id) ON DELETE SET NULL,
    user_id        BIGINT           NOT NULL UNIQUE REFERENCES users(id) ON DELETE CASCADE,
    center_lat     DOUBLE PRECISION,
    center_lng     DOUBLE PRECISION,
    radius_meters  DOUBLE PRECISION NOT NULL DEFAULT 500.0,
    enabled        BOOLEAN          NOT NULL DEFAULT FALSE,
    updated_at     TIMESTAMP        NOT NULL DEFAULT NOW()
);
