from __future__ import annotations

from typing import Any, Mapping, TypeGuard

from pydantic import BaseModel


def is_pydantic_model_class(value: Any) -> TypeGuard[type[BaseModel]]:
    return isinstance(value, type) and issubclass(value, BaseModel)


def get_pydantic_model_fields(value: Any) -> Mapping[str, Any]:
    if is_pydantic_model_class(value):
        return value.model_fields
    return {}