<?php

namespace Database\Factories;

use App\Enums\ReviewStatus;
use App\Models\Product;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<\App\Models\Review>
 */
class ReviewFactory extends Factory
{
    public function definition(): array
    {
        return [
            'product_id' => Product::factory(),
            'user_id' => User::factory(),
            'rating' => fake()->numberBetween(3, 5),
            'title' => fake()->sentence(4),
            'comment' => fake()->paragraph(),
            'status' => ReviewStatus::Approved,
        ];
    }

    public function unapproved(): static
    {
        return $this->state(fn () => ['status' => ReviewStatus::Pending]);
    }

    public function rejected(): static
    {
        return $this->state(fn () => ['status' => ReviewStatus::Rejected]);
    }
}
