<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ApproveProfileMediaRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()?->isAdmin() ?? false;
    }

    protected function prepareForValidation(): void
    {
        $this->merge([
            'source'    => $this->route('source'),
            'source_id' => $this->route('sourceId'),
        ]);
    }

    public function rules(): array
    {
        return [
            'source'    => 'required|string|in:client,provider',
            'source_id' => 'required|integer|min:1',
        ];
    }
}
