<?php

namespace App\Http\Requests;

use App\Models\ServiceComplaint;
use Gate;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Response;

class UpdateServiceComplaintRequest extends FormRequest
{
    public function authorize()
    {
        return Gate::allows('service_complaint_edit');
    }

    public function rules()
    {
        return [
            'complaint' => [
                'string',
                'required',
            ],
            'client_id' => [
                'required',
                'integer',
            ],
            'location_id' => [
                'integer',
            ],
            'service_type_id' => [
                'required',
                'integer',
            ],
            'visit_type_id' => [
                'required',
                'integer',
            ],
            'status_id' => [
                'required',
                'integer',
            ],
            'enginner_assigned_id' => [
                'required',
                'integer',
            ],
            'supervisor_assigned_id' => [
                'required',
                'integer',
            ],
            'service_date' => [
                'required',
                'date_format:' . config('panel.date_format'),
            ],
        ];
    }
}
