<?php

namespace App\Modules\Platform\Geography\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

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