package com.qmth.sop.business.bean.result;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Objects;

/**
 * @Description: 新增/更新返回值
 * @Author: CaoZixuan
 * @Date: 2021-03-22
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class EditResult implements Serializable {

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "主键")
    private Long id;

    @ApiModelProperty(value = "更新时间")
    Long updateTime;

    @ApiModelProperty(value = "成功状态")
    Boolean success;

    @ApiModelProperty(value = "附件url")
    String url;

    @ApiModelProperty(value = "小程序签名key")
    String key;

    @ApiModelProperty(value = "txt文件内容")
    String content;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }


    public Long getUpdateTime() {
        if (Objects.isNull(updateTime)) {
            return System.currentTimeMillis();
        } else {
            return updateTime;
        }
    }

    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    public EditResult(Long id) {
        this.id = id;
    }

    public EditResult(Boolean success) {
        this.success = success;
    }

    public EditResult(Long id, String url) {
        this.id = id;
        this.url = url;
    }

    public EditResult(Long id, String url, String key) {
        this.id = id;
        this.url = url;
        this.key = key;
    }

    public EditResult(String url, String content) {
        this.url = url;
        this.content = content;
    }

    public EditResult() {
    }
}
