//#region src/v2/helpers/get-tab-details.ts
/**
* Returns display details for a tab in the API client UI.
* Determines the title and icon to use based on workspace, document, path, and method.
*
* - If no workspace is provided, returns { title: 'Untitled Tab' }.
* - If document is present, attempts to fetch an entry using getEntryByLocation, and returns:
*    - { title: entry.title, icon: 'document' } for document entry types,
*    - { title: entry.title, icon: 'request' } for all other types,
*    - If no entry found, returns { title: 'Untitled Tab' }.
* - If neither document nor entry is available, returns { title: 'Workspace' }.
*
* Example:
* ```
* const result = getTabDetails({
*   workspace: "main",
*   document: "doc1",
*   path: "/users",
*   method: "get",
*   getEntryByLocation: ({ document, path, method }) => {
*     // Mock lookup:
*     if (document === "doc1" && path === "/users") {
*       return { type: "document", title: "Users" }
*     }
*     return null
*   }
* })
* // result: { title: "Users", icon: "document" }
* ```
*/
var getTabDetails = ({ workspace, document, path, method, getEntryByLocation }) => {
	if (!workspace) return { title: "Untitled Tab" };
	if (document) {
		const entry = getEntryByLocation({
			document,
			path,
			method
		});
		if (!entry) return { title: "Untitled Tab" };
		if (entry.type === "document") return {
			title: entry.title,
			icon: "document"
		};
		return {
			title: entry.title,
			icon: "request"
		};
	}
	return { title: "Workspace" };
};
//#endregion
export { getTabDetails };

//# sourceMappingURL=get-tab-details.js.map