-- CreateEnum
CREATE TYPE "AuditEvent" AS ENUM ('tindakan_dokter_created', 'obat_created', 'rekam_medis_created', 'tindakan_dokter_updated', 'obat_updated', 'rekam_medis_updated', 'tindakan_dokter_deleted', 'obat_deleted', 'rekam_medis_deleted');

-- CreateEnum
CREATE TYPE "resultStatus" AS ENUM ('tampered', 'non_tampered');

-- CreateTable
CREATE TABLE "audit" (
    "id" VARCHAR(50) NOT NULL,
    "event" "AuditEvent" NOT NULL,
    "payload" TEXT NOT NULL,
    "timestamp" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "user_id" BIGINT NOT NULL,
    "last_sync" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "result" "resultStatus" NOT NULL,

    CONSTRAINT "audit_pkey" PRIMARY KEY ("id")
);
