<?php

namespace App\Modules\Platform\Geography\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StoreTenantRegionRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()?->can('geography.manage') ?? false;
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'country_id' => ['required', 'integer', 'exists:geo_countries,id'],
            'name_en' => ['required', 'string', 'max:120'],
            'name_ar' => ['nullable', 'string', 'max:120'],
            'sort_order' => ['nullable', 'integer', 'min:0', 'max:65535'],
        ];
    }
}
