<?php

namespace App\Http\Requests\Shipment;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'status' => 'required|in:scheduled,ready,shipping,completed',

            // 상태별 추가 데이터
            'loading_time' => 'nullable|date',
            'loading_completed_at' => 'nullable|date',
            'vehicle_no' => 'nullable|string|max:20',
            'driver_name' => 'nullable|string|max:50',
            'driver_contact' => 'nullable|string|max:50',
            'confirmed_arrival' => 'nullable|date',
        ];
    }

    public function messages(): array
    {
        return [
            'status.required' => __('validation.required', ['attribute' => '상태']),
            'status.in' => __('validation.in', ['attribute' => '상태']),
        ];
    }
}
