<?php

use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\ContainerTypes;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateContainersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('containers', function (Blueprint $table) {
            $table->id();
            $table->morphs('owner');
            $table->string('reference');
            $table->string('container_number')->nullable();
            $table->integer('container_type')->default(ContainerTypes::FORTY_FEET_DRY_CONTAINER);
            $table->string('seal_reference')->nullable();
            $table->timestamp('loading_date')->nullable();
            $table->integer('status')->default(ApprovalStatus::PENDING_SUBMISSION);
            $table->softDeletes();
            $table->timestamps();
        });
    }

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