function outData = commAmplifierTransform(inData)
    %COMMAMPLIFIERTRANSFORM Transformation function from Amplifier block to
    %either the Memoryless Nonlinearity block or the same Amplifier block
    %that lives in commobslib library.

    % Copyright 2022 The MathWorks, Inc.

    InstanceData = inData.InstanceData;
    oldBlockParams = {InstanceData.Name};
    newBlockPath = sprintf('commrflib2/Memoryless\nNonlinearity');

    for p=1:length(oldBlockParams)
        if strcmp(oldBlockParams{p}, 'IncludeNoise')
            if strncmp(InstanceData(p).Value, 'on', 2)
                newBlockPath = 'commobslib/Amplifier';
            end
        end
    end

    if strncmp(newBlockPath, 'commrf', 6)
        % Remove noise related parameters
        for p=length(oldBlockParams):-1:1
            switch oldBlockParams{p}
                case {'IncludeNoise', 'NoiseType', 'NoiseTemperature', ...
                        'NoiseFigure', 'NoiseFactor', 'SeedSource', 'Seed'}
                    InstanceData(p) = [];
            end
        end
    end

    outData.NewBlockPath = newBlockPath;
    outData.NewInstanceData = InstanceData;
end
