<?php

namespace Database\Factories;

use App\Models\Post;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Post>
 */
class PostFactory extends Factory
{
    protected $model = Post::class;

    public function definition(): array
    {
        return [
            'user_id'         => User::factory(),
            'type'            => Post::TYPE_TEXT,
            'visibility'      => Post::VISIBILITY_PUBLIC,
            'status'          => Post::STATUS_PUBLISHED,
            'body'            => fake()->paragraph(),
            'meta'            => null,
            'reactions_count' => 0,
            'comments_count'  => 0,
        ];
    }

    public function artworkShare(): static
    {
        return $this->state(['type' => Post::TYPE_ARTWORK_SHARE]);
    }

    public function followersOnly(): static
    {
        return $this->state(['visibility' => Post::VISIBILITY_FOLLOWERS]);
    }

    public function private(): static
    {
        return $this->state(['visibility' => Post::VISIBILITY_PRIVATE]);
    }
}
