<?php
// database/migrations/2026_03_13_xxxxxx_create_kurir_assignment_table_v2.php

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

return new class extends Migration
{
    public function up()
    {
        Schema::create('kurir_assignment', function (Blueprint $table) {
            $table->id();
            $table->foreignId('pesanan_id')->constrained('pesanan')->onDelete('cascade');
            $table->foreignId('kurir_id')->constrained('users')->onDelete('cascade');
            $table->enum('status', ['ditugaskan', 'dijemput', 'diantar', 'selesai'])->default('ditugaskan');
            $table->text('catatan')->nullable();
            $table->string('foto_bukti')->nullable();
            $table->timestamp('tanggal_diterima')->nullable();
            $table->timestamps();
        });
    }

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