<?php

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

return new class extends Migration {
    public function up(): void
    {
        Schema::create('order_commissions', function (Blueprint $table) {
            $table->id();
            $table->integer('order_id');
            $table->integer('role')->comment('角色,1推荐人,2教练,3副教练,4客服');
            $table->integer('user_id')->comment('服务人员user_id');
            $table->integer('commission_type')->default(1)->comment('分佣类型,1为比例,2为固定金额');
            $table->decimal('commission_val',7,2)->comment('分佣比例/固定金额金额');
            $table->string('commission_amount')->comment('佣金');
            $table->string('send_event')->comment('佣金入账事件');
            $table->integer('delay')->comment('入账延迟(天)');
            $table->integer('status')->default(0)->comment('入账状态,0未入账,1已入账');
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('order_commissions');
    }
};
