<?php

namespace App\Services\Admin;

use App\Models\AdminSite;
use App\Models\AdminUser;

/** 站点运营仪表盘：解析账号绑定的主接入站点。 */
final class SiteDashboardSiteResolver
{
    public static function resolvePrimarySite(AdminUser $admin): ?AdminSite
    {
        $siteIds = $admin->accessibleAdminSiteIds();
        if ($siteIds === null || $siteIds === []) {
            return null;
        }

        return AdminSite::query()
            ->where('id', (int) $siteIds[0])
            ->first();
    }
}
