-- +goose Up
CREATE TABLE modules (
    id                UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    name              TEXT UNIQUE NOT NULL,
    base_url          TEXT NOT NULL,
    health_path       TEXT NOT NULL DEFAULT '/health',
    token_hash        TEXT NOT NULL,
    status            TEXT NOT NULL DEFAULT 'unknown' CHECK (status IN ('unknown', 'healthy', 'unhealthy')),
    metadata          JSONB NOT NULL DEFAULT '{}'::jsonb,
    registered_at     TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    last_heartbeat_at TIMESTAMPTZ
);
