<?php

namespace App\Http\Requests\Admin\System\Setting;

use App\Enums\Permission;
use Illuminate\Foundation\Http\FormRequest;

class SocialMediaRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()?->can(Permission::SETTINGS_UPDATE->value) ?? false;
    }

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'instagram_url' => ['nullable', 'url', 'max:100'],
            'facebook_url' => ['nullable', 'url', 'max:100'],
            'tiktok_url' => ['nullable', 'url', 'max:100'],
        ];
    }

    /**
     * @return array<string, string>
     */
    public function attributes(): array
    {
        return [
            'instagram_url' => 'Instagram',
            'facebook_url' => 'Facebook',
            'tiktok_url' => 'TikTok',
        ];
    }
}
