<?php

namespace App\Http\Requests\V3\AccidentReceipt;

use App\Enums\AccidentStates;
use App\Models\DailyAccidentSettings;
use Illuminate\Foundation\Http\FormRequest;

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, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'province_id' => 'required|integer|exists:provinces,id',
            'city_id' => 'required|integer|exists:cities,id',
            'axis_name' => 'required|string',
            'driver_name' => 'required|string',
            'plaque' => 'required|string',
            'driver_national_code' => 'required|string',
            'driver_phone_number' => 'required|string',
            'lat' => 'required|numeric',
            'lng' => 'required|numeric',
            'accident_type' => 'required|integer',
            'accident_date' => 'required|date',
            'accident_time' => 'required|string',
            'report_base' => 'required|in:0,1',
            'police_file' => 'required_if:report_base,0|file|mimes:pdf,jpg,jpeg,png',
            'police_serial' => 'required_if:report_base,0|string',
            'police_file_date' => 'required_if:report_base,0|date',
            'damage_picture1' => 'required|file|mimes:pdf,jpg,jpeg,png',
            'damage_picture2' => 'required|file|mimes:pdf,jpg,jpeg,png',
            'damage_items' => 'required|array',
            'damage_items.*.value' => 'required',
            'damage_items.*.amount' => 'required',
        ];
    }
}
