<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('question_surveys', function (Blueprint $table) {
            $table->id();
            
            // Relation table
            $table->unsignedBigInteger('survey_id')->nullable(); // survey_id
            $table->foreign('survey_id')->references('id')->on('surveys')->onUpdate('CASCADE')->onDelete('CASCADE');

            $table->string('name')->nullable();
            $table->string('type')->default('Iya atau Tidak')->nullable();
            $table->string('status')->default('Submitted'); // [Submitted, Deleted]

            $table->unsignedBigInteger("updated_by")->nullable();
            $table->unsignedBigInteger("created_by")->nullable();
            $table->unsignedBigInteger("deleted_by")->nullable();
            $table->softDeletes();

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

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