<?php

namespace Database\Factories;

use App\Models\Order;
use App\Models\User;
use App\Models\Service;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Log;

class OrderFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = Order::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
		$quantity = $this->faker->numberBetween(100, 10000);
        return [
			'quantity' => $quantity,
			'status' => $this->faker->randomElement(['pending', 'completed',
			'canceled', 'processing']),
			'remaining' => $this->faker->numberBetween(0, $quantity),
			'url' => $this->faker->url,
			'service_id' => function() {
				return Service::inRandomOrder()->first()->id;
			},
			'user_id' => function() {
				return User::inRandomOrder()->first()->id;
			},
        ];
    }

}
