<?php

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

class CreateOrderIssuesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_issues', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamp('created_at')->index()->nullable();
            $table->timestamp('updated_at')->index();
            $table->integer('order_id')->index()->nullable()->comment('订单');
            $table->enum('handle_status', ['处理中', '已完结'])->default('处理中')->comment('处理状态');
            $table->string('send_back_number')->nullable()->index()->comment('退回单号');
            $table->enum('is_new_rejecting',['无','有','已处理'])->default('无')->index()->comment('有新退件');
            $table->integer('rejected_bill_id')->index()->nullable()->comment('退回单');
            $table->enum('rejecting_status', ['无', '未退回', '全部退回', '部分退回', '差异退回', '超量退回'])->default('无')->index()->comment('退回状态');
            $table->string('order_issue_type_id')->nullable()->comment('问题类别');
            $table->string('result_explain')->nullable()->comment('处理结果说明');
            $table->integer('second_order_id')->nullable()->comment('二次订单号');
            $table->enum('final_status', ['已解决', '待退回', '退回中'])->index()->nullable()->comment('最终状态');
            $table->decimal('logistic_indemnity_money')->index()->nullable()->comment('承运商赔偿金额');
            $table->enum('logistic_express_remission', ['原单减免', '补发减免', '全部减免'])->index()->nullable()->comment('承运商快递减免');
            $table->decimal('baoshi_indemnity_money')->index()->nullable()->comment('宝时赔偿金额');
            $table->enum('baoshi_express_remission', ['原单减免', '补发减免', '全部减免'])->index()->nullable()->comment('宝时快递减免');
            $table->integer('user_workgroup_id')->index()->nullable()->comment('事故责任方');


//            $table->string('situation_explain')->nullable()->comment('情况说明');
//            $table->integer('second_logistic_id')->nullable()->comment('二次承运商');
//            $table->String('second_logistic_number')->nullable()->comment('二次运单号');
        });
    }

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