<?php

namespace App\Services\Api\Exceptions;

use Exception;

/**
 * Excepción personalizada para errores en la acción tutorials
 */
class TutorialsException extends Exception
{
    /**
     * Código de error específico de la API (4000, 4001, 4002, 4003)
     *
     * @var int
     */
    protected int $apiCode;

    /**
     * HTTP Status Code
     *
     * @var int
     */
    protected int $httpStatus;

    /**
     * Constructor
     *
     * @param string $message
     * @param int $apiCode Código de error de la API
     * @param int $httpStatus HTTP Status Code
     * @param \Throwable|null $previous
     */
    public function __construct(
        string $message = '',
        int $apiCode = 4003,
        int $httpStatus = 500,
        ?\Throwable $previous = null
    ) {
        parent::__construct($message, 0, $previous);
        $this->apiCode = $apiCode;
        $this->httpStatus = $httpStatus;
    }

    /**
     * Obtiene el código de error de la API
     *
     * @return int
     */
    public function getApiCode(): int
    {
        return $this->apiCode;
    }

    /**
     * Obtiene el HTTP Status Code
     *
     * @return int
     */
    public function getHttpStatus(): int
    {
        return $this->httpStatus;
    }
}








