<?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('deliveries', function (Blueprint $table) {
            $table->id();
            $table->foreignId('access_log_id')->constrained('access_logs')->onDelete('cascade');
            $table->string('company'); // ej: PedidosYa, Rappi, Chilexpress, Mercado Libre
            $table->string('recipient_name')->nullable(); // Nombre del destinatario
            $table->string('delivery_point')->default('recepcion'); // recepcion, casillero, puerta
            $table->timestamps();
        });
    }

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