<?php

namespace App\Http\Requests\InventoryMovements;

use Illuminate\Foundation\Http\FormRequest;

class StoreInventoryMovementRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'date' => ['required', 'date_format:Y-m-d'],
            'item_id' => ['required', 'integer'],
            'type' => ['required', 'string', 'in:IN,OUT,ADJUST'],
            'quantity' => ['required', 'numeric', 'gt:0'],
            'reason' => ['required', 'string', 'max:50'],
            'ref' => ['nullable', 'array'],
            'ref.batch_id' => ['nullable', 'integer'],
            'ref.tank_id' => ['nullable', 'integer'],
            'ref.daily_log_id' => ['nullable', 'integer'],
            'ref.note' => ['nullable', 'string', 'max:2000'],
        ];
    }
}
