package com.qmth.sop.business.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.sop.business.bean.dto.AttachmentInfoDto;
import com.qmth.sop.common.base.BaseEntity;
import com.qmth.sop.common.contant.SystemConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * <p>
 * 所有附件记录表
 * </p>
 *
 * @author wangliang
 * @since 2023-07-17
 */
@ApiModel(value = "BasicAttachment对象", description = "所有附件记录表")
public class BasicAttachment extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "机构id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long orgId;

    @ApiModelProperty(value = "文件名")
    private String name;

    @ApiModelProperty(value = "文件类型")
    private String type;

    @ApiModelProperty(value = "单位（KB）")
    private BigDecimal size;

    @ApiModelProperty(value = "文件md5值")
    private String md5;

    @ApiModelProperty(value = "存储路径")
    private String path;

    @ApiModelProperty(value = "关联业务id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long objId;

    @ApiModelProperty(value = "备注")
    private String remark;

    public BasicAttachment() {

    }

    public BasicAttachment(String path, AttachmentInfoDto attachmentInfoDto, Long createId, String key) {
        setId(SystemConstant.getDbUuid());
        this.path = path;
        this.name = attachmentInfoDto.getFileName();
        this.type = attachmentInfoDto.getFormat();
        this.size = attachmentInfoDto.getSize();
        this.md5 = attachmentInfoDto.getMd5();
        setCreateTime(System.currentTimeMillis());
        setCreateId(createId);
        this.remark = key;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public BigDecimal getSize() {
        return size;
    }

    public void setSize(BigDecimal size) {
        this.size = size;
    }

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Long getObjId() {
        return objId;
    }

    public void setObjId(Long objId) {
        this.objId = objId;
    }
}
