/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.jboss.as.clustering.jgroups.subsystem;

import java.util.function.Function;

import org.jboss.as.controller.ModelVersion;
import org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder;
import org.jboss.as.controller.transform.description.TransformationDescription;
import org.jboss.as.controller.transform.description.TransformationDescriptionBuilder;

/**
 * Transformer for the JGroups subsystem resource.
 * @author Paul Ferraro
 */
public class JGroupsSubsystemResourceTransformer implements Function<ModelVersion, TransformationDescription> {

    @Override
    public TransformationDescription apply(ModelVersion version) {
        ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createSubsystemInstance();

        new ChannelResourceTransformer(builder).accept(version);
        new StackResourceTransformer(builder).accept(version);

        return builder.build();
    }
}
