Feature: Implement multi-stage Conversation Flow Engine with TestFlow
This commit is contained in:
55
backend/app/Core/Flows/FlowResult.php
Normal file
55
backend/app/Core/Flows/FlowResult.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Flows;
|
||||
|
||||
/**
|
||||
* FlowResult
|
||||
* Holds response details after handling a single step in a conversation flow.
|
||||
*/
|
||||
class FlowResult
|
||||
{
|
||||
private string $replyText;
|
||||
private string $nextStep;
|
||||
private bool $finished;
|
||||
private ?string $mediaUrl;
|
||||
|
||||
public function __construct(string $replyText, string $nextStep, bool $finished = false, ?string $mediaUrl = null)
|
||||
{
|
||||
$this->replyText = $replyText;
|
||||
$this->nextStep = $nextStep;
|
||||
$this->finished = $finished;
|
||||
$this->mediaUrl = $mediaUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the reply message text to send to the contact
|
||||
*/
|
||||
public function getReplyText(): string
|
||||
{
|
||||
return $this->replyText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next step key
|
||||
*/
|
||||
public function getNextStep(): string
|
||||
{
|
||||
return $this->nextStep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the flow is finished (to be destroyed)
|
||||
*/
|
||||
public function isFinished(): bool
|
||||
{
|
||||
return $this->finished;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get target media URL (if any)
|
||||
*/
|
||||
public function getMediaUrl(): ?string
|
||||
{
|
||||
return $this->mediaUrl;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user