<?php

namespace App\Services\System\Setting;

use App\Settings\SocialMediaSettings;

class SocialMediaService
{
    public function socialMediaData(): array
    {
        $settings = app(SocialMediaSettings::class);

        return [
            'instagram_url' => $settings->instagram_url,
            'facebook_url' => $settings->facebook_url,
            'tiktok_url' => $settings->tiktok_url,
        ];
    }

    public function updateSocialMedia(array $validated): void
    {
        $settings = app(SocialMediaSettings::class);

        $settings->instagram_url = $validated['instagram_url'] ?? null;
        $settings->facebook_url = $validated['facebook_url'] ?? null;
        $settings->tiktok_url = $validated['tiktok_url'] ?? null;

        $settings->save();
    }
}
