<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">

<dictionary xmlns:xi="http://www.w3.org/2003/XInclude" title="FindAnyFile Terminology">

	<!--
		As recommended by Apple since OSX 10.5: Use include from local system instead of including the standard suite here.
		See https://developer.apple.com/library/archive/samplecode/SimpleScripting/Listings/ReadMe_txt.html
		However, I then get the error in log:
			".sdef warning for argument 'FileType' of command 'save' in suite 'Standard Suite': 'saveable file format' is not a valid type name.",
		but it seems I can ignore that.
	-->
	<xi:include href="file:///System/Library/ScriptingDefinitions/CocoaStandard.sdef" xpointer="xpointer(/dictionary/suite)"/>

	<suite name="Find Any File Suite" code="FAFs" description="Find Any File-specific classes.">

		<command name="start search" code="FAFsStSr" description="Start the search.">
			<direct-parameter type="specifier" description="The find document or find window to start the search in."/>
		</command>

		<class name="application" code="capp" description="The application's top-level scripting object." inherits="application">
			<cocoa class="Application"/>
			<element type="window" access="r">
				<cocoa key="orderedFAFWindows"/>
			</element>
			<element type="find window" access="r">
				<cocoa key="orderedSearchWindows"/>
			</element>
			<element type="results window" access="r">
				<cocoa key="orderedResultsWindows"/>
			</element>
			<element type="result set" access="r" hidden="yes">
				<cocoa key="resultSets"/>
			</element>
			<element type="disk item" access="r" hidden="yes">
				<cocoa key="diskItems"/>
			</element>
			<element type="search set" access="r" hidden="yes">
				<cocoa key="allSearchSpecs"/>
			</element>
			<element type="search domain" access="r" hidden="yes">
				<cocoa key="allSearchDomains"/>
			</element>
		</class>

		<class name="find window" code="Fwin" description="A window showing the search rules." inherits="window">
			<cocoa class="SearchWindow"/>
			<property name="search" code="Sset" type="search set" access="r" description="The search that is shown in this window.">
				<cocoa key="searchSpecs"/>
			</property>
			<property name="ready for new search" code="Srdy" type="boolean" access="r" description="Is true when a new search is ready to be started, and becomes false after a search was performed. If after the search the rules or search locations get changed again, this become true once more.">
				<cocoa key="readyForNewSearch"/>
			</property>
			<property name="results" code="Resu" type="result set" access="r" description="The results gathered by the latest search.">
				<cocoa key="latestResult"/>
			</property>
			<property name="results window" code="RsWn" type="results window" access="r" description="The window the results appear in.">
				<cocoa key="resultWindow"/>
			</property>
			<responds-to command="start search">
				<cocoa method="handleStartSearch:"/>
			</responds-to>
		</class>

		<class name="results window" code="Rwin" description="A window showing results." inherits="window">
			<cocoa class="ResultWindow"/>
			<property name="has finished loading" code="finl" type="boolean" access="r" description="Use this to check whether the window has loaded all results.">
				<cocoa key="finishedLoading"/>
			</property>
			<property name="results" code="rset" type="result set" access="r" description="The results shown in this window.">
				<cocoa key="result"/>
			</property>
			<property name="search" code="sspc" type="search set" access="r" description="The search that is shown by this window – is null if window was opened from a .paths file or with the New Results Window menu command.">
				<cocoa key="searchSpecs"/>
			</property>
		</class>

		<!-- https://stackoverflow.com/a/37327603
		<record-type  name="raw search spec record" code="SSRc">
			<property name="subj" code="SSR1" type="integer"
				description="The short title, created from the rules."
			/>
			<property name="verb" code="SSR2" type="integer"
				description="The short title, created from the rules."
			/>
			<property name="val" code="SSR3" type="text"
				description="The short title, created from the rules."
			/>
		</record-type>
		<record-type  name="raw search set record" code="SRec">
			<property name="title" code="SRti" type="text"
				description="The short title, created from the rules."
			/>
			<property name="autoStart" code="SRas" type="boolean"
				description="Whether to run this search when opening it in FAF."
			/>
			<property name="savedBy" code="SRsb" type="integer"
				description="Build number of FAF that created this search set."
			/>
			<property name="sources" code="SRso" type="text"
				description="The locations (paths) in which to search."
			/>
			<property name="specs" code="SRsp" type="raw search spec record"
				description="The search rules"
			/>
		</record-type>
		-->

		<enumeration name="search nouns" code="Noun" description="Nouns for rules">
			<enumerator name="full name" code="No00" description="Full file name (including extension)">
				<cocoa integer-value="0"/>
			</enumerator>
			<enumerator name="filetype code" code="No01" description="FileType code">
				<cocoa integer-value="1"/>
			</enumerator>
			<enumerator name="creator code" code="No02" description="Creator code">
				<cocoa integer-value="2"/>
			</enumerator>
			<enumerator name="creation date" code="No03" description="Creation date">
				<cocoa integer-value="3"/>
			</enumerator>
			<enumerator name="modification date" code="No04" description="Modification date">
				<cocoa integer-value="4"/>
			</enumerator>
			<enumerator name="label" code="No05" description="Label">
				<cocoa integer-value="5"/>
			</enumerator>
			<enumerator name="file size" code="No06" description="File size">
				<cocoa integer-value="6"/>
			</enumerator>
			<enumerator name="kind" code="No07" description="Kind">
				<cocoa integer-value="7"/>
			</enumerator>
			<enumerator name="is a directory" code="No08" description="Is A Directory">
				<cocoa integer-value="8"/>
			</enumerator>
			<enumerator name="is an alias" code="No09" description="Is An Alias">
				<cocoa integer-value="9"/>
			</enumerator>
			<enumerator name="owner id" code="No10" description="BSD owner ID">
				<cocoa integer-value="10"/>
			</enumerator>
			<enumerator name="group id" code="No11" description="BSD group ID">
				<cocoa integer-value="11"/>
			</enumerator>
			<enumerator name="negate all" code="No12" description="Negate all conditions">
				<cocoa integer-value="12"/>
			</enumerator>
			<enumerator name="case sensitive names" code="No13" description="Case sensitive names">
				<cocoa integer-value="13"/>
			</enumerator>
			<enumerator name="package contents" code="No14" description="Package contents">
				<cocoa integer-value="14"/>
			</enumerator>
			<enumerator name="invisible items" code="No15" description="Invisible items">
				<cocoa integer-value="15"/>
			</enumerator>
			<enumerator name="trashed contents" code="No16" description="Trashed contents">
				<cocoa integer-value="16"/>
			</enumerator>
			<enumerator name="limit amount" code="No17" description="Limit results">
				<cocoa integer-value="17"/>
			</enumerator>
			<enumerator name="pass results" code="No18" description="Pass results to file or app">
				<cocoa integer-value="18"/>
			</enumerator>
			<enumerator name="Limit dolder depth" code="No20" description="Limit folder depth">
				<cocoa integer-value="20"/>
			</enumerator>
			<enumerator name="resourcefork size" code="No21" description="Resource fork size">
				<cocoa integer-value="21"/>
			</enumerator>
			<enumerator name="path" code="No22" description="Path">
				<cocoa integer-value="22"/>
			</enumerator>
			<enumerator name="folder names" code="No23" description="Folder names">
				<cocoa integer-value="23"/>
			</enumerator>
			<enumerator name="file content" code="No24" description="File (text) content">
				<cocoa integer-value="24"/>
			</enumerator>
			<enumerator name="case sensitive content" code="No25" description="Case sensitive content">
				<cocoa integer-value="25"/>
			</enumerator>
			<enumerator name="UTI" code="No26" description="UTI (Uniform Type Identifier)">
				<cocoa integer-value="26"/>
			</enumerator>
			<enumerator name="forced slow" code="No27" description="Force slow search (not CatSearch)">
				<cocoa integer-value="27"/>
			</enumerator>
			<enumerator name="last content access date" code="No28" description="Last content access date">
				<cocoa integer-value="28"/>
			</enumerator>
			<enumerator name="added to dir date" code="No29" description="Added to dir date">
				<cocoa integer-value="29"/>
			</enumerator>
			<enumerator name="tags" code="No30" description="Tags">
				<cocoa integer-value="30"/>
			</enumerator>
			<enumerator name="inode" code="No31" description="Inode number">
				<cocoa integer-value="31"/>
			</enumerator>
			<enumerator name="diacritics sensitive names" code="No32" description="Diacritics sensitive names">
				<cocoa integer-value="32"/>
			</enumerator>
			<enumerator name="script" code="No33" description="Script">
				<cocoa integer-value="33"/>
			</enumerator>
			<enumerator name="extension" code="No34" description="File name extension">
				<cocoa integer-value="34"/>
			</enumerator>
			<enumerator name="comments" code="No35" description="Comments">
				<cocoa integer-value="35"/>
			</enumerator>
			<enumerator name="is dataless" code="No36" description="Is dataless (in cloud only)">
				<cocoa integer-value="36"/>
			</enumerator>
			<enumerator name="spotlight mode" code="No37" description="Spotlight mode">
				<cocoa integer-value="37"/>
			</enumerator>
			<enumerator name="link count" code="No38" description="Hardlink count">
				<cocoa integer-value="38"/>
			</enumerator>
			<enumerator name="name without extension" code="No39" description="File name without extension">
				<cocoa integer-value="39"/>
			</enumerator>
			<enumerator name="use find tool" code="No40" description="Use find tool (Pro option)">
				<cocoa integer-value="40"/>
			</enumerator>
			<enumerator name="calculate all dir sizes" code="No41" description="Calculate all folder sizes?">
				<cocoa integer-value="41"/>
			</enumerator>
		</enumeration>

		<enumeration name="search types" code="STyp" description="Rule types.">
			<enumerator name="textual" code="Ttex" description="Textual">
				<cocoa integer-value="0"/>
			</enumerator>
			<enumerator name="size" code="Tsit" description="File size">
				<cocoa integer-value="1"/>
			</enumerator>
			<enumerator name="bool" code="Tbol" description="Boolean (yes or no)">
				<cocoa integer-value="2"/>
			</enumerator>
			<enumerator name="label" code="Tlbl" description="Finder label (0-7)">
				<cocoa integer-value="3"/>
			</enumerator>
			<enumerator name="date" code="Tdat" description="Date">
				<cocoa integer-value="4"/>
			</enumerator>
			<enumerator name="OSType" code="Tost" description="OSType (4-byte code)">
				<cocoa integer-value="5"/>
			</enumerator>
			<enumerator name="kind" code="Tknd" description="Kind">
				<cocoa integer-value="6"/>
			</enumerator>
			<enumerator name="filter" code="Tflt" description="Filter (show, hide, show exclusively)">
				<cocoa integer-value="7"/>
			</enumerator>
			<enumerator name="amount" code="Tcnt" description="A plain number">
				<cocoa integer-value="8"/>
			</enumerator>
			<enumerator name="pass results to" code="Tpas" description="For passing results to a file or application">
				<cocoa integer-value="9"/>
			</enumerator>
			<enumerator name="content" code="Tcon" description="File content">
				<cocoa integer-value="10"/>
			</enumerator>
			<enumerator name="none" code="Tnon" description="No type">
				<cocoa integer-value="11"/>
			</enumerator>
			<enumerator name="equals number" code="Tnon" description="Identical to number">
				<cocoa integer-value="12"/>
			</enumerator>
			<enumerator name="scripted" code="Tscr" description="Scripted matching">
				<cocoa integer-value="13"/>
			</enumerator>
		</enumeration>

		<!-- we have overlapping verbs for various types, so this can't work.
			See https://stackoverflow.com/questions/79862735
		<enumeration name="textual verbs" code="tVrb" description="Verbs for rules">
			<enumerator name="contains segments of" code="tVfr" description="contains">
				<cocoa integer-value="9"/>
			</enumerator>
			<enumerator name="is" code="tVis" description="is">
				<cocoa integer-value="1"/>
			</enumerator>
			<enumerator name="contains exactly" code="tVcp" description="contains phrase">
				<cocoa integer-value="0"/>
			</enumerator>
		</enumeration>
		-->

		<class name="search rule" code="SRul" description="A search rule" inherits="item">
			<cocoa class="SearchSpec"/>
			<property name="id" code="ID  " type="integer" access="r" description="Its unique identifier.">
				<cocoa key="uniqueID"/>
			</property>
			<property name="noun" code="SRNo" type="search nouns" description="The noun of the rule." access="r">
				<cocoa key="scriptableNoun"/>
			</property>
			<property name="search type" code="SRTy" type="search types" description="The type of the rule." access="r">
				<cocoa key="scriptableType"/>
			</property>
			<property name="verb code" code="SRVe" type="integer" description="The verb of the rule as a number." access="r">
				<cocoa key="scriptableVerb"/>
			</property>
			<property name="argument" code="SRVa" type="text" description="The input value." access="r">
				<cocoa key="scriptableValue"/>
			</property>
			<property name="script name" code="SRSn" type="text" description="The script to use." access="r">
				<cocoa key="scriptName"/>
			</property>
		</class>

		<class name="search domain" code="SDom" description="The locations where FAF searches" inherits="item">
			<cocoa class="SearchDomains"/>
			<property name="id" code="ID  " type="integer" description="Its unique identifier." access="r">
				<cocoa key="uniqueID"/>
			</property>
			<!--
			<element type="search location" description="The locations in which to search." access="r">
				<cocoa key="scriptableLocations"/>
			</element>
			-->
			<property name="targets" code="SDlc" description="The search targets as they're saved, with placeholders." access="r">
				<cocoa key="scriptableTargets"/>
				<type type="text" list="yes"/>
			</property>
			<property name="current locations" code="SDcp" description="The actual folders to be searched on the current system." access="r">
				<cocoa key="scriptableSearchURLs"/>
				<type type="file" list="yes"/>
			</property>
		</class>

		<class name="search set" code="SSpc" description="A set of rules for a search" inherits="item">
			<cocoa class="SearchSpecs"/>
			<property name="id" code="ID  " type="integer" access="r" description="Its unique identifier.">
				<cocoa key="uniqueID"/>
			</property>
			<property name="short title" code="SSSt" type="text" description="The title as shown in the search window and menus, and as the file name when saved." access="r">
				<cocoa key="title"/>
			</property>
			<property name="runs as root" code="SSRr" type="boolean" description="Whether to run this search as root user." access="r">
				<cocoa key="runAsRoot"/>
			</property>
			<property name="autostart" code="SSAs" type="boolean" description="Whether to run this search when opening it in FAF." access="r">
				<cocoa key="autostart"/>
			</property>
			<property name="created by build number" code="SSSb" type="integer" description="Build number of FAF that created this search set." access="r">
				<cocoa key="savedByVersion"/>
			</property>
			<property name="search domain" code="SSDo" type="search domain" description="The locations in which to search." access="r">
				<cocoa key="sources"/>
			</property>
			<element type="search rule" description="The search rules." access="r">
				<cocoa key="specs"/>
			</element>
			<property name="json representation" code="SSJs" type="text" description="The search data in JSON form, just like when the search is saved to a file." access="r">
				<cocoa key="asJSONString"/>
			</property>
			<!-- not working because record-types can't handle arrays, it seems
			<property name="raw values" code="SSRw" type="raw search set record" description="The search data in raw form, like an expanded version of the JSON string." access="r">
				<cocoa key="exportForSaveAsDictionary"/>
			</property>
			-->
		</class>

		<enumeration name="result set states" code="RStE" description="The progress states of a result set.">
			<enumerator name="gathering" code="RSS0" description="The search is still ongoing.">
				<cocoa integer-value="0"/>
			</enumerator>
			<enumerator name="stopping" code="RSS1" description="The search is being stopped.">
				<cocoa integer-value="1"/>
			</enumerator>
			<enumerator name="finished" code="RSS2" description="The search is finished.">
				<cocoa integer-value="2"/>
			</enumerator>
		</enumeration>

		<class name="result set" code="RSet" description="A collection of result items shown in a Results window" inherits="item">
			<cocoa class="ResultSet"/>
			<property name="id" code="ID  " type="integer" access="r" description="Its unique identifier.">
				<cocoa key="uniqueID"/>
			</property>
			<property name="state" code="Rstt" type="result set states" description="The state of the result set." access="r">
				<cocoa key="stateScriptable"/>
			</property>
			<element type="result item" access="r">
				<cocoa key="matchesScriptable"/>
			</element>
		</class>

		<class name="result item" code="RItm" description="A single result item shown in a Results window" inherits="item">
			<cocoa class="ResultItem"/>
			<property name="id" code="ID  " type="integer" access="r" description="Its unique identifier.">
				<cocoa key="uniqueID"/>
			</property>
			<property name="disk item" code="Rdit" type="disk item" description="The unique file or folder object." access="r">
				<cocoa key="diskItemScriptable"/>
			</property>
			<property name="parent" code="pare" type="result item" description="The parent item on the file system hierarchy." access="r">
				<cocoa key="parentScriptable"/>
			</property>
			<element type="result item" description="The matched (found) children on the file system hierarchy." access="r">
				<cocoa key="childrenScriptable"/>
			</element>
		</class>

		<class name="disk item" code="DItm" description="A file system item" inherits="item">
			<cocoa class="DiskItem"/>
			<property name="id" code="ID  " type="text" access="r" description="Its unique identifier.">
				<cocoa key="uniqueID"/>
			</property>
			<property name="posix name" code="pNam" type="text" description="The POSIX name of the file or folder." access="r">
				<cocoa key="fileName"/>
			</property>
			<property name="posix path" code="pPth" type="text" description="The POSIX path of the file or folder." access="r">
				<cocoa key="originalPath"/>
			</property>
			<property name="creation date" code="ascd" description="The date the item was created." type="date" access="r">
				<cocoa key="creationDate"/>
			</property>
			<property name="modification date" code="asmo" description="The date the item was last modified." type="date" access="r">
				<cocoa key="modificationDate"/>
			</property>
		</class>

	</suite>￼
</dictionary>
