<?php

namespace App\Http\Requests\Access;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

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

    public function rules(): array
    {
        return [
            'application_type' => ['required', Rule::in(['tenant', 'agent', 'staff'])],
            'tenant_id' => ['required_if:application_type,agent,staff', 'nullable', 'integer', 'exists:tenants,id'],
            'tenant_name' => ['required_if:application_type,tenant', 'nullable', 'string', 'max:150'],
            'tenant_code' => ['nullable', 'string', 'max:50'], 'phone' => ['nullable', 'string', 'max:30'],
            'email' => ['nullable', 'email', 'max:150'], 'address' => ['nullable', 'string', 'max:2000'],
            'reason' => ['required', 'string', 'max:2000'],
        ];
    }
}
