<?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('procesos', function (Blueprint $table) {
            $table->id();
            $table->date('fecha_inicio');
            $table->integer('numero_proceso');
            $table->string('codigo_proceso');
            $table->text('descripcion_proceso');
            $table->string('numero_nurej')->nullable();
            $table->string('numero_cud')->nullable();
            $table->string('numero_expediente')->nullable();
            $table->string('numero_caso')->nullable();
            $table->integer('id_contraloria')->nullable();
            $table->foreignId('ciudad_id')->constrained('par_ciudads')->comment('Lugar donde se lleva el proceso relacionado ciudad,provincia,municipio,ciudad');
            $table->foreignId('tipo_parte_demandante_id')->constrained('parametros');
            $table->text('parte_demandante');
            $table->foreignId('tipo_delito_id')->nullable()->constrained('parametros');
            $table->string('juzgado',600)->nullable();
            $table->decimal('daño_economico', 14, 2)->default(0);
            $table->foreignId('tipo_proceso_id')->constrained('parametros');
            $table->boolean('estado')->default(true);
            $table->unsignedBigInteger('created_by')->nullable();
            $table->unsignedBigInteger('updated_by')->nullable();
            $table->unsignedBigInteger('deleted_by')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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