<?php

namespace Database\Factories;

use App\Models\PlatformNotification;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/** @extends Factory<PlatformNotification> */
class PlatformNotificationFactory extends Factory
{
    protected $model = PlatformNotification::class;

    public function definition(): array
    {
        return [
            'uuid' => (string) Str::uuid(),
            'user_id' => User::factory(),
            'title' => fake()->sentence(4),
            'message' => fake()->paragraph(),
            'channel' => 'in_app',
            'priority' => 'normal',
            'category' => 'system_update',
            'status' => 'sent',
            'sent_at' => now(),
        ];
    }

    public function unread(): static
    {
        return $this->state(fn (): array => ['read_at' => null]);
    }

    public function critical(): static
    {
        return $this->state(fn (): array => ['priority' => 'critical', 'category' => 'security']);
    }
}
