<?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('events', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained('users')->onDelete('cascade');
            $table->foreignId('subscription_plan_id')->constrained('subscription_plans')->onDelete('cascade');
            $table->foreignId('meal_type_id')->constrained('meal_types')->onDelete('cascade');
            $table->foreignId('payer_type_id')->constrained('payer_types')->onDelete('cascade');
            $table->foreignId('gender_id')->constrained('genders')->onDelete('cascade');
            $table->foreignId('self_coming_with')->comment('i am coming with')->constrained('accompany_types','id')->onDelete('cascade');
            $table->foreignId('you_are_coming_with')->comment('You are coming with')->constrained('accompany_types','id')->onDelete('cascade');
            $table->foreignId('city_id')->constrained('cities')->onDelete('cascade');
            $table->string('city_area')->nullable();
            $table->string('address')->nullable();
            $table->decimal('dinner_budget');
            $table->dateTime('event_datetime')->nullable();
            $table->string('event_image')->nullable();
            $table->enum('status',[0,1,2])->default(2)->comment('1=>Closed or completed, 0=>Inactive,2=>pending');
            $table->softDeletes();
            $table->timestamps();
        });
    }

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