<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ActivitiesOrganised extends Model
{
    use HasFactory;

    protected $table = 'activities_organiseds';

    protected $fillable = [
        'title',
        'resource_person_name',
        'resource_person_organization',
        'target_audience',
        'number_of_participants',
        'objective',
        'outcomes',
        'department_id',
        'faculty_id',
        'start_date',
        'end_date',
        'num_days',
        'venue',
        'activity_type',
        'category',
        'level',
        'proof'
    ];

    protected $casts = [
        'start_date' => 'datetime',
        'end_date' => 'datetime',
        'number_of_participants' => 'integer',
        'num_days' => 'integer'
    ];

    /**
     * Get the department that owns the activity.
     */
    public function department()
    {
        return $this->belongsTo(Department::class);
    }

    /**
     * Get the faculty user that owns the activity.
     */
    public function user()
    {
        return $this->belongsTo(User::class, 'faculty_id');
    }
}