<?php

namespace App\Providers\Filament\AvatarProviders;

use Filament\AvatarProviders\Contracts\AvatarProvider;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Auth\Authenticatable;

class DiceBearAvatarProvider implements AvatarProvider
{
    public function get(Model|Authenticatable $record): string
    {
        $name = str($record->getFilamentName())->trim()->replace(' ', '+');

        return 'https://api.dicebear.com/9.x/initials/svg?seed=' . $name;
    }
}
