<?php

namespace App\Services;

use Enflow\SocialShare\ConfiguredSocialShareService;

class CustomSocialShareService extends ConfiguredSocialShareService
{
    public function icon(): ?string
    {
        // First check for custom icon in resources
        $customIconPath = resource_path('views/vendor/social-share/icons/' . $this->name . '.svg');
        if (file_exists($customIconPath)) {
            return file_get_contents($customIconPath);
        }

        // Fallback to vendor package icon
        if (file_exists($iconPath = __DIR__ . '/../../vendor/enflow/laravel-social-share/resources/icons/' . $this->name . '.svg')) {
            return file_get_contents($iconPath);
        }

        return null;
    }
}
