$fields Field type => submitted value and stage() options. * @param string[] $staged Field types generation staged for this product. * @param string[] $known Every field type this tool stages for a product. * @return array {success, message, code?, reason?, review_fields?, applied_free_defaults?} */ public function approve( int $product_id, string $tool, array $fields, array $staged, array $known ): array { $decider = self::decider(); return null === $decider ? self::refusal() : $decider->approve( $product_id, $tool, $fields, $staged, $known ); } /** * Remove a product's pending proposals for a tool. * * @param int $product_id Product ID. * @param string $tool Review tool slug. * @param string[] $known Every field type this tool stages for a product. * @return array {success, message, code?, reason?} */ public function reject( int $product_id, string $tool, array $known ): array { $decider = self::decider(); return null === $decider ? self::refusal() : $decider->reject( $product_id, $tool, $known ); } /** * The content review plan denial, as a decision outcome. A decider * refuses with it too when the review gate denies. * * @return array */ public static function refusal(): array { $reason = PlanDenial::reason( 'contentReview', PlanDenial::PLAN_BUSINESS ); return array( 'success' => false, 'code' => self::CODE_DENIED, 'reason' => $reason, 'message' => PlanDenial::message( $reason, __( 'Business plan adds content review actions.', 'ai-product-tools' ) ), ); } /** * The decider the Business build offers, or null. Any other answer of * the filter, true included, counts as none. * * @return ReviewDecider|null */ private static function decider(): ?ReviewDecider { $decider = apply_filters( 'aipt_review_queue_decider', null ); return $decider instanceof ReviewDecider ? $decider : null; } }