<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('orden_produccions', function (Blueprint $table) {
            $table->id();

            $table->string('numero_orden')->unique();
            $table->string('prenda_modelo');
            $table->string('referencia');
            $table->integer('cantidad_total');

            $table->foreignId('tela_id')
                ->nullable()
                ->constrained('telas')
                ->nullOnDelete();

            $table->date('fecha_inicio');
            $table->date('fecha_entrega_estimada');

            $table->enum('estado', [
                'en_corte',
                'en_confeccion',
                'en_tintoreria',
                'en_acabados',
                'finalizada'
            ])->default('en_corte');

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

    public function down(): void
    {
        Schema::dropIfExists('orden_produccions');
    }
};
