package com.sunxung.factoring.entity.sys;

import cn.hutool.core.builder.Builder;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.sunxung.factoring.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;

import java.util.List;

/**
 * <p>
 * 通用附件关系表
 * </p>
 *
 * @author daxian
 * @since 2022-02-28
 */
@TableName("sys_attachment_ref")
public class SysAttachmentRef extends BaseEntity {

    private static final long serialVersionUID = 1L;

    public static final Integer STORAGE_TYPE_LOCAL = 0;


    /**
     * 模块名称
     */
    @TableField("module_name")
    private String moduleName;

    /**
     * 实体名称
     */
    @TableField("entity_name")
    private String entityName;

    /**
     * 实体Id
     */
    @TableField("entity_id")
    private Long entityId;

    /**
     * 拓展字段，用于区分多个附件
     */
    @TableField("entity_type_expand")
    private String entityTypeExpand;

    /**
     * 附件的存储方式 0：本地存储
     */
    @TableField("file_storage_type")
    private Integer fileStorageType;

    /**
     * 文件的ID
     */
    @TableField("file_storage_id")
    private Long fileStorageId;


    public String getModuleName() {
        return moduleName;
    }

    public void setModuleName(String moduleName) {
        this.moduleName = moduleName;
    }
    public String getEntityName() {
        return entityName;
    }

    public void setEntityName(String entityName) {
        this.entityName = entityName;
    }
    public Long getEntityId() {
        return entityId;
    }

    public void setEntityId(Long entityId) {
        this.entityId = entityId;
    }
    public String getEntityTypeExpand() {
        return entityTypeExpand;
    }

    public void setEntityTypeExpand(String entityTypeExpand) {
        this.entityTypeExpand = entityTypeExpand;
    }
    public Integer getFileStorageType() {
        return fileStorageType;
    }

    public void setFileStorageType(Integer fileStorageType) {
        this.fileStorageType = fileStorageType;
    }
    public Long getFileStorageId() {
        return fileStorageId;
    }

    public void setFileStorageId(Long fileStorageId) {
        this.fileStorageId = fileStorageId;
    }

    @Override
    public String toString() {
        return "SysAttachmentRef{" +
            "moduleName=" + moduleName +
            ", entityName=" + entityName +
            ", entityId=" + entityId +
            ", entityTypeExpand=" + entityTypeExpand +
            ", fileStorageType=" + fileStorageType +
            ", fileStorageId=" + fileStorageId +
        "}";
    }

    public SysAttachmentRef() {
    }

    public static AttachmentPoBuilder builder(){
        return new AttachmentPoBuilder();
    }


    public static class AttachmentPoBuilder implements Builder<SysAttachmentRef>{


        /**
         * 模块名称
         */
        private String moduleName;

        /**
         * 实体名称
         */
        private String entityName;

        /**
         * 实体Id
         */
        private Long entityId;

        /**
         * 拓展字段，用于区分多个附件
         */
        private String entityTypeExpand;

        /**
         * 附件的存储方式 0：本地存储
         */
        private Integer fileStorageType;

        /**
         * 文件的ID
         */
        private Long fileStorageId;

        public AttachmentPoBuilder setModuleName(String moduleName) {
            this.moduleName = moduleName;
            return this;
        }

        public AttachmentPoBuilder setEntityName(String entityName) {
            this.entityName = entityName;
            return this;
        }

        public AttachmentPoBuilder setEntityId(Long entityId) {
            this.entityId = entityId;
            return this;
        }

        public AttachmentPoBuilder setEntityTypeExpand(String entityTypeExpand) {
            this.entityTypeExpand = entityTypeExpand;
            return this;
        }

        public AttachmentPoBuilder setFileStorageType(Integer fileStorageType) {
            this.fileStorageType = fileStorageType;
            return this;
        }

        public AttachmentPoBuilder setFileStorageId(Long fileStorageId) {
            this.fileStorageId = fileStorageId;
            return this;
        }

        @Override
        public SysAttachmentRef build() {
            return new SysAttachmentRef(this);
        }

    }

    public SysAttachmentRef(AttachmentPoBuilder builder) {
        this.moduleName = builder.moduleName;
        this.entityName = builder.entityName;
        this.entityId = builder.entityId;
        this.entityTypeExpand = builder.entityTypeExpand;
        this.fileStorageType = builder.fileStorageType;
        this.fileStorageId = builder.fileStorageId;
    }
}
