<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ChatBlock extends Model
{
    protected $fillable = ['visitor_id', 'reason', 'blocked_by'];

    /**
     * PRC-611 — visitor uuid engelli mi? (null/boş → false)
     */
    public static function isBlocked(?string $visitorId): bool
    {
        return $visitorId !== null && $visitorId !== ''
            && static::where('visitor_id', $visitorId)->exists();
    }
}
