<?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('repairs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('asset_id')->constrained()->onDelete('cascade');
            $table->string('issue')->nullable();
            $table->string('vendor_name')->nullable();
            $table->decimal('cost', 10, 2)->nullable();
            $table->string('invoice_path')->nullable();
            $table->date('sent_date')->nullable();
            $table->date('return_date')->nullable();
            $table->enum('status', ['In Repair', 'Returned'])->default('In Repair');
            $table->timestamps();
        });
    }

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