<?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('telas', function (Blueprint $table) {
            $table->id();

            $table->string('codigo');
            $table->string('tipo');

            $table->string('foto')->nullable();
            $table->string('color')->nullable();

            $table->foreignId('proveedor_id')->constrained('proveedors')->cascadeOnDelete();

            $table->integer('metros_comprados');
            $table->integer('metros_disponibles');

            $table->date('fecha_compra');

            $table->integer('valor_total');
            $table->integer('costo_por_metro');

            $table->text('observaciones')->nullable();

            $table->timestamps();
        });
    }

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