<?php

namespace App\Http\Requests\Admin\HR;

use Illuminate\Foundation\Http\FormRequest;

class AttendanceRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()->can('attendances.create');
    }

    public function rules(): array
    {
        return [
            'photo' => ['required'],
            'latitude' => ['required', 'numeric', 'min:-90', 'max:90'],
            'longitude' => ['required', 'numeric', 'min:-180', 'max:180'],
        ];
    }

    public function attributes(): array
    {
        return [
            'photo' => 'foto',
            'latitude' => 'lintang',
            'longitude' => 'bujur',
        ];
    }
}
