<?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('borrowers', function (Blueprint $table) {
            $table->id();
            $table->string('code', 15)->nullable();
            $table->string('first_name', 90);
            $table->string('last_name', 90);
            $table->string('phone', 18)->nullable();
            $table->string('email', 100)->nullable();
            $table->double('total_loans')->default(0);
            $table->double('total_restitutions')->default(0);
            $table->integer('number_loans')->default(0);
            $table->integer('count_loans')->default(0);
            $table->integer('number_bad_restitutions')->default(0);
            $table->boolean('in_progress')->default(false);
            $table->timestamps();
            $table->softDeletes();
        });
    }

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