import { getText } from "../../../../locales/index.js";
import { DEFAULT_RESOURCE_WALL_STATUS_SORT_FIELD_KEYS } from "../ResourceWall/venueWallUtils.js";
import { locales } from "@pisell/utils";
//#region src/components/pisellRecordBoard/shellFrame/ToolBar/recordBoardToolBarI18n.ts
/** 与 Quick Filter 同源：优先 utils，若 utils 返回 key（未命中）则用 materials 再回退 */
function getSortButtonText() {
	const key = "pisell2.recordBoard.toolbar.sort";
	const u = locales.getText(key);
	return u && u !== key ? u : getText(key) || getText("sort-button-text");
}
/** 资源墙无状态列派生项时注入：下拉仅「状态 → 空闲优先 / 占用优先」，仍渲染排序按钮 */
function buildResourceWallStatusSortFallbackItem(sortConfig) {
	const extras = typeof sortConfig === "object" && sortConfig !== null && Array.isArray(sortConfig.resourceWallSortFieldKeys) ? sortConfig.resourceWallSortFieldKeys.map((x) => String(x).trim()).filter(Boolean) : [];
	const primaryKey = extras.length > 0 ? extras[0] : DEFAULT_RESOURCE_WALL_STATUS_SORT_FIELD_KEYS[0];
	return {
		name: primaryKey,
		label: getText("pisell2.recordBoard.toolbar.sortStatus"),
		isCustom: true,
		getSortItems: () => [{
			key: `${primaryKey}:asc:option`,
			label: getText("pisell2.recordBoard.toolbar.sortStatusFreeFirst")
		}, {
			key: `${primaryKey}:desc:option`,
			label: getText("pisell2.recordBoard.toolbar.sortStatusOccupiedFirst")
		}]
	};
}
function getViewGridLabel() {
	const key = "pisell2.recordBoard.toolbar.viewGrid";
	const u = locales.getText(key);
	return u && u !== key ? u : getText(key) || "Table";
}
function getViewFloorMapLabel() {
	const key = "pisell2.recordBoard.toolbar.viewFloorMap";
	const u = locales.getText(key);
	return u && u !== key ? u : getText(key) || "Floor map";
}
function getViewCalendarLabel() {
	const key = "pisell2.recordBoard.toolbar.viewCalendar";
	const u = locales.getText(key);
	return u && u !== key ? u : getText(key) || "Calendar";
}
function getViewResourceWallLabel() {
	const key = "pisell2.recordBoard.toolbar.viewResourceWall";
	const u = locales.getText(key);
	return u && u !== key ? u : getText(key) || "Wall";
}
/** 筛选无值时使用的默认筛选项；业务可通过 childComponentProps.toolBar.filter.defaultFilterValue 覆盖 */
function getDefaultFilterValue() {
	return {
		quickFilter: [],
		otherFilter: []
	};
}
//#endregion
export { buildResourceWallStatusSortFallbackItem, getDefaultFilterValue, getSortButtonText, getViewCalendarLabel, getViewFloorMapLabel, getViewGridLabel, getViewResourceWallLabel };
