<?php

namespace Database\Factories;

use App\Enums\StockOpnameStatus;
use App\Models\Outlet;
use App\Models\StockOpname;
use Illuminate\Database\Eloquent\Factories\Factory;

class StockOpnameFactory extends Factory
{
    protected $model = StockOpname::class;

    public function definition(): array
    {
        return [
            'outlet_id' => Outlet::factory(),
            'period_month' => $this->faker->date('Y-m'),
            'status' => $this->faker->randomElement(StockOpnameStatus::cases()),
            'note' => $this->faker->optional()->sentence(8),
        ];
    }

    public function draft(): Factory
    {
        return $this->state(fn () => ['status' => StockOpnameStatus::DRAFT]);
    }

    public function process(): Factory
    {
        return $this->state(fn () => ['status' => StockOpnameStatus::PROCESS]);
    }

    public function pendingApproval(): Factory
    {
        return $this->state(fn () => ['status' => StockOpnameStatus::PENDING_APPROVAL]);
    }

    public function completed(): Factory
    {
        return $this->state(fn () => ['status' => StockOpnameStatus::COMPLETED]);
    }
}
