<?php

namespace Database\Factories;

use App\Models\Artwork;
use App\Models\ArtworkComment;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

class ArtworkCommentFactory extends Factory
{
    protected $model = ArtworkComment::class;

    public function definition(): array
    {
        $raw = $this->faker->sentence(12);

        return [
            'artwork_id'       => Artwork::factory(),
            'user_id'          => User::factory(),
            'content'          => $raw,
            'raw_content'      => $raw,
            'rendered_content' => '<p>' . e($raw) . '</p>',
            'is_approved'      => true,
        ];
    }

    public function unapproved(): static
    {
        return $this->state(['is_approved' => false]);
    }
}
