<?php

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

class CreateFlightTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('flights', function (Blueprint $table) {
            $table->id();
            $table->string('name', 300);
            $table->string('email', 250)->unique();
            $table->string('phone', 14)->nullable()->unique();
            $table->integer('babies_count')->nullable();
            $table->integer('children_count')->nullable();
            $table->integer('adult_count')->nullable();
            $table->integer('person_total')->nullable();
            $table->enum('trip_type', ['go', 'go_back']);
            $table->date('going_date');
            $table->date('return_date')->nullable();
            $table->enum('trip_direction', ['direct', 'transit']);
            $table->enum('class_type', ['economic', 'distinctive_economy', 'business_class', 'first_class']);
            $table->unsignedBigInteger('departure_city');
            $table->unsignedBigInteger('arrival_city');
            $table->unsignedBigInteger('departure_airport');
            $table->unsignedBigInteger('arrival_airport');

            $table->timestamps();
            $table->softDeletes();
        });
    }

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