<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class MeetupSession extends Model
{
    protected $table = 'meetup_sessions';

    protected $fillable = [
        'event_id',
        'session_key',
        'day',
        'time',
        'title',
        'speaker',
        'venue',
        'allowed_roles',
        'is_parallel',
        'is_published',
    ];

    protected function casts(): array
    {
        return [
            'day' => 'date',
            'allowed_roles' => 'array',
            'is_parallel' => 'boolean',
            'is_published' => 'boolean',
        ];
    }

    public function event(): BelongsTo
    {
        return $this->belongsTo(MeetupEvent::class, 'event_id');
    }
}
