package com.usky.ai.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class AlgTaskSnapResponseDTO {
    @JsonProperty("BoardIp")
    private String boardIp;

    @JsonProperty("BoardId")
    private String boardId;

    @JsonProperty("Event")
    private String event;

    @JsonProperty("Result")
    private Result result;

    @JsonProperty("AlgTaskSession")
    private String algTaskSession;

    @JsonProperty("Base64")
    private String base64;

    public boolean isSuccess() {
        return result != null && Integer.valueOf(0).equals(result.getCode());
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Result {
        @JsonProperty("Code")
        private int code;

        @JsonProperty("Desc")
        private String desc;
    }

    private long time = System.currentTimeMillis();
}
