<?php
namespace EasyChat\Library\Queue;

class RequeueWithoutAttemptException extends \Exception {

    private $delay_seconds;
    private $replacement_payload;
    private $expected_continuation;

    public function __construct($message, $delay_seconds = 60, array $replacement_payload = null, $expected_continuation = false) {
        parent::__construct((string)$message);
        $this->delay_seconds = max(1, min(3600, (int)$delay_seconds));
        $this->replacement_payload = $replacement_payload;
        $this->expected_continuation = (bool)$expected_continuation;
    }

    public function getDelaySeconds() {
        return $this->delay_seconds;
    }

    public function getReplacementPayload() {
        return $this->replacement_payload;
    }

    public function isExpectedContinuation() {
        return $this->expected_continuation;
    }
}
