<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

use App\Models\Product;
use App\Traits\FactoryActiveTrait;

class ProductFactory extends Factory
{
	use FactoryActiveTrait;

	/**
	 * The name of the factory's corresponding model.
	 *
	 * @var string
	 */
	protected $model = Product::class;

	/**
	 * Define the model's default state.
	 *
	 * @return array
	 */
	public function definition()
	{
		return [
			'id' => $this->faker->numberBetween(1,65535),
			// 'created_at',
			// 'updated_at',
			//* 'site_id',					// Needs to be passed in
			'taxable' => TRUE,
			'active' => TRUE,
			// 'position'
			'pricing'=>json_encode([
				[
					'show'=>true,
					[
						'setup'=>50,
						'base'=>100,
					]
				]
			]),
			// 'price_recur_default'
			// 'price_recur_strict'
			'model_id' => 1,
			// 'accounting'
			'model' => Product\Broadband::class,
		];
	}

	/* STATES */

	public function notStrict()
	{
		return $this->state(function () {
			return [
				'price_recur_strict' => FALSE,
			];
		});
	}

	public function strict()
	{
		return $this->state(function () {
			return [
				'price_recur_strict' => TRUE,
			];
		});
	}
}