import type { ObjectTypeDefinition, PropertyKeys } from "@osdk/api";
import type { BaseFilterState, FilterDefinitionControls } from "../FilterListItemApi.js";
/**
* Keys of string properties on an object type
*/
export type StringPropertyKeys<Q extends ObjectTypeDefinition> = PropertyKeys.Filtered<Q, "string">;
/**
* State for keyword search filter
*/
export interface KeywordSearchFilterState extends BaseFilterState {
	type: "keywordSearch";
	searchTerm: string;
	/**
	* How multiple terms are combined
	* - "AND": All terms must match
	* - "OR": Any term must match
	*/
	operator: "AND" | "OR";
}
/**
* Filter definition for keyword search across string properties
*/
export interface KeywordSearchFilterDefinition<
	Q extends ObjectTypeDefinition,
	K extends StringPropertyKeys<Q> = StringPropertyKeys<Q>
> extends FilterDefinitionControls {
	type: "KEYWORD_SEARCH";
	/**
	* Optional unique identifier for stable keying across filter reorders.
	*/
	id?: string;
	/**
	* Properties to search within
	* - "all": Search all string properties
	* - K[]: Search specific string properties
	*/
	properties: "all" | K[];
	label?: string;
	/**
	* Controlled state for the filter.
	* When provided, the filter becomes controlled and changes should be
	* handled via onFilterStateChanged callback.
	*/
	filterState?: KeywordSearchFilterState;
	/**
	* Default state for uncontrolled mode.
	* Used when filterState is not provided.
	*/
	defaultFilterState?: KeywordSearchFilterState;
	/**
	* Controls whether this filter is rendered.
	* When false, the filter is hidden but its state is preserved.
	* @default true
	*/
	isVisible?: boolean;
}
