001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package dev.metaschema.core.model;
007
008import java.util.List;
009import java.util.Map;
010
011import edu.umd.cs.findbugs.annotations.NonNull;
012import edu.umd.cs.findbugs.annotations.Nullable;
013
014/**
015 * Provides assembly-specific container model functionality through delegation.
016 * <p>
017 * This interface extends absolute container model features with
018 * assembly-specific capabilities, including choice and choice group instances.
019 * Implementations delegate to an {@link IContainerModelAssemblySupport}
020 * instance.
021 *
022 * @param <MI>
023 *          the Java type of model instances
024 * @param <NMI>
025 *          the Java type of named model instances
026 * @param <FI>
027 *          the Java type of field instances
028 * @param <AI>
029 *          the Java type of assembly instances
030 * @param <CI>
031 *          the Java type of choice instances
032 * @param <CGI>
033 *          the Java type of choice group instances
034 */
035public interface IFeatureContainerModelAssembly<
036    MI extends IModelInstanceAbsolute,
037    NMI extends INamedModelInstanceAbsolute,
038    FI extends IFieldInstanceAbsolute,
039    AI extends IAssemblyInstanceAbsolute,
040    CI extends IChoiceInstance,
041    CGI extends IChoiceGroupInstance>
042    extends IContainerModelAssembly,
043    IFeatureContainerModelAbsolute<MI, NMI, FI, AI> {
044  /**
045   * Get the model container implementation instance.
046   *
047   * @return the model container instance
048   */
049  @Override
050  @NonNull
051  IContainerModelAssemblySupport<MI, NMI, FI, AI, CI, CGI> getModelContainer();
052
053  @Override
054  default List<CI> getChoiceInstances() {
055    return getModelContainer().getChoiceInstances();
056  }
057
058  @Override
059  default CGI getChoiceGroupInstanceByName(String name) {
060    return getModelContainer().getChoiceGroupInstanceMap().get(name);
061  }
062
063  @Override
064  default Map<String, CGI> getChoiceGroupInstances() {
065    return getModelContainer().getChoiceGroupInstanceMap();
066  }
067
068  @Override
069  @Nullable
070  default IAnyInstance getAnyInstance() {
071    return getModelContainer().getAnyInstance();
072  }
073}