<?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('iv_organiseds', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('faculty_id'); // Organising faculty (Convenor/Coordinator)
            $table->dateTime('start_date');
            $table->dateTime('end_date');
            $table->string('company_name'); // Name of the Company/field/institute
            $table->text('company_address'); // Address of the company/field/institute
            $table->string('resource_person_name');
            $table->text('resource_person_contact_details');
            $table->string('target_audience'); // (faculty/student)
            $table->string('student_year')->nullable(); // Year of study if students
            $table->integer('number_of_participants');
            $table->text('objective');
            $table->text('outcomes');
            $table->unsignedBigInteger('department_id');
            $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('iv_organiseds');
    }
};