-- CreateTable
CREATE TABLE "Template" (
    "id" TEXT NOT NULL,
    "language" TEXT NOT NULL,
    "deliveryCharge" TEXT NOT NULL,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,

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

-- CreateTable
CREATE TABLE "Banner" (
    "id" TEXT NOT NULL,
    "isVisible" BOOLEAN NOT NULL,
    "bannerTitle" TEXT NOT NULL,
    "bannerDesc" TEXT NOT NULL,
    "bannerImage" TEXT NOT NULL,
    "templateId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "Address" (
    "id" TEXT NOT NULL,
    "isVisible" BOOLEAN NOT NULL,
    "phoneNumber" TEXT NOT NULL,
    "shopLocation" TEXT NOT NULL,
    "shopEmail" TEXT NOT NULL,
    "templateId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "Ingredient" (
    "id" TEXT NOT NULL,
    "isVisible" BOOLEAN NOT NULL,
    "templateId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "ingredientOptions" (
    "id" TEXT NOT NULL,
    "ingrImg" TEXT NOT NULL,
    "ingrTitle" TEXT NOT NULL,
    "ingrDes" TEXT NOT NULL,
    "ingredientId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "Instruction" (
    "id" TEXT NOT NULL,
    "isVisible" BOOLEAN NOT NULL,
    "instBanner" TEXT NOT NULL,
    "templateId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "InstructionOptions" (
    "id" TEXT NOT NULL,
    "hint" TEXT NOT NULL,
    "detail" TEXT NOT NULL,
    "instructionId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "FAQ" (
    "id" TEXT NOT NULL,
    "isVisible" BOOLEAN NOT NULL,
    "templateId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "FAQOptions" (
    "id" TEXT NOT NULL,
    "index" INTEGER NOT NULL,
    "text" TEXT NOT NULL,
    "faqId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "Tips" (
    "id" TEXT NOT NULL,
    "isVisible" BOOLEAN NOT NULL,
    "tipsBanner" TEXT NOT NULL,
    "templateId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "TipsOption" (
    "id" TEXT NOT NULL,
    "index" INTEGER NOT NULL,
    "text" TEXT NOT NULL,
    "tipsId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "PriceCombo" (
    "id" TEXT NOT NULL,
    "isVisible" BOOLEAN NOT NULL,
    "templateId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "PriceOption" (
    "id" TEXT NOT NULL,
    "quantity" TEXT NOT NULL,
    "price" TEXT NOT NULL,
    "comboId" TEXT NOT NULL,

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

-- CreateTable
CREATE TABLE "Product" (
    "id" TEXT NOT NULL,
    "isVisible" BOOLEAN NOT NULL,
    "price" TEXT NOT NULL,
    "discount" INTEGER NOT NULL,
    "productName" TEXT NOT NULL,
    "templateId" TEXT NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "Banner_templateId_key" ON "Banner"("templateId");

-- CreateIndex
CREATE UNIQUE INDEX "Address_templateId_key" ON "Address"("templateId");

-- CreateIndex
CREATE UNIQUE INDEX "Ingredient_templateId_key" ON "Ingredient"("templateId");

-- CreateIndex
CREATE UNIQUE INDEX "Instruction_templateId_key" ON "Instruction"("templateId");

-- CreateIndex
CREATE UNIQUE INDEX "FAQ_templateId_key" ON "FAQ"("templateId");

-- CreateIndex
CREATE UNIQUE INDEX "Tips_templateId_key" ON "Tips"("templateId");

-- CreateIndex
CREATE UNIQUE INDEX "PriceCombo_templateId_key" ON "PriceCombo"("templateId");

-- CreateIndex
CREATE UNIQUE INDEX "Product_templateId_key" ON "Product"("templateId");

-- AddForeignKey
ALTER TABLE "Banner" ADD CONSTRAINT "Banner_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Address" ADD CONSTRAINT "Address_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Ingredient" ADD CONSTRAINT "Ingredient_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "ingredientOptions" ADD CONSTRAINT "ingredientOptions_ingredientId_fkey" FOREIGN KEY ("ingredientId") REFERENCES "Ingredient"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Instruction" ADD CONSTRAINT "Instruction_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "InstructionOptions" ADD CONSTRAINT "InstructionOptions_instructionId_fkey" FOREIGN KEY ("instructionId") REFERENCES "Instruction"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "FAQ" ADD CONSTRAINT "FAQ_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "FAQOptions" ADD CONSTRAINT "FAQOptions_faqId_fkey" FOREIGN KEY ("faqId") REFERENCES "FAQ"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Tips" ADD CONSTRAINT "Tips_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "TipsOption" ADD CONSTRAINT "TipsOption_tipsId_fkey" FOREIGN KEY ("tipsId") REFERENCES "Tips"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "PriceCombo" ADD CONSTRAINT "PriceCombo_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "PriceOption" ADD CONSTRAINT "PriceOption_comboId_fkey" FOREIGN KEY ("comboId") REFERENCES "PriceCombo"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Product" ADD CONSTRAINT "Product_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
