<?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_withdraw_records', function (Blueprint $table) {
            $table->comment('钱包提现记录');
            $table->increments('id');
            $table->unsignedBigInteger('wallet_id')->comment('钱包编号');
            $table->string('external_no')->nullable()->comment('外部交易单号');
            $table->string('withdraw_type')->default('')->comment('提现方式');
            $table->string('withdraw_account')->default('')->comment('提现账户');
            $table->string('withdraw_account_name')->default('')->comment('提现账户名');
            $table->decimal('amount')->comment('提现金额');
            $table->decimal('fee')->default(new \Illuminate\Database\Query\Expression('0.00'))->comment('提现手续费');
            $table->timestamp('withdraw_time')->nullable()->comment('提现时间');
            $table->string('area_code')->default('')->comment('行政区划代码');
            $table->string('remark')->nullable()->comment('备注');
            $table->string('auditor')->nullable()->comment('审核人');
            $table->timestamp('audit_time')->nullable()->comment('审核时间');
            $table->string('audit_remark')->nullable()->comment('审核回执');
            $table->string('audit_state')->default('pending')->comment('审核状态');
            $table->string('state')->default('processing')->comment('状态');
            $table->timestamps();
            $table->softDeletes();
        });
    }

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