<?php

declare(strict_types=1);

namespace ImovelZapAi\AiGateway\Domain\Exceptions;

final class AiProviderException extends AiGatewayException
{
    public function __construct(
        string $message,
        public readonly bool $retryable = false,
    ) {
        parent::__construct($message);
    }

    public static function unavailable(string $provider, string $reason, bool $retryable = true): self
    {
        return new self("Provedor de IA {$provider} indisponível: {$reason}", $retryable);
    }

    public static function invalidResponse(string $provider, string $reason): self
    {
        return new self("Resposta inválida do provedor {$provider}: {$reason}", false);
    }

    public static function notConfigured(string $provider): self
    {
        return new self("Provedor de IA {$provider} não está configurado.", false);
    }
}
