<?xml version="1.0"?>
<ruleset name="WordPress AI Client">
	<description>WordPress Coding Standards for WordPress AI Client</description>

    <!-- Scan these files -->
    <file>includes</file>
    <file>tests</file>

    <!-- Ignore vendor directory -->
    <exclude-pattern>*/vendor/*</exclude-pattern>

    <!-- Show progress, show sniff codes in all reports -->
    <arg value="sp"/>

    <!-- Set minimum supported PHP version -->
    <config name="testVersion" value="7.4-"/>

    <!-- Enable colors in output -->
    <arg name="colors"/>

	<!-- WordPress Coding Standards -->
	<config name="minimum_supported_wp_version" value="6.0"/>
	<rule ref="WordPress-Docs">
		<exclude-pattern>tests/*</exclude-pattern>
	</rule>
	<rule ref="WordPress-Extra">
		<exclude name="WordPress.Files.FileName"/>
	</rule>

	<!-- Custom WordPress user capabilities -->
	<rule ref="WordPress.WP.Capabilities">
		<properties>
			<property name="custom_capabilities" type="array">
				<element value="prompt_ai"/>
			</property>
		</properties>
	</rule>

	<!-- WordPress text domain -->
	<rule ref="WordPress.WP.I18n">
		<properties>
			<property name="text_domain" type="array">
				<element value="wp-ai-client"/>
			</property>
		</properties>
	</rule>

	<!-- Verify that proper prefixes are used for globals. -->
	<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
		<properties>
			<property name="prefixes" type="array">
				<element value="wp_ai_client"/>
				<element value="WordPress\AI_Client"/>
			</property>
		</properties>
	</rule>

    <!-- Check PHP 7.4 compatibility -->
    <rule ref="PHPCompatibility">
        <!-- Exclude functions that are polyfilled in WordPress or the PHP AI Client SDK -->
        <exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_is_listFound"/>
        <exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_containsFound"/>
        <exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_starts_withFound"/>
        <exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_ends_withFound"/>
    </rule>
</ruleset>
