package _VisualDVM.ComponentsServer.Component.Json;
import Common.CommonConstants;
import Common.Utils.Utils_;
import _VisualDVM.ComponentsServer.Component.Component;
import _VisualDVM.ComponentsServer.Component.ComponentType;
import com.google.gson.annotations.Expose;

import java.io.Serializable;
public class ComponentPublicationInfoJson implements Serializable {
    @Expose
    public ComponentType componentType = ComponentType.Undefined;
    @Expose
    public String fileName = "";
    @Expose
    public byte[] packedFile = null;
    @Expose
    public long versionNumber = CommonConstants.Nan;
    @Expose
    public String versionText = "";
    @Expose
    public String changeRecord = "";
    @Expose
    public boolean needsUpdateMinimalVersion = false;
    @Expose
    public boolean needsEmail = false;
    @Expose
    public boolean needsSendFile = false;
    public ComponentPublicationInfoJson(Component component) throws Exception {
        componentType = component.getComponentType();
        fileName = component.getFileName();
        packedFile = Utils_.fileToBytes(component.getFile());
        versionNumber = component.version;
        versionText = component.getVersionText();
    }
}
