<?php

namespace Database\Factories;

use App\Models\Company;
use App\Models\Product;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class ProductFactory extends Factory
{
    protected $model = Product::class;

    public function definition(): array
    {
        $name = fake()->unique()->words(3, true);

        return [
            'company_id' => Company::factory(),
            'name' => Str::title($name),
            'slug' => Str::slug($name),
            'sku' => strtoupper(fake()->unique()->bothify('SKU-####')),
            'barcode' => fake()->unique()->ean13(),
            'type' => 'simple',
            'cost_price' => fake()->randomFloat(4, 10, 200),
            'selling_price' => fake()->randomFloat(4, 250, 600),
            'track_stock' => true,
            'allow_negative_stock' => false,
            'is_active' => true,
            'is_featured' => false,
        ];
    }
}
