package cn.axzo.msg.center.message.send.processor;

import cn.axzo.msg.center.common.utils.PlaceholderResolver;
import com.alibaba.fastjson.JSONObject;
import java.util.Objects;

/**
 * @author syl
 * @date 2023/12/18
 */
public interface ISendProcessor {

    default void check(SendContext context) {
    }

    default void send(SendContext context) {
    }

    default void checkReach(ReachContext context) {
    }

    default void reach(ReachContext context) {
    }

    default void save(ReachContext context) {
    }

    default String parseString(String string, JSONObject params) {
        if (Objects.isNull(params)) {
            return string;
        }
        return PlaceholderResolver.getDefaultResolver().resolveByMap(string, params);
    }
}
