<?php

namespace Formatrica\Submission\Pipeline\Stages;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use Formatrica\Submission\Pipeline\Submission_Context;
use Formatrica\Submission\Pipeline\Submission_Stage;

/**
 * The formatrica_after_submission action, and finishing the pipeline with the
 * assembled result.
 */
final class After_Submission_Stage implements Submission_Stage
{
    public function handle(Submission_Context $ctx): void
    {
        do_action('formatrica_after_submission', $ctx->form_id, $ctx->sanitised, $ctx->result, $ctx->form, $ctx->context);

        $ctx->finish($ctx->result);
    }
}
