package com.zm.order.tool.server.model;

import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;

/**
 * Trace信息
 * 示例：
 * qm-trace-span-id: 0
 * qm-trace-id: 58237f493a6b44de3b19e83e37752b7e
 * qm-trace-store-id: 1000106
 * qm-from: wechat
 * qm-from-type: cy
 *
 * @author 宋欢
 */
public final class TraceIdentity implements Serializable {

    private static final Logger logger = LoggerFactory.getLogger(TraceIdentity.class);

    /**
     * Header：trace-span-id
     */
    public static final String HEADER_TRACE_SPAN_ID = "qm-trace-span-id";

    /**
     * Header：trace-id
     */
    public static final String HEADER_TRACE_ID = "qm-trace-id";

    /**
     * Header：trace-store-id
     */
    public static final String HEADER_TRACE_STORE_ID = "qm-trace-store-id";

    /**
     * Header：from
     */
    public static final String HEADER_FROM = "qm-from";

    /**
     * Header：from-type
     */
    public static final String HEADER_FROM_TYPE = "qm-from-type";

    private String traceSpanId;
    private String traceId;
    private long traceStoreId;
    private String from;
    private String fromType;

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

    public String getTraceSpanId() {
        return traceSpanId;
    }

    public void setTraceSpanId(String traceSpanId) {
        this.traceSpanId = traceSpanId;
    }

    public String getTraceId() {
        return traceId;
    }

    public void setTraceId(String traceId) {
        this.traceId = traceId;
    }

    public long getTraceStoreId() {
        return traceStoreId;
    }

    public void setTraceStoreId(long traceStoreId) {
        this.traceStoreId = traceStoreId;
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getFromType() {
        return fromType;
    }

    public void setFromType(String fromType) {
        this.fromType = fromType;
    }
}
