<?php

namespace App\Http\Controllers\Affiliate;

use App\Classes\Modules\Affiliate\ControllersLogic\UpdateAffiliateSettingsLogic;
use App\Http\Requests\UpdateAffiliateSettingsRequest;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Gate;

class UpdateAffiliateSettingsController
{
    /**
     * @param UpdateAffiliateSettingsRequest $request
     * @param UpdateAffiliateSettingsLogic $logic
     * @return JsonResponse
     * @throws \Illuminate\Auth\Access\AuthorizationException
     */
    public function update(UpdateAffiliateSettingsRequest $request, UpdateAffiliateSettingsLogic $logic): JsonResponse {
        // Check if user has permission to manage affiliate settings
        Gate::authorize('manageSettings', \App\Models\Affiliate::class);
        return $logic->execute($request);
    }
}

