<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:255', 'unique:zones,name'],
            'parent_id' => ['nullable', 'integer', 'exists:zones,id'],
            'status' => ['required', 'boolean'],
            'description' => ['nullable', 'string', 'max:1000'],
        ];
    }
}
