<?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('sales', function (Blueprint $table) {
            $table->id();
            // 1. Cliente que compra
            $table->foreignId('user_id')->constrained()->onDelete('cascade');
            // 2. Datos generales de la venta
            $table->decimal('total', 10, 2); // Total final del ticket
            $table->string('metodo_pago'); // Ej: "Efectivo", "Tarjeta", "MercadoPago"
            //capaz van mas datos ni idea
            // 3. Fecha y Hora (created_at servirá como fecha de venta)
            $table->timestamps();
        });
    }

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