<?php

namespace App\Http\Requests\V1\Site;

use Illuminate\Foundation\Http\FormRequest;

class StoreSiteRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:100'],
            'address' => ['nullable', 'string', 'max:500'],
            'latitude' => ['nullable', 'numeric', 'between:-90,90'],
            'longitude' => ['nullable', 'numeric', 'between:-180,180'],
            'is_active' => ['sometimes', 'boolean'],
        ];
    }

    public function messages(): array
    {
        return [
            'name.required' => __('error.site.name_required'),
            'name.max' => __('error.site.name_too_long'),
            'latitude.between' => __('error.site.invalid_latitude'),
            'longitude.between' => __('error.site.invalid_longitude'),
        ];
    }
}
