def METHOD_NAME(provider: str) -> dict[EndpointMonitoringProvider, list[Endpoint]]:
    endpoints: dict[EndpointMonitoringProvider, list[Endpoint]] = defaultdict(
        list[Endpoint]
    )
    for app in queries.get_service_monitoring_endpoints():
        for ep_data in app.get("endPoints") or []:
            monitoring = ep_data.get("monitoring")
            if monitoring:
                ep_data["monitoring"] = [
                    m for m in monitoring if m["provider"]["provider"] == provider
                ]
                ep = Endpoint(**ep_data)
                for mon in ep.monitoring:
                    endpoints[mon.provider].append(ep)
    return endpoints