<?php

declare(strict_types=1);

namespace App\Framework\MachineLearning\ModelManagement\Exceptions;

use App\Framework\Exception\FrameworkException;
use App\Framework\Exception\Core\ValidationErrorCode;

/**
 * Model Already Exists Exception
 *
 * Thrown when attempting to register a model that already exists in the registry.
 */
final class ModelAlreadyExistsException extends FrameworkException
{
    public static function forModel(string $modelId): self
    {
        return self::create(
            ValidationErrorCode::DUPLICATE_VALUE,
            "Model '{$modelId}' already exists in registry"
        )->withData([
            'model_id' => $modelId,
            'recovery_action' => 'Use update() instead of register(), or increment version'
        ]);
    }
}
