<?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('posts', function (Blueprint $table) {
    $table->id();
    $table->foreignId('user_id')->constrained()->onDelete('cascade');
    $table->string('origem');
    $table->string('destino');
    $table->float('preco', 8, 2);
    $table->integer('assentos');
    $table->string('cor_carro');
    $table->string('matricula');
    $table->json('paragens')->nullable();
    $table->decimal('origem_lat', 10, 8);
    $table->decimal('origem_lng', 11, 8);
    $table->decimal('destino_lat', 10, 8);
    $table->decimal('destino_lng', 11, 8);
    $table->tinyInteger('status')->default(0); // 0=disponível
    $table->timestamps();
});

    }

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