package com.gameplatform.server.model.entity.history;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDateTime;

@TableName("link_task_status_history")
public class LinkTaskStatusHistory {
    @TableId(type = IdType.AUTO)
    private Long id;
    private Long linkTaskId;
    private String codeNo;
    private String machineId;
    private String prevStatus;
    private String newStatus;
    private String source;
    private String reason;
    private Integer sinceLoginSeconds;
    private String extraJson;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    public LinkTaskStatusHistory() {}

    public LinkTaskStatusHistory(Long linkTaskId, String codeNo, String machineId,
                                 String prevStatus, String newStatus, String source,
                                 String reason, Integer sinceLoginSeconds, String extraJson) {
        this.linkTaskId = linkTaskId;
        this.codeNo = codeNo;
        this.machineId = machineId;
        this.prevStatus = prevStatus;
        this.newStatus = newStatus;
        this.source = source;
        this.reason = reason;
        this.sinceLoginSeconds = sinceLoginSeconds;
        this.extraJson = extraJson;
        this.createdAt = LocalDateTime.now();
    }

    // getters/setters
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }
    public Long getLinkTaskId() { return linkTaskId; }
    public void setLinkTaskId(Long linkTaskId) { this.linkTaskId = linkTaskId; }
    public String getCodeNo() { return codeNo; }
    public void setCodeNo(String codeNo) { this.codeNo = codeNo; }
    public String getMachineId() { return machineId; }
    public void setMachineId(String machineId) { this.machineId = machineId; }
    public String getPrevStatus() { return prevStatus; }
    public void setPrevStatus(String prevStatus) { this.prevStatus = prevStatus; }
    public String getNewStatus() { return newStatus; }
    public void setNewStatus(String newStatus) { this.newStatus = newStatus; }
    public String getSource() { return source; }
    public void setSource(String source) { this.source = source; }
    public String getReason() { return reason; }
    public void setReason(String reason) { this.reason = reason; }
    public Integer getSinceLoginSeconds() { return sinceLoginSeconds; }
    public void setSinceLoginSeconds(Integer sinceLoginSeconds) { this.sinceLoginSeconds = sinceLoginSeconds; }
    public String getExtraJson() { return extraJson; }
    public void setExtraJson(String extraJson) { this.extraJson = extraJson; }
    public LocalDateTime getCreatedAt() { return createdAt; }
    public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
}

