<?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('coach_scores', function (Blueprint $table) {
            $table->comment('技师评分');
            $table->increments('id');
            $table->unsignedBigInteger('coach_id')->comment('技师编号');
            $table->integer('service_duration')->default(new \Illuminate\Database\Query\Expression('0'))->nullable()->comment('服务时长(分钟)');
            $table->integer('order_count')->default(new \Illuminate\Database\Query\Expression('0'))->nullable()->comment('订单数量');
            $table->decimal('good_rate')->default(new \Illuminate\Database\Query\Expression('0.00'))->nullable()->comment('好评率');
            $table->decimal('efficiency')->default(new \Illuminate\Database\Query\Expression('0.00'))->nullable()->comment('服务效率');
            $table->decimal('punctual_rate')->default(new \Illuminate\Database\Query\Expression('0.00'))->nullable()->comment('准时率');
            $table->decimal('completion_rate')->default(new \Illuminate\Database\Query\Expression('0.00'))->nullable()->comment('完成率');
            $table->decimal('rating_score')->default(new \Illuminate\Database\Query\Expression('5.0'))->nullable()->comment('评价得分');
            $table->timestamps();
            $table->softDeletes();
        });
    }

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