-- CreateTable
CREATE TABLE "tbl_order_refund_issue" (
    "id" BIGSERIAL NOT NULL,
    "user_id" BIGINT NOT NULL,
    "brand_id" BIGINT NOT NULL,
    "order_id" BIGINT NOT NULL,
    "currency" VARCHAR(64),
    "currency_symbol" VARCHAR(16),
    "amount" DECIMAL(13,2),
    "refund_issued_at" TIMESTAMP(3),
    "is_admin_verified" BOOLEAN DEFAULT false,
    "admin_verified_at" TIMESTAMP(3),
    "is_active" BOOLEAN DEFAULT true,
    "inserted_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3),

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

-- CreateIndex
CREATE INDEX "tbl_order_refund_issue_order_id_user_id_brand_id_currency_c_idx" ON "tbl_order_refund_issue"("order_id", "user_id", "brand_id", "currency", "currency_symbol", "amount", "refund_issued_at", "is_admin_verified", "admin_verified_at");

-- AddForeignKey
ALTER TABLE "tbl_order_refund_issue" ADD CONSTRAINT "tbl_order_refund_issue_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "tbl_user"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "tbl_order_refund_issue" ADD CONSTRAINT "tbl_order_refund_issue_brand_id_fkey" FOREIGN KEY ("brand_id") REFERENCES "tbl_user"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "tbl_order_refund_issue" ADD CONSTRAINT "tbl_order_refund_issue_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "tbl_order"("id") ON DELETE CASCADE ON UPDATE CASCADE;
