using Tiku.Application.Content;
using Tiku.Application.Security;

namespace Tiku.Api.Controllers;

public sealed class DirectContentActorResolver(
    ICurrentUser currentUser,
    ITenantContext currentTenant)
{
    internal DirectContentActor Resolve()
    {
        if (currentTenant.TenantId is null || currentUser.UserId is null)
            throw new ContentManagementException("Tenant content actor was not resolved.",
                "tenant_content_access_denied");

        return new DirectContentActor(currentTenant.TenantId.Value, currentUser.UserId.Value);
    }
}
