<?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;
    }
}
