<?php

namespace App\Domains\Tenant\Requests\AdminApp;

use App\Domains\Tenant\Services\WebsiteExtraService;
use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        $tenant = $this->user()->tenant()->firstOrFail();

        return app(WebsiteExtraService::class)->requestRulesForExtra(
            $tenant,
            (string) $this->route('websiteExtraCode')
        );
    }
}
