<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $this->down();
        Schema::create('planes', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('grupo_plan_id');
            $table->foreign('grupo_plan_id')->references('id')->on('grupos_planes');

            $table->string('titulo');
            $table->text('descripcion');

            $table->bigInteger('precio_plan')->nullable()->comment('costo del plan');

            $table->integer('limite_transacciones_libres')->comment('transacciones que tienen permitido hacer sin cobrar')->nullable();
            $table->string('tipo_calculo')->default('+');
            $table->float('precio_transaccion', 10, 2)->nullable()->comment('costo de transacciones despues de pasar el limite');

            $table->integer('orden')->nullable();
            $table->boolean('estado')->default(true);
            $table->timestamps();
        });
    }

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