<?php

use Faker\Generator as Faker;
use App\Classes\Constants;

$factory->define(App\Models\Order::class, function (Faker $faker) {
    $step = $faker->randomElement([Constants::ORDER_PROCESSING_STEP, Constants::ORDER_WAREHOUSE_RECEIVING_STEP, Constants::ORDER_WAREHOUSE_PACKING_STEP, Constants::ORDER_SHIPPING_STEP,  Constants::ORDER_WAREHOUSE_ARRIVAL_STEP,  Constants::ORDER_WAREHOUSE_UNPACKING_STEP,  Constants::ORDER_DELIVERY_STEP, null]);
    return [
        'company_id' => $faker->numberBetween(1, 30),
        'marking' => $faker->numberBetween(200000, 999999),
        'warehouse_id' => $faker->numberBetween(1, 30),
        'current_step' => $step,
        'complete' => $step ? 0 : 1,
        'created_at' => $faker->dateTimeBetween($startDate = '-30 days', $endDate = '30 days'),
        'updated_at' => $faker->dateTimeBetween($startDate = '-30 days', $endDate = '30 days')
    ];
});
