<?php

namespace Modules\SpecialAttendance\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules()
    {
        return [
            'request_date' => 'required|date',
            'reason' => 'required|string|max:255',
            'attachment' => 'nullable|file|mimes:pdf,png,jpg,jpeg|max:10240',
        ];
    }

    public function messages()
    {
        return [
            'request_date.required' => _trans('validation.The date is required.'),
            'request_date.date' => _trans('validation.The date must be a valid date.'),
            'reason.required' => _trans('validation.The reason is required.'),
            'reason.string' => _trans('validation.The reason must be a string.'),
            'reason.max' => _trans('validation.The reason may not exceed 255 characters.'),
            'attachment.file' => _trans('validation.The attachment must be a file.'),
            'attachment.mimes' => _trans('validation.The attachment must be a file of type: pdf, png, jpg, or jpeg.'),
            'attachment.max' => _trans('validation.The attachment may not be larger than 10 MB.'),
        ];
    }
}
