<?php
/**
 * Launch lifecycle application exception.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChanges\Application;

/**
 * Carries stable application failure codes across delivery surfaces.
 */
final class LaunchLifecycleException extends \RuntimeException {
	private string $reason_code;
	private int $status;

	/**
	 * Creates a stable lifecycle exception.
	 */
	public function __construct( string $reason_code, string $message, int $status, ?\Throwable $previous = null ) {
		parent::__construct( $message, 0, $previous );

		$this->reason_code = $reason_code;
		$this->status      = $status;
	}

	/**
	 * Returns the stable application failure code.
	 */
	public function reasonCode(): string {
		return $this->reason_code;
	}

	/**
	 * Returns the recommended transport status.
	 */
	public function status(): int {
		return $this->status;
	}
}
