<?php

namespace App\Models;

use App\Enums\ModerationRuleType;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class ContentModerationRule extends Model
{
    protected $table = 'content_moderation_rules';

    protected $fillable = [
        'type',
        'value',
        'enabled',
        'weight',
        'notes',
        'created_by',
    ];

    protected $casts = [
        'type' => ModerationRuleType::class,
        'enabled' => 'boolean',
        'weight' => 'integer',
    ];

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