<?php

namespace App\Services\Moderation;

use App\Models\ContentModerationFeedback;
use App\Models\ContentModerationFinding;
use App\Models\User;

class ModerationFeedbackService
{
    /**
     * @param array<string, mixed> $meta
     */
    public function record(ContentModerationFinding $finding, string $feedbackType, ?User $actor = null, ?string $notes = null, array $meta = []): ContentModerationFeedback
    {
        return ContentModerationFeedback::query()->create([
            'finding_id' => $finding->id,
            'feedback_type' => $feedbackType,
            'actor_id' => $actor?->id,
            'notes' => $notes,
            'meta_json' => $meta,
            'created_at' => now(),
        ]);
    }
}