<?php

namespace MintyPHP\Service\Auth;

use MintyPHP\Repository\User\UserExternalIdentityRepositoryInterface;

class AuthExternalIdentityGateway
{
    public function __construct(private readonly UserExternalIdentityRepositoryInterface $userExternalIdentityRepository)
    {
    }

    public function findByProviderTidOid(string $provider, string $tid, string $oid): ?array
    {
        return $this->userExternalIdentityRepository->findByProviderTidOid($provider, $tid, $oid);
    }

    public function findByProviderIssuerSubject(string $provider, string $issuer, string $subject): ?array
    {
        return $this->userExternalIdentityRepository->findByProviderIssuerSubject($provider, $issuer, $subject);
    }

    public function createLink(array $data): bool
    {
        return (bool) $this->userExternalIdentityRepository->createLink($data);
    }
}
