<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wallet_payment_records', function (Blueprint $table) {
            $table->comment('钱包支付记录');
            $table->increments('id');
            $table->unsignedBigInteger('order_id')->comment('订单编号');
            $table->unsignedBigInteger('wallet_id')->comment('钱包编号');
            $table->unsignedBigInteger('trans_record_id')->nullable()->comment('交易记录编号');
            $table->string('payment_no')->default('')->comment('交易单号');
            $table->string('payment_method')->default('')->comment('支付方式');
            $table->decimal('total_amount')->comment('合计支付金额');
            $table->decimal('actual_amount')->comment('实际支付金额');
            $table->decimal('used_wallet_balance')->comment('使用钱包余额');
            $table->decimal('used_recharge_balance')->comment('使用充值余额');
            $table->timestamp('payment_time')->nullable()->comment('支付时间');
            $table->string('remark')->nullable()->comment('备注');
            $table->string('state')->default('pending')->comment('状态');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wallet_payment_records');
    }
};
