*/ public function subject_types(): array { return [ SubjectType::Booking, SubjectType::Customer, SubjectType::Intent, SubjectType::Payment, ]; } /** * {@inheritDoc} */ public function is_send(): bool { return false; } /** * {@inheritDoc} */ public function is_destructive(): bool { return false; } /** * {@inheritDoc} */ public function requires_fresh_context(): bool { return true; } /** * {@inheritDoc} * * @param AutomationContext $ctx Context. * @param ActionStep $step Step. */ public function execute( AutomationContext $ctx, ActionStep $step ): ActionResult { $config = $step->config(); $identifier = isset( $config['identifier'] ) ? (string) $config['identifier'] : ''; $condition = $this->conditions->get( $identifier ); $pass = null !== $condition && $condition->evaluate( $ctx, $config ); if ( $pass ) { return ActionResult::completed( 'if:pass' ); } $else = isset( $config['else_advance'] ) ? (int) $config['else_advance'] : 0; if ( $else > 1 ) { return ActionResult::completed( 'if:fail', $else ); } return ActionResult::skipped( SkipReason::ConditionsFailed, true ); } /** * {@inheritDoc} * * @return array */ public function schema(): array { return [ 'send' => false, 'destructive' => false, 'category' => 'internal', 'fields' => [], ]; } }