<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class SalesRequest extends FormRequest{
    public function authorize(){
        return true;
    }

    public function rules(){
        if($this->method() == 'PATCH'){
            return [
                'car_name' => 'required|max:255',
                'name' => 'required|max:255',
                'fuel_type' => 'required|max:255',          
                'veriant' => 'required|max:255',              
                'monthly_target' => 'required|max:255',              
                'interior_color' => 'required|max:255',
                'exterior_color' => 'required|max:255'
            ];
        }else{
            return [
                'car_name' => 'required|max:255',
                'name' => 'required|max:255',
                'fuel_type' => 'required|max:255',        
                'veriant' => 'required|max:255',              
                'monthly_target' => 'required|max:255',
                'interior_color' => 'required|max:255',
                'exterior_color' => 'required|max:255'
            ];
        }
    }

    public function messages(){
        return [
            'car_name' => 'Please enter car name',
            'name' => 'Please enter car color',
            'fuel_type' => 'Please enter fuel type',
            'veriant' => 'Please enter veriant',
            'monthly_target' => 'Please enter monthly target',
            'interior_color' => 'Please enter interior color',
            'exterior_color' => 'Please enter exterior color'
        ];
    }
}
