package com.apobates.forum.thrones.tag;

import java.io.IOException;
import java.util.Map;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;

/**
 * 版块,话题状态的图标
 *
 * @author xiaofanku
 * @since 20190819
 */
public class ForumStatusIcoTag extends SimpleTagSupport {
    private int value;
    private final Map<Integer, String> icoMap;
    
    public ForumStatusIcoTag() {
        super();
        Map<Integer, String> data = Map.ofEntries(
                Map.entry(0, "mdi-delete"),
                Map.entry(1, "mdi-lock-outline"),
                Map.entry(2, "mdi-eye"),
                Map.entry(3, "mdi-quote"),
                Map.entry(4, "mdi-star"));
        this.icoMap = data;
    }
    
    public void setValue(int value) {
        this.value = value;
    }
    
    
    @Override
    public void doTag() throws JspException, IOException {
        getJspContext().getOut().print(icoMap.getOrDefault(value, ""));
    }
}