package com.infoepoch.pms.agent.platform.chat.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

import java.time.LocalDateTime;

/**
 * @author jiangyz
 * @date 2026/4/18 10:31
 * 检查点
 */
@Getter
public class GraphCheckPoint {

    /**
     *
     */
    private String checkPointId;
    /**
     *
     */
    private String parentCheckPointId;
    /**
     *
     */
    private String threadId;
    /**
     *
     */
    private String sessionId;
    /**
     *
     */
    private String nodeId;
    /**
     *
     */
    private String nextNodeId;
    /**
     *
     */
    private String stateData;
    /**
     *
     */
    private byte[] checkpointPayload;
    /**
     *
     */
    private String stateContentType;
    /**
     *
     */
    private Boolean released;
    /**
     *
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime savedAt;

    /**
     * 私有无参构造
     */
    private GraphCheckPoint() {
    }

    /**
     * 仓储还原
     */
    public GraphCheckPoint(String checkPointId, String parentCheckPointId, String threadId, String nodeId, String nextNodeId, String stateData, String stateContentType, LocalDateTime savedAt) {
        this.checkPointId = checkPointId;
        this.parentCheckPointId = parentCheckPointId;
        this.threadId = threadId;
        this.nodeId = nodeId;
        this.nextNodeId = nextNodeId;
        this.stateData = stateData;
        this.stateContentType = stateContentType;
        this.savedAt = savedAt;
    }

    public GraphCheckPoint(String threadId,
                           String sessionId,
                           String checkPointId,
                           String nodeId,
                           String nextNodeId,
                           byte[] checkpointPayload,
                           Boolean released,
                           LocalDateTime savedAt) {
        this.threadId = threadId;
        this.sessionId = sessionId;
        this.checkPointId = checkPointId;
        this.nodeId = nodeId;
        this.nextNodeId = nextNodeId;
        this.checkpointPayload = checkpointPayload;
        this.released = released;
        this.savedAt = savedAt;
    }
}
