-- CreateTable
CREATE TABLE "fiat_withdrawal_orders" (
    "order_id" BIGSERIAL NOT NULL,
    "order_no" VARCHAR(50) NOT NULL,
    "account_sequence" VARCHAR(20) NOT NULL,
    "user_id" BIGINT NOT NULL,
    "amount" DECIMAL(20,8) NOT NULL,
    "fee" DECIMAL(20,8) NOT NULL,
    "payment_method" VARCHAR(20) NOT NULL,
    "bank_name" VARCHAR(100),
    "bank_card_no" VARCHAR(50),
    "card_holder_name" VARCHAR(100),
    "alipay_account" VARCHAR(100),
    "alipay_real_name" VARCHAR(100),
    "wechat_account" VARCHAR(100),
    "wechat_real_name" VARCHAR(100),
    "status" VARCHAR(20) NOT NULL DEFAULT 'PENDING',
    "error_message" VARCHAR(500),
    "reviewed_by" VARCHAR(100),
    "reviewed_at" TIMESTAMP(3),
    "review_remark" VARCHAR(500),
    "paid_by" VARCHAR(100),
    "paid_at" TIMESTAMP(3),
    "payment_proof" VARCHAR(500),
    "payment_remark" VARCHAR(500),
    "detail_memo" TEXT,
    "frozen_at" TIMESTAMP(3),
    "completed_at" TIMESTAMP(3),
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT "fiat_withdrawal_orders_pkey" PRIMARY KEY ("order_id")
);

-- CreateIndex
CREATE UNIQUE INDEX "fiat_withdrawal_orders_order_no_key" ON "fiat_withdrawal_orders"("order_no");

-- CreateIndex
CREATE INDEX "fiat_withdrawal_orders_account_sequence_idx" ON "fiat_withdrawal_orders"("account_sequence");

-- CreateIndex
CREATE INDEX "fiat_withdrawal_orders_user_id_idx" ON "fiat_withdrawal_orders"("user_id");

-- CreateIndex
CREATE INDEX "fiat_withdrawal_orders_status_idx" ON "fiat_withdrawal_orders"("status");

-- CreateIndex
CREATE INDEX "fiat_withdrawal_orders_payment_method_idx" ON "fiat_withdrawal_orders"("payment_method");

-- CreateIndex
CREATE INDEX "fiat_withdrawal_orders_reviewed_by_idx" ON "fiat_withdrawal_orders"("reviewed_by");

-- CreateIndex
CREATE INDEX "fiat_withdrawal_orders_created_at_idx" ON "fiat_withdrawal_orders"("created_at");
