import { resolve } from "@scalar/workspace-store/resolve";
import { getRefName } from "./get-ref-name.js";
const getModelNameFromSchema = (schemaOrRef) => {
  if (!schemaOrRef) {
    return null;
  }
  const schema = resolve.schema(schemaOrRef);
  if (schema.title) {
    return schema.title;
  }
  if (schema.name) {
    return schema.name;
  }
  if ("$ref" in schemaOrRef) {
    const refName = getRefName(schemaOrRef.$ref);
    if (refName) {
      return refName;
    }
  }
  return null;
};
export {
  getModelNameFromSchema
};
