'example' ) ); } /** * $profile without its approved writing samples when * {@see voiceSamplesAllowed()} denies them. The stored voice keeps them. * * @param array|null $profile BrandProfileData, or null. * @return array{profile:array|null,dropped:bool} `dropped` only when samples existed and were withheld. */ public function clampBrandProfile( ?array $profile ): array { if ( null === $profile || empty( $profile['approvedSamples'] ) || $this->voiceSamplesAllowed() ) { return array( 'profile' => $profile, 'dropped' => false ); } $profile['approvedSamples'] = array(); return array( 'profile' => $profile, 'dropped' => true ); } /** * The appliedFreeDefaults entry for a voice's writing samples being * withheld from a run. Added only by a caller that knows samples were * dropped ({@see clampBrandProfile()}). * * @return array{key:string,reason:string} */ public function voiceSamplesFreeDefault(): array { return $this->freeDefault( 'voice:samples', 'example_descriptions', __( "This voice's writing samples were not used in this run.", 'ai-product-tools' ), __( 'matching your own writing', 'ai-product-tools' ) ); } /** * Most voices this site's plan may hold. Free keeps exactly one; a paid * plan removes the cap. Reads the same ceiling filter a creation-time * REST guard asks before saving a new voice * ({@see \AIPT\Premium\ContentStructure\VoiceQuotaService}, which mirrors * the automation job-count quota exactly), so the editor can show the * same limit a save will enforce. * * @return int Non-positive means no cap. */ public function voiceLimit(): int { $limit = apply_filters( 'aipt_max_brand_profiles', 1 ); return is_int( $limit ) ? $limit : 1; } }