<?php

namespace App\Models;

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

class Event extends Model
{
    /** @use HasFactory<\Database\Factories\EventFactory> */
    use HasFactory;

    protected $fillable = [
        'name', 'key', 'description', 'active', 'config',
    ];

    protected function casts(): array
    {
        return [
            'active' => 'boolean',
            'config' => 'array',
        ];
    }

    public function decisions(): BelongsToMany
    {
        return $this->belongsToMany(\App\Models\Decision::class);
    }
}
