package com.tourism.webadmin.app.website.service.impl.noticeImpl;
import com.tourism.webadmin.app.website.service.IMessageBuilderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;
/**
 * MessageBuilderFactorys 类。
 * <p>
 * 描述：
 *
 * @author huangwenwen
 * @date 2025/1/4
 */
@Component
public class MessageBuilderFactory {

    private final Map<String, IMessageBuilderService> builders;

    @Autowired
    public MessageBuilderFactory(Map<String, IMessageBuilderService> builders) {
        this.builders = builders;
    }

    public Object buildMessage(String actionType, Object[] args) {
        IMessageBuilderService builder = builders.get(actionType);
        if (builder == null) return null ;
        return builder.buildMessage(args);
    }
}

