-- CreateTable
CREATE TABLE "system_notifications" (
    "id" SERIAL NOT NULL,
    "title" VARCHAR(180) NOT NULL,
    "message" TEXT NOT NULL,
    "type" VARCHAR(50) NOT NULL DEFAULT 'MEETING_REQUEST',
    "is_read" BOOLEAN NOT NULL DEFAULT false,
    "read_at" TIMESTAMP(3),
    "sender_user_id" INTEGER,
    "receiver_user_id" INTEGER,
    "receiver_stakeholder_id" INTEGER,
    "meeting_request_id" INTEGER,
    "data" JSONB,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

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

-- CreateIndex
CREATE INDEX "system_notifications_sender_user_id_idx" ON "system_notifications"("sender_user_id");

-- CreateIndex
CREATE INDEX "system_notifications_receiver_user_id_idx" ON "system_notifications"("receiver_user_id");

-- CreateIndex
CREATE INDEX "system_notifications_receiver_stakeholder_id_idx" ON "system_notifications"("receiver_stakeholder_id");

-- CreateIndex
CREATE INDEX "system_notifications_meeting_request_id_idx" ON "system_notifications"("meeting_request_id");

-- CreateIndex
CREATE INDEX "system_notifications_is_read_idx" ON "system_notifications"("is_read");

-- CreateIndex
CREATE INDEX "system_notifications_type_idx" ON "system_notifications"("type");

-- CreateIndex
CREATE INDEX "system_notifications_deleted_at_idx" ON "system_notifications"("deleted_at");
