<?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()
    {
        Schema::create('corporate_policies', function (Blueprint $table) {
            $table->id();
            $table->string('corporate_id');
            $table->string('code')->index();
            // $table->string('policy_id')->index();
            $table->string('total_premi', 30)->nullable();
            $table->string('minimal_deposit_percentage', 30)->nullable();
            $table->string('minimal_deposit_net', 30)->nullable();
            $table->string('minimal_alert_percentage', 30)->nullable();
            $table->string('minimal_alert_net', 30)->nullable();
            $table->string('minimal_stop_service_percentage', 30)->nullable();
            $table->string('minimal_stop_service_net', 30)->nullable();
            $table->date('start')->nullable();
            $table->date('end')->nullable();
            $table->boolean('active')->default(false);

            $table->timestamps();
            $table->softDeletes();
            
            $table->foreignId('created_by')->nullable();
            $table->foreignId('updated_by')->nullable();
            $table->foreignId('deleted_by')->nullable();
        });
    }

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