@SuppressWarnings("unchecked")
    public final T addImport(Symbol symbol, String alias, SymbolReference.ContextOption... options) {
        LOGGER.finest(() -> String.format("Adding import %s as `%s` (%s)",
                symbol.getNamespace(),
                alias,
                Arrays.toString(options)));

        // Always add the dependencies of the symbol.
        dependencies.addAll(symbol.getDependencies());

        // Only add an import for the symbol if the symbol is external to the
        // current "namespace" (where "namespace" can mean whatever is need to
        // mean for each target language).
        importContainer.importSymbol(symbol, alias);

        // Even if the symbol is in the same namespace as the current namespace,
        // the symbol references of the given symbol always need to be imported
        // because the assumption is that the symbol is being USED or DECLARED
        // and is required ot refer to other symbols as part of the definition.
        addImportReferences(symbol, options);

        return (T) this;
    }
Imports a symbol (if necessary) using a specific alias and list of
context options.

<p>This method automatically adds any dependencies of the {@code symbol}
to the writer, calls {@link ImportContainer#importSymbol}, and
automatically calls {@link #addImportReferences} for the provided
{@code symbol}.

<p>When called with no {@code options}, both {@code USE} and
{@code DECLARE} symbols are imported from any references the
{@code Symbol} might contain.

@param symbol Symbol to optionally import.
@param alias The alias to refer to the symbol by.
@param options The list of context options (e.g., is it a USE or DECLARE symbol).
@return Returns the writer.
smithy-codegen-core/src/main/java/software/amazon/smithy/codegen/core/writer/SymbolWriter.java