package   cn.wise.sc.energy.power.plant.business.opentsdb.bean;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.opentsdb.client.bean.BaseBean;

import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @author: qh
 * @create: 2020-05-06 15:51
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PutExt extends BaseBean {

    private String metric;
    private Long timestamp;
    private Number value;
    private Map<String, String> tags;
    private String tsuid;

    public PutExt putTag(String key, String value) {
        if (getTags() == null) {
            setTags(new HashMap<>());
        }
        getTags().putIfAbsent(key, value);
        return this;
    }
}
