<?php

namespace App\Http\Requests\V1\Receiving;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'receiving_qty' => ['required', 'numeric', 'min:0'],
            'receiving_date' => ['nullable', 'date'],
            'lot_no' => ['nullable', 'string', 'max:50'],
            'supplier_lot' => ['nullable', 'string', 'max:50'],
            'receiving_location' => ['nullable', 'string', 'max:100'],
            'receiving_manager' => ['nullable', 'string', 'max:50'],
            'remark' => ['nullable', 'string', 'max:1000'],
        ];
    }

    public function messages(): array
    {
        return [
            'receiving_qty.required' => __('validation.required', ['attribute' => '입고수량']),
            'receiving_qty.numeric' => __('validation.numeric', ['attribute' => '입고수량']),
            'receiving_qty.min' => __('validation.min.numeric', ['attribute' => '입고수량', 'min' => 0]),
        ];
    }
}
