<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('technician_skills', function (Blueprint $table) {
            $table->id();
            $table->foreignId('technician_id')->constrained()->onDelete('cascade');
            $table->string('skill_name');
            $table->string('category')->default('general'); // engine, electrical, transmission, brakes, etc.
            $table->integer('proficiency_level')->default(1); // 1-5 scale
            $table->date('certified_date')->nullable();
            $table->date('certification_expires')->nullable();
            $table->string('certification_body')->nullable();
            $table->text('notes')->nullable();
            $table->boolean('is_primary_skill')->default(false);
            $table->timestamps();

            $table->index(['technician_id', 'skill_name']);
            $table->index(['category', 'proficiency_level']);
        });
    }

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