package cn.axzo.msg.center.message.service.card;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import java.util.HashSet;
import java.util.Set;

/**
 * @author yanglin
 */
@Data
@RefreshScope
@Configuration
@ConfigurationProperties(prefix = "card")
public class CardProps {

    private boolean debugBizBody = true;
    private boolean enableCardLog = true;
    private boolean deleteCardsWhenSendFail = true;
    private boolean enableCardIdempotent = true;
    private int updateCardBatchSize = 200;
    private Set<String> idempotentFreeTemplateCodes = new HashSet<>();

    boolean isIdempotentFree(String templateCode) {
        return getIdempotentFreeTemplateCodes().contains(templateCode);
    }
}