<?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('tbl_account_receivable', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('idticket')->unsigned();
            $table->date('deadline');
            $table->unsignedBigInteger('amount_paid');
            $table->unsignedBigInteger('debt');
            $table->float('total', 10, 2);
            $table->dateTime('payment_date')->nullable();
            $table->char('paid', 1)->default(0);
            $table->string('url_document')->nullable();
            $table->char('status', 1)->default(1);

            $table->foreign('idticket')->references('id')->on('tbl_ticket');
            $table->timestamps();
        });
    }

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