<?php

namespace App\Http\Requests\V3\RoadItem\Operator;

use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class StoreRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, ValidationRule|array|string>
     */
    public function rules(): array
    {
        return [
            'mission_id' => 'required|integer|exists:missions,id',
            'start_point' => 'required',
            'item_id' => 'required|integer',
            'sub_item_id' => 'required|integer',
            'amount' => 'required|numeric',
            'observed_item_id' => 'integer|exists:observed_items,id',
            'activity_date' => 'required|date_format:Y-m-d',
            'activity_time' => 'required|date_format:H:i',
            'before_image' => 'image|max:4096',
            'after_image' => 'image|max:4096',
            'machines_id' => 'required|array',
            'machines_id.*' => 'required|exists:cmms_machines,id',
            'rahdaran_id' => 'required|array',
            'rahdaran_id.*' => 'required|exists:rahdaran,id',
        ];
    }

    public function attributes(): array
    {
        return [
            'activity_date' => 'تاریخ فعالیت',
            'activity_time' => 'ساعت فعالیت',
        ];
    }
}
