<?php

namespace App\Models;

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

class EventAttendee extends Model
{
    protected $table = 'event_attendees';

    protected $fillable = [
        'event_id',
        'attendee_user_id',
        'attendee_uri',
        'email',
        'name',
        'role',
        'partstat',
        'cutype',
        'rsvp',
        'is_organizer',
        'extra',
    ];

    protected $casts = [
        'rsvp' => 'boolean',
        'is_organizer' => 'boolean',
        'extra' => 'array',
    ];

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

    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class, 'attendee_user_id');
    }
}
