<?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('activities_organiseds', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->string('resource_person_name');
            $table->text('resource_person_organization');
            $table->string('target_audience');
            $table->integer('number_of_participants');
            $table->text('objective');
            $table->text('outcomes');
            $table->unsignedBigInteger('department_id');
            $table->unsignedBigInteger('faculty_id'); // assuming faculty_id refers to user_id
            $table->dateTime('start_date');
            $table->dateTime('end_date');
            $table->integer('num_days');
            $table->string('venue');
            $table->string('activity_type');
            $table->string('category');
            $table->string('level');
            $table->string('proof')->nullable(); // For file path            
            $table->foreign('faculty_id')->references('id')->on('users')->onDelete('cascade');
            $table->foreign('department_id')->references('id')->on('departments')->onDelete('cascade');
            $table->timestamps();
        });
    }

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