<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'mikrotik_id' => ['required', 'exists:mikrotiks,id'],
            'username' => ['required', 'string', 'max:255'],
            'password' => ['required', 'string', 'max:255'],
            'profile' => ['required', 'string', 'max:255'],
            'remote_address' => ['nullable', 'ip'],
            'status' => ['required', 'boolean'],
            'comment' => ['nullable', 'string', 'max:1000'],
        ];
    }
}
