<?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('cars', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->enum('type', ['sale', 'rent', 'both'])->default('sale');
            $table->decimal('price', 15, 2)->nullable();
            $table->decimal('daily_price', 15, 2)->nullable();
            $table->decimal('monthly_price', 15, 2)->nullable();
            $table->enum('status', ['available', 'reserved', 'rented', 'sold'])->default('available');
            $table->integer('year');
            $table->integer('mileage')->default(0);
            $table->string('transmission'); // manual, automatic
            $table->string('fuel_type'); // petrol, diesel, electric, hybrid
            $table->text('description')->nullable();
            $table->json('features')->nullable();
            $table->timestamps();
        });
    }

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